Skip to content

Commit f9cba3b

Browse files
authored
Merge pull request #11965 from swiftlang/cherrypick-169127
[lldb] Fix a bug when disabling the statusline. (llvm#169127)
2 parents 450f550 + b977748 commit f9cba3b

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
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

lldb/test/API/functionalities/statusline/TestStatusline.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,10 @@ def test(self):
6666
)
6767
self.expect('set set separator "| "')
6868

69-
# Hide the statusline and check or the control character.
70-
self.expect("set set show-statusline false", ["\x1b[1;0r"])
69+
# Hide the statusline and check for the control character.
70+
self.expect(
71+
"set set show-statusline false", ["\x1b[1;{}r".format(self.TERMINAL_HEIGHT)]
72+
)
7173

7274
def test_no_color(self):
7375
"""Basic test for the statusline with colors disabled."""

0 commit comments

Comments
 (0)