diff --git a/contrib/libedit/parse.c b/contrib/libedit/parse.c
index 2620f41eb1c..f4ea7c9c28b 100644
--- a/contrib/libedit/parse.c
+++ b/contrib/libedit/parse.c
@@ -228,7 +228,16 @@ 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;
+ }
} else
c = *p;
*ptr = ++p;