From 94b0ec80cfa4e101aa81b3e75831cd5f468bcded Mon Sep 17 00:00:00 2001 From: Přemysl Janouch Date: Fri, 22 Jun 2018 00:55:17 +0200 Subject: fancy-prompt.lua: workaround a Readline UTF-8 bug --- plugins/degesch/fancy-prompt.lua | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'plugins/degesch') 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) -- cgit v1.2.3-70-g09d2