fancy-prompt.lua: workaround a Readline UTF-8 bug

This commit is contained in:
Přemysl Eric Janouch 2018-06-22 00:55:17 +02:00
parent 300f9a9708
commit 94b0ec80cf
Signed by: p
GPG Key ID: B715679E3A361BE6

View File

@ -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)