[Lldb-commits] [lldb] [lldb][windows] inherit cursor's position when creating a ConPTY (PR #193818)

via lldb-commits lldb-commits at lists.llvm.org
Fri Apr 24 09:24:52 PDT 2026


================
@@ -69,12 +113,42 @@ size_t ConnectionConPTY::Read(void *dst, size_t dst_len,
     m_pty->GetCV().wait(guard, [this] { return !m_pty->IsStopping(); });
   }
 
+  char *out = static_cast<char *>(dst);
   size_t bytes_read =
-      ConnectionGenericFile::Read(dst, dst_len, timeout, status, error_ptr);
+      ConnectionGenericFile::Read(out, dst_len, timeout, status, error_ptr);
+
+  if (bytes_read > 0 && !m_conpty_sequences_stripped)
+    if (StripConPTYSequences(out, bytes_read))
+      m_conpty_sequences_stripped = true;
 
-  if (bytes_read > 0 && !m_pty_vt_sequence_was_stripped) {
-    if (StripConPTYInitSequences(dst, dst_len, bytes_read))
-      m_pty_vt_sequence_was_stripped = true;
+  // ConPTY translates LF -> CRLF via two separate pipe writes.
+  if (bytes_read > 0 && bytes_read < dst_len && out[bytes_read - 1] == '\r' &&
+      status == eConnectionStatusSuccess) {
+    OVERLAPPED lf_ov = {};
+    lf_ov.hEvent = ::CreateEvent(nullptr, /*bManualReset=*/TRUE,
+                                 /*bInitialState=*/FALSE, nullptr);
----------------
Nerixyz wrote:

Does this happen often? If so, we should store this event in the class instead of creating it every time we read.

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


More information about the lldb-commits mailing list