[Lldb-commits] [lldb] [lldb] Correctly restore the cursor column after resizing the statusline (PR #145823)
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Thu Jun 26 08:25:16 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;
----------------
JDevlieghere wrote:
The static cast is to appease the printf-format specifier. Storing the position as a `size_t` seems more canonical, but I also can't imagine a terminal that exceeds `UINT32_MAX`
https://github.com/llvm/llvm-project/pull/145823
More information about the lldb-commits
mailing list