[Lldb-commits] [lldb] [lldb] Fix a bug when disabling the statusline. (PR #169127)
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Mon Dec 1 10:23:16 PST 2025
https://github.com/JDevlieghere updated https://github.com/llvm/llvm-project/pull/169127
>From 0c2ace38aeaed9de6edddec7e9ed568fc1cdf477 Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere <jonas at devlieghere.com>
Date: Fri, 21 Nov 2025 15:29:43 -0800
Subject: [PATCH 1/3] [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
---
lldb/source/Core/Statusline.cpp | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/lldb/source/Core/Statusline.cpp b/lldb/source/Core/Statusline.cpp
index bfbd190fba27c..922aada07e979 100644
--- a/lldb/source/Core/Statusline.cpp
+++ b/lldb/source/Core/Statusline.cpp
@@ -91,7 +91,7 @@ void Statusline::UpdateScrollWindow(ScrollWindowMode mode) {
if (!stream_sp)
return;
- const unsigned reduced_scroll_window = m_terminal_height - 1;
+ const unsigned reduced_scroll_rows = m_terminal_height - 1;
LockedStreamFile locked_stream = stream_sp->Lock();
switch (mode) {
@@ -101,13 +101,14 @@ void Statusline::UpdateScrollWindow(ScrollWindowMode mode) {
locked_stream.Printf(ANSI_UP_ROWS, 1);
// Reduce the scroll window.
locked_stream << ANSI_SAVE_CURSOR;
- locked_stream.Printf(ANSI_SET_SCROLL_ROWS, reduced_scroll_window);
+ locked_stream.Printf(ANSI_SET_SCROLL_ROWS, reduced_scroll_rows);
locked_stream << ANSI_RESTORE_CURSOR;
break;
case DisableStatusline:
// Reset the scroll window.
locked_stream << ANSI_SAVE_CURSOR;
- locked_stream.Printf(ANSI_SET_SCROLL_ROWS, 0);
+ locked_stream.Printf(ANSI_SET_SCROLL_ROWS,
+ static_cast<unsigned>(m_terminal_height));
locked_stream << ANSI_RESTORE_CURSOR;
// Clear the screen below to hide the old statusline.
locked_stream << ANSI_CLEAR_BELOW;
@@ -116,7 +117,7 @@ void Statusline::UpdateScrollWindow(ScrollWindowMode mode) {
// Clear the screen and update the scroll window.
// FIXME: Find a better solution (#146919).
locked_stream << ANSI_CLEAR_SCREEN;
- locked_stream.Printf(ANSI_SET_SCROLL_ROWS, reduced_scroll_window);
+ locked_stream.Printf(ANSI_SET_SCROLL_ROWS, reduced_scroll_rows);
break;
}
>From 56cbb27cce1126efcbdf3b723fccaf5f849a76f1 Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere <jonas at devlieghere.com>
Date: Fri, 21 Nov 2025 15:47:45 -0800
Subject: [PATCH 2/3] Update test
---
lldb/test/API/functionalities/statusline/TestStatusline.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lldb/test/API/functionalities/statusline/TestStatusline.py b/lldb/test/API/functionalities/statusline/TestStatusline.py
index ca376cc595f30..6ae74b459d187 100644
--- a/lldb/test/API/functionalities/statusline/TestStatusline.py
+++ b/lldb/test/API/functionalities/statusline/TestStatusline.py
@@ -72,7 +72,9 @@ def test(self):
self.expect('set set separator "| "')
# Hide the statusline and check or the control character.
- self.expect("set set show-statusline false", ["\x1b[1;0r"])
+ self.expect(
+ "set set show-statusline false", ["\x1b[1;{}r".format(self.TERMINAL_HEIGHT)]
+ )
def test_no_color(self):
"""Basic test for the statusline with colors disabled."""
>From bcd142a71be04a83a113b2b870fee769e76d5d94 Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere <jonas at devlieghere.com>
Date: Mon, 1 Dec 2025 10:20:55 -0800
Subject: [PATCH 3/3] Fix typo
---
lldb/test/API/functionalities/statusline/TestStatusline.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lldb/test/API/functionalities/statusline/TestStatusline.py b/lldb/test/API/functionalities/statusline/TestStatusline.py
index 6ae74b459d187..4ffa864120a5c 100644
--- a/lldb/test/API/functionalities/statusline/TestStatusline.py
+++ b/lldb/test/API/functionalities/statusline/TestStatusline.py
@@ -71,7 +71,7 @@ def test(self):
)
self.expect('set set separator "| "')
- # Hide the statusline and check or the control character.
+ # Hide the statusline and check for the control character.
self.expect(
"set set show-statusline false", ["\x1b[1;{}r".format(self.TERMINAL_HEIGHT)]
)
More information about the lldb-commits
mailing list