[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
Date: Tue Oct 27 16:53:39 2015
New Revision: 251457
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.
--- 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;
More information about the lldb-commits