diff options
| author | Todd Fiala <todd.fiala@gmail.com> | 2015-10-27 21:53:39 +0000 |
|---|---|---|
| committer | Todd Fiala <todd.fiala@gmail.com> | 2015-10-27 21:53:39 +0000 |
| commit | 0437f0351aa80d7d287233dc9aa2ebf69a0d34c2 (patch) | |
| tree | e0b8624c3409663f6b980846c2e0124685e3a56d /lldb/source/Host/common/Editline.cpp | |
| parent | 12504649dc66c0d5cfc2dccc7d3c5e65649a65f7 (diff) | |
| download | bcm5719-llvm-0437f0351aa80d7d287233dc9aa2ebf69a0d34c2.tar.gz bcm5719-llvm-0437f0351aa80d7d287233dc9aa2ebf69a0d34c2.zip | |
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.
llvm-svn: 251457
Diffstat (limited to 'lldb/source/Host/common/Editline.cpp')
| -rw-r--r-- | lldb/source/Host/common/Editline.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lldb/source/Host/common/Editline.cpp b/lldb/source/Host/common/Editline.cpp index ed67d0c2c2b..d49dc8f7e2e 100644 --- a/lldb/source/Host/common/Editline.cpp +++ b/lldb/source/Host/common/Editline.cpp @@ -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; |

