|
Jan Kratochvil |
683e84e |
commit 9ad9480c3a380a04b3dbe869c0675d6bba37247b
|
|
Jan Kratochvil |
683e84e |
Author: Kamil Rytarowski <n54@gmx.com>
|
|
Jan Kratochvil |
683e84e |
Date: Thu May 25 20:12:30 2017 +0000
|
|
Jan Kratochvil |
683e84e |
|
|
Jan Kratochvil |
683e84e |
Fix bug #28898
|
|
Jan Kratochvil |
683e84e |
lldb: libedit produces garbled, unusable input on Linux
|
|
Jan Kratochvil |
683e84e |
|
|
Jan Kratochvil |
683e84e |
Apply patch from Christos Zoulas, upstream libedit developer.
|
|
Jan Kratochvil |
683e84e |
It has been tested on NetBSD/amd64.
|
|
Jan Kratochvil |
683e84e |
|
|
Jan Kratochvil |
683e84e |
New code supports combination of wide libedit and disabled
|
|
Jan Kratochvil |
683e84e |
LLDB_EDITLINE_USE_WCHAR, which was the popular case on Linux
|
|
Jan Kratochvil |
683e84e |
systems.
|
|
Jan Kratochvil |
683e84e |
|
|
Jan Kratochvil |
683e84e |
|
|
Jan Kratochvil |
683e84e |
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@303907 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
Jan Kratochvil |
683e84e |
|
|
Jan Kratochvil |
683e84e |
diff --git a/include/lldb/Host/Editline.h b/include/lldb/Host/Editline.h
|
|
Jan Kratochvil |
683e84e |
index 2b1a8e0..0b75e9c 100644
|
|
Jan Kratochvil |
683e84e |
--- a/include/lldb/Host/Editline.h
|
|
Jan Kratochvil |
683e84e |
+++ b/include/lldb/Host/Editline.h
|
|
Jan Kratochvil |
683e84e |
@@ -82,8 +82,14 @@ using EditLineStringStreamType = std::stringstream;
|
|
Jan Kratochvil |
683e84e |
using EditLineCharType = char;
|
|
Jan Kratochvil |
683e84e |
#endif
|
|
Jan Kratochvil |
683e84e |
|
|
Jan Kratochvil |
683e84e |
+#ifdef EL_CLIENTDATA /* editline with wide support + wide char read function */
|
|
Jan Kratochvil |
683e84e |
+using EditLineGetCharType = wchar_t;
|
|
Jan Kratochvil |
683e84e |
+#else
|
|
Jan Kratochvil |
683e84e |
+using EditLineGetCharType = char;
|
|
Jan Kratochvil |
683e84e |
+#endif
|
|
Jan Kratochvil |
683e84e |
+
|
|
Jan Kratochvil |
683e84e |
typedef int (*EditlineGetCharCallbackType)(::EditLine *editline,
|
|
Jan Kratochvil |
683e84e |
- EditLineCharType *c);
|
|
Jan Kratochvil |
683e84e |
+ EditLineGetCharType *c);
|
|
Jan Kratochvil |
683e84e |
typedef unsigned char (*EditlineCommandCallbackType)(::EditLine *editline,
|
|
Jan Kratochvil |
683e84e |
int ch);
|
|
Jan Kratochvil |
683e84e |
typedef const char *(*EditlinePromptCallbackType)(::EditLine *editline);
|
|
Jan Kratochvil |
683e84e |
@@ -270,7 +276,7 @@ private:
|
|
Jan Kratochvil |
683e84e |
|
|
Jan Kratochvil |
683e84e |
/// Character reading implementation for EditLine that supports our multi-line
|
|
Jan Kratochvil |
683e84e |
/// editing trickery.
|
|
Jan Kratochvil |
683e84e |
- int GetCharacter(EditLineCharType *c);
|
|
Jan Kratochvil |
683e84e |
+ int GetCharacter(EditLineGetCharType *c);
|
|
Jan Kratochvil |
683e84e |
|
|
Jan Kratochvil |
683e84e |
/// Prompt implementation for EditLine.
|
|
Jan Kratochvil |
683e84e |
const char *Prompt();
|
|
Jan Kratochvil |
683e84e |
@@ -323,7 +329,7 @@ private:
|
|
Jan Kratochvil |
683e84e |
/// single or multi-line editing.
|
|
Jan Kratochvil |
683e84e |
void ConfigureEditor(bool multiline);
|
|
Jan Kratochvil |
683e84e |
|
|
Jan Kratochvil |
683e84e |
- bool CompleteCharacter(char ch, EditLineCharType &out;;
|
|
Jan Kratochvil |
683e84e |
+ bool CompleteCharacter(char ch, EditLineGetCharType &out;;
|
|
Jan Kratochvil |
683e84e |
|
|
Jan Kratochvil |
683e84e |
private:
|
|
Jan Kratochvil |
683e84e |
#if LLDB_EDITLINE_USE_WCHAR
|
|
Jan Kratochvil |
683e84e |
diff --git a/source/Host/common/Editline.cpp b/source/Host/common/Editline.cpp
|
|
Jan Kratochvil |
683e84e |
index 7d4b398..7b580dd 100644
|
|
Jan Kratochvil |
683e84e |
--- a/source/Host/common/Editline.cpp
|
|
Jan Kratochvil |
683e84e |
+++ b/source/Host/common/Editline.cpp
|
|
Jan Kratochvil |
683e84e |
@@ -474,7 +474,7 @@ unsigned char Editline::RecallHistory(bool earlier) {
|
|
Jan Kratochvil |
683e84e |
return CC_NEWLINE;
|
|
Jan Kratochvil |
683e84e |
}
|
|
Jan Kratochvil |
683e84e |
|
|
Jan Kratochvil |
683e84e |
-int Editline::GetCharacter(EditLineCharType *c) {
|
|
Jan Kratochvil |
683e84e |
+int Editline::GetCharacter(EditLineGetCharType *c) {
|
|
Jan Kratochvil |
683e84e |
const LineInfoW *info = el_wline(m_editline);
|
|
Jan Kratochvil |
683e84e |
|
|
Jan Kratochvil |
683e84e |
// Paint a faint version of the desired prompt over the version libedit draws
|
|
Jan Kratochvil |
683e84e |
@@ -969,7 +969,7 @@ void Editline::ConfigureEditor(bool multiline) {
|
|
Jan Kratochvil |
683e84e |
}));
|
|
Jan Kratochvil |
683e84e |
|
|
Jan Kratochvil |
683e84e |
el_wset(m_editline, EL_GETCFN, (EditlineGetCharCallbackType)([](
|
|
Jan Kratochvil |
683e84e |
- EditLine *editline, EditLineCharType *c) {
|
|
Jan Kratochvil |
683e84e |
+ EditLine *editline, EditLineGetCharType *c) {
|
|
Jan Kratochvil |
683e84e |
return Editline::InstanceFor(editline)->GetCharacter(c);
|
|
Jan Kratochvil |
683e84e |
}));
|
|
Jan Kratochvil |
683e84e |
|
|
Jan Kratochvil |
683e84e |
@@ -1360,12 +1360,12 @@ void Editline::PrintAsync(Stream *stream, const char *s, size_t len) {
|
|
Jan Kratochvil |
683e84e |
}
|
|
Jan Kratochvil |
683e84e |
}
|
|
Jan Kratochvil |
683e84e |
|
|
Jan Kratochvil |
683e84e |
-bool Editline::CompleteCharacter(char ch, EditLineCharType &out) {
|
|
Jan Kratochvil |
683e84e |
+bool Editline::CompleteCharacter(char ch, EditLineGetCharType &out) {
|
|
Jan Kratochvil |
683e84e |
#if !LLDB_EDITLINE_USE_WCHAR
|
|
Jan Kratochvil |
683e84e |
if (ch == (char)EOF)
|
|
Jan Kratochvil |
683e84e |
return false;
|
|
Jan Kratochvil |
683e84e |
|
|
Jan Kratochvil |
683e84e |
- out = ch;
|
|
Jan Kratochvil |
683e84e |
+ out = (unsigned char)ch;
|
|
Jan Kratochvil |
683e84e |
return true;
|
|
Jan Kratochvil |
683e84e |
#else
|
|
Jan Kratochvil |
683e84e |
std::codecvt_utf8<wchar_t> cvt;
|