Skip to content

Commit 0c2ace3

Browse files
committed
[lldb] Fix a bug when disabling the statusline.
Currently, disabling the statusline with `settings set show-statusline false` leaves LLDB in a broken state. The same is true when trying to toggle the setting again. The issue was that setting the scroll window to 0 is apparently not identical to setting it to the correct number of rows, even though some documentation online incorrectly claims so. Fixes #166608
1 parent f8a8039 commit 0c2ace3

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lldb/source/Core/Statusline.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ void Statusline::UpdateScrollWindow(ScrollWindowMode mode) {
9191
if (!stream_sp)
9292
return;
9393

94-
const unsigned reduced_scroll_window = m_terminal_height - 1;
94+
const unsigned reduced_scroll_rows = m_terminal_height - 1;
9595
LockedStreamFile locked_stream = stream_sp->Lock();
9696

9797
switch (mode) {
@@ -101,13 +101,14 @@ void Statusline::UpdateScrollWindow(ScrollWindowMode mode) {
101101
locked_stream.Printf(ANSI_UP_ROWS, 1);
102102
// Reduce the scroll window.
103103
locked_stream << ANSI_SAVE_CURSOR;
104-
locked_stream.Printf(ANSI_SET_SCROLL_ROWS, reduced_scroll_window);
104+
locked_stream.Printf(ANSI_SET_SCROLL_ROWS, reduced_scroll_rows);
105105
locked_stream << ANSI_RESTORE_CURSOR;
106106
break;
107107
case DisableStatusline:
108108
// Reset the scroll window.
109109
locked_stream << ANSI_SAVE_CURSOR;
110-
locked_stream.Printf(ANSI_SET_SCROLL_ROWS, 0);
110+
locked_stream.Printf(ANSI_SET_SCROLL_ROWS,
111+
static_cast<unsigned>(m_terminal_height));
111112
locked_stream << ANSI_RESTORE_CURSOR;
112113
// Clear the screen below to hide the old statusline.
113114
locked_stream << ANSI_CLEAR_BELOW;
@@ -116,7 +117,7 @@ void Statusline::UpdateScrollWindow(ScrollWindowMode mode) {
116117
// Clear the screen and update the scroll window.
117118
// FIXME: Find a better solution (#146919).
118119
locked_stream << ANSI_CLEAR_SCREEN;
119-
locked_stream.Printf(ANSI_SET_SCROLL_ROWS, reduced_scroll_window);
120+
locked_stream.Printf(ANSI_SET_SCROLL_ROWS, reduced_scroll_rows);
120121
break;
121122
}
122123

0 commit comments

Comments
 (0)