aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorPřemysl Janouch <p@janouch.name>2018-06-22 00:55:17 +0200
committerPřemysl Janouch <p@janouch.name>2018-06-22 00:55:17 +0200
commit94b0ec80cfa4e101aa81b3e75831cd5f468bcded (patch)
treeba344932634177122032f0a6e82e1e3e73e2cac7 /plugins
parent300f9a970855f4ad41892badc358cd9f1b6623a6 (diff)
downloadxK-94b0ec80cfa4e101aa81b3e75831cd5f468bcded.tar.gz
xK-94b0ec80cfa4e101aa81b3e75831cd5f468bcded.tar.xz
xK-94b0ec80cfa4e101aa81b3e75831cd5f468bcded.zip
fancy-prompt.lua: workaround a Readline UTF-8 bug
Diffstat (limited to 'plugins')
-rw-r--r--plugins/degesch/fancy-prompt.lua4
1 files changed, 4 insertions, 0 deletions
diff --git a/plugins/degesch/fancy-prompt.lua b/plugins/degesch/fancy-prompt.lua
index ef3a167..84cbfdb 100644
--- a/plugins/degesch/fancy-prompt.lua
+++ b/plugins/degesch/fancy-prompt.lua
@@ -64,6 +64,10 @@ degesch.hook_prompt (function (hook)
local lines, cols = degesch.get_screen_size ()
x = x .. " " .. active .. string.rep (" ", cols)
+ -- Readline seems to be broken and completely corrupts the prompt
+ -- (tested on 7.0.003 Archlinux, 7.0-5 Debian buster)
+ x = x:gsub("[\128-\255]", "?")
+
-- Cut off extra characters and apply formatting, including the hack.
-- Note that this doesn't count with full-width or zero-width characters.
local overflow = utf8.offset (x, cols - 1)