Page MenuHomeFreeBSD

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

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

Details

Summary

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

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

jah created this revision.May 30 2020, 9:29 PM
jah requested review of this revision.May 30 2020, 9:29 PM
jah added a reviewer: emaste.May 30 2020, 9:30 PM
jah added inline comments.May 30 2020, 11:56 PM
sys/kern/subr_terminal.c
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...

jah updated this revision to Diff 72465.May 31 2020, 12:28 AM

Ensure the visible rect is invalidated on CONS_CLRHIST

emaste accepted this revision.May 31 2020, 12:48 AM
emaste added inline comments.
sys/kern/subr_terminal.c
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
jah updated this revision to Diff 72467.May 31 2020, 2:05 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.