[Lldb-commits] [lldb] [lldb] Use 1 based row and column for statusline (PR #143385)

via lldb-commits lldb-commits at lists.llvm.org
Mon Jun 9 07:53:45 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: David Spickett (DavidSpickett)

<details>
<summary>Changes</summary>

I can't find a proper source for this but many materials say that ANSI rows and columns start at 1 not 0.

https://www2.math.upenn.edu/~kazdan/210/computer/ansi.html is as good as I can get:
<row> is a number from 1 through 25 that specifies the row to which the cursor is to be moved. <col> is a number from 1 through 80 that specifies the column to which the cursor is to be moved.

0 does work in Windows terminal and Linux terminals, but we might as well be correct and it's one less thing to reason about when auditing this code.

>From what I read, some terminals correct 0 back to 1 and some treat 0 as a missing argument, which also defaults to 1.

---
Full diff: https://github.com/llvm/llvm-project/pull/143385.diff


1 Files Affected:

- (modified) lldb/source/Core/Statusline.cpp (+2-2) 


``````````diff
diff --git a/lldb/source/Core/Statusline.cpp b/lldb/source/Core/Statusline.cpp
index 52f6134123b76..8a8640805cac0 100644
--- a/lldb/source/Core/Statusline.cpp
+++ b/lldb/source/Core/Statusline.cpp
@@ -24,8 +24,8 @@
 #define ANSI_SAVE_CURSOR ESCAPE "7"
 #define ANSI_RESTORE_CURSOR ESCAPE "8"
 #define ANSI_CLEAR_BELOW ESCAPE "[J"
-#define ANSI_SET_SCROLL_ROWS ESCAPE "[0;%ur"
-#define ANSI_TO_START_OF_ROW ESCAPE "[%u;0f"
+#define ANSI_SET_SCROLL_ROWS ESCAPE "[1;%ur"
+#define ANSI_TO_START_OF_ROW ESCAPE "[%u;1f"
 #define ANSI_REVERSE_VIDEO ESCAPE "[7m"
 #define ANSI_UP_ROWS ESCAPE "[%dA"
 

``````````

</details>


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


More information about the lldb-commits mailing list