[Lldb-commits] [lldb] r251457 - Fix editline unindentation code for more recent libedits.

Todd Fiala via lldb-commits lldb-commits at lists.llvm.org
Tue Oct 27 14:53:40 PDT 2015


Author: tfiala
Date: Tue Oct 27 16:53:39 2015
New Revision: 251457

URL: http://llvm.org/viewvc/llvm-project?rev=251457&view=rev
Log:
Fix editline unindentation code for more recent libedits.

This code was modifying the cursor and then expecting the editline
API call to see the effect for the next operation.  This is misusing
the API.  Newer editlines break on this code, fixed by this.

Modified:
    lldb/trunk/source/Host/common/Editline.cpp

Modified: lldb/trunk/source/Host/common/Editline.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Editline.cpp?rev=251457&r1=251456&r2=251457&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/Editline.cpp (original)
+++ lldb/trunk/source/Host/common/Editline.cpp Tue Oct 27 16:53:39 2015
@@ -886,8 +886,11 @@ Editline::FixIndentationCommand (int ch)
     }
     else if (indent_correction < 0)
     {
-        info->cursor = info->buffer - indent_correction;
-        el_wdeletestr (m_editline, -indent_correction);
+        // Delete characters for the unindentation AND including the character we just added.
+        el_wdeletestr (m_editline, -indent_correction + 1);
+
+        // Rewrite the character that caused the unindentation.
+        el_winsertstr (m_editline, inserted);
     }
     info->cursor = info->buffer + cursor_position + indent_correction;
     return CC_REFRESH;




More information about the lldb-commits mailing list