diff options
author | Greg Clayton <gclayton@apple.com> | 2014-04-23 17:57:26 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2014-04-23 17:57:26 +0000 |
commit | 90e9692d0571a1640c115f2b31f6c27d94394434 (patch) | |
tree | 1a2cbec20896cfc6258ca4db028c0609b30d6d32 /lldb/source/Host/common | |
parent | 9da2a799abd809770efab64555321c01987cd591 (diff) | |
download | bcm5719-llvm-90e9692d0571a1640c115f2b31f6c27d94394434.tar.gz bcm5719-llvm-90e9692d0571a1640c115f2b31f6c27d94394434.zip |
Fixed a case where if someone added a "bind -v" to their ~/.editrc file, key mappings would get messed up.
I fixed this by only doing el_set(e, EL_BIND, ...) calls before sourcing the .editrc files.
<rdar://problem/16614095>
llvm-svn: 207005
Diffstat (limited to 'lldb/source/Host/common')
-rw-r--r-- | lldb/source/Host/common/Editline.cpp | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/lldb/source/Host/common/Editline.cpp b/lldb/source/Host/common/Editline.cpp index 6c3f87222f8..ba20b9ceb9c 100644 --- a/lldb/source/Host/common/Editline.cpp +++ b/lldb/source/Host/common/Editline.cpp @@ -24,6 +24,7 @@ static const char k_prompt_escape_char = '\1'; Editline::Editline (const char *prog, // prog can't be NULL const char *prompt, // can be NULL for no prompt + bool configure_for_multiline, FILE *fin, FILE *fout, FILE *ferr) : @@ -91,6 +92,23 @@ Editline::Editline (const char *prog, // prog can't be NULL ::el_set (m_editline, EL_BIND, "\033[3~", "ed-delete-next-char", NULL); // Fix the delete key. ::el_set (m_editline, EL_BIND, "\t", "lldb-complete", NULL); // Bind TAB to be auto complete + if (configure_for_multiline) + { + // Use escape sequences for control characters due to bugs in editline + // where "-k up" and "-k down" don't always work. + ::el_set (m_editline, EL_BIND, "^[[A", "lldb-edit-prev-line", NULL); // Map up arrow + ::el_set (m_editline, EL_BIND, "^[[B", "lldb-edit-next-line", NULL); // Map down arrow + ::el_set (m_editline, EL_BIND, "^\[", "ed-prev-history", NULL); + ::el_set (m_editline, EL_BIND, "^\]", "ed-next-history", NULL); + } + else + { + // Use escape sequences for control characters due to bugs in editline + // where "-k up" and "-k down" don't always work. + ::el_set (m_editline, EL_BIND, "^[[A", "ed-prev-history", NULL); // Map up arrow + ::el_set (m_editline, EL_BIND, "^[[B", "ed-next-history", NULL); // Map down arrow + } + // Source $PWD/.editrc then $HOME/.editrc ::el_source (m_editline, NULL); @@ -233,8 +251,6 @@ Editline::GetLine(std::string &line) // Set arrow key bindings for up and down arrows for single line // mode where up and down arrows do prev/next history - ::el_set (m_editline, EL_BIND, "^[[A", "ed-prev-history", NULL); // Map up arrow - ::el_set (m_editline, EL_BIND, "^[[B", "ed-next-history", NULL); // Map down arrow m_interrupted = false; if (!m_got_eof) @@ -296,10 +312,6 @@ Editline::GetLines(const std::string &end_line, StringList &lines) // Set arrow key bindings for up and down arrows for multiple line // mode where up and down arrows do edit prev/next line - ::el_set (m_editline, EL_BIND, "^[[A", "lldb-edit-prev-line", NULL); // Map up arrow - ::el_set (m_editline, EL_BIND, "^[[B", "lldb-edit-next-line", NULL); // Map down arrow - ::el_set (m_editline, EL_BIND, "^b", "ed-prev-history", NULL); - ::el_set (m_editline, EL_BIND, "^n", "ed-next-history", NULL); m_interrupted = false; LineStatus line_status = LineStatus::Success; |