================
@@ -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
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to