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