Page MenuHomeFreeBSD

vt(4): reset scrollback and cursor position after clearing history buffer

Authored by jah on May 30 2020, 9:29 PM.



r361601 implemented basic support for cleaing the console history buffer.
But after clearing the history buffer, it's not especially useful to be
able to scroll back through that buffer, or for the cursor position to
remain at (very likely) the bottom of the screen.

Diff Detail

rS FreeBSD src repository - subversion
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

jah requested review of this revision.May 30 2020, 9:29 PM
494 ↗(On Diff #72462)

This exposes a new issue: before, it was practically guaranteed that the cursor would be at the bottom of the screen, so the CLRHIST ioctl would be immediately followed by a scroll event that would invalidate the entire visible rect. Now that may no longer be the case: for example if you issue 'vidcontrol -C', then do a few things that don't fill the screen, then issue 'vidcontrol -C' again, some prior artifacts might still remain visible. Let me see if I can fix that...

Ensure the visible rect is invalidated on CONS_CLRHIST

emaste added inline comments.
485 ↗(On Diff #72465)

IMO it'd be fine to do if (cmd == CONS_CLRHIST) which neatly avoids the slightly confusing double } at the same indentation; we can deal with the awkwardness if we ever have a 2nd case to deal with. Yes, this is slightly inconsistent with the switch above.

This revision is now accepted and ready to land.May 31 2020, 12:48 AM

Light cleanup of cursor position handling

This revision now requires review to proceed.May 31 2020, 2:05 AM
jah marked an inline comment as done.May 31 2020, 2:06 AM
This revision was not accepted when it landed; it landed in state Needs Review.Jun 2 2020, 1:22 AM
This revision was automatically updated to reflect the committed changes.