[Lldb-commits] [lldb] [lldb] Correctly restore the cursor column after resizing the statusline (PR #145823)

David Spickett via lldb-commits lldb-commits at lists.llvm.org
Thu Jun 26 01:58:33 PDT 2025


================
@@ -398,6 +397,20 @@ int Editline::GetLineIndexForLocation(CursorLocation location, int cursor_row) {
   return line;
 }
 
+CursorPosition Editline::GetCursorPosition() {
+  if (!m_editline)
+    return {};
+
+  const LineInfoW *info = el_wline(m_editline);
+  if (!info)
+    return {};
+
+  const size_t editline_cursor_col =
+      (int)((info->cursor - info->buffer) + GetPromptWidth()) + 1;
----------------
DavidSpickett wrote:

You're going to static cast this later, so could you make the type here unsigned to begin with?

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


More information about the lldb-commits mailing list