[Lldb-commits] [lldb] [lldb] Optimize statusline redrawing on terminal size change (PR #146435)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Tue Jul 1 02:26:09 PDT 2025


================
@@ -41,10 +41,26 @@ Statusline::Statusline(Debugger &debugger)
 Statusline::~Statusline() { Disable(); }
 
 void Statusline::TerminalSizeChanged() {
-  UpdateTerminalProperties();
+  const uint64_t terminal_width = m_debugger.GetTerminalWidth();
+  const uint64_t terminal_height = m_debugger.GetTerminalHeight();
+
+  // Remember whether the terminal height changed.
+  const bool terminal_height_changed = terminal_height != m_terminal_height;
+
+  // Avoid clearing the old statusline if it's not visible (i.e. when the
+  // terminal height decreases), unless the width changed and the old statusline
+  // wrapped.
+  if (terminal_height > m_terminal_height || terminal_width < m_terminal_width)
----------------
labath wrote:

FWIW, my terminal is not wrapping the status line when the width decreases. In fact, it seems to be internally resetting (disabling) the scroll windows whenever the size changes.

https://github.com/llvm/llvm-project/pull/146435


More information about the lldb-commits mailing list