Page MenuHomeFreeBSD
Paste P645

Teach libedit how to parse ^[
ActivePublic

Authored by pstef on Aug 19 2024, 10:19 PM.
Tags
None
Referenced Files
F91618846: Teach libedit how to parse ^[
Aug 19 2024, 10:24 PM
F91618527: Teach libedit how to parse ^[
Aug 19 2024, 10:19 PM
Subscribers
diff --git a/contrib/libedit/parse.c b/contrib/libedit/parse.c
index 2620f41eb1c..3bfea8126bf 100644
--- a/contrib/libedit/parse.c
+++ b/contrib/libedit/parse.c
@@ -228,7 +228,17 @@ parse__escape(const wchar_t **ptr)
}
} else if (*p == '^') {
p++;
- c = (*p == '?') ? '\177' : (*p & 0237);
+ switch (*p) {
+ case '?':
+ c = '\177';
+ break;
+ case '[':
+ c = '\033';
+ break;
+ default:
+ c = *p & 0237;
+ break;
+ }
} else
c = *p;
*ptr = ++p;

Event Timeline

pstef created this object in space S1 Global.
pstef created this object with edit policy "Administrators".