aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2020-10-31 15:56:23 +0100
committerPřemysl Eric Janouch <p@janouch.name>2020-10-31 16:05:15 +0100
commit271689da99d4f83a0281a3d91ed32300c1da7ce1 (patch)
treee0dc74d5c554ee0767188f4d212c213373372cd1
parent38c23d0d38f74e82f96c4e385395a31e651b0f5f (diff)
downloadxK-271689da99d4f83a0281a3d91ed32300c1da7ce1.tar.gz
xK-271689da99d4f83a0281a3d91ed32300c1da7ce1.tar.xz
xK-271689da99d4f83a0281a3d91ed32300c1da7ce1.zip
fancy-prompt.lua: allow non-ASCII buffer names
It may theoretically bite us in the ass with non-UTF-8-compliant IRC servers, and certainly with double-width characters.
-rw-r--r--plugins/degesch/fancy-prompt.lua9
1 files changed, 5 insertions, 4 deletions
diff --git a/plugins/degesch/fancy-prompt.lua b/plugins/degesch/fancy-prompt.lua
index 300801e..93fe67c 100644
--- a/plugins/degesch/fancy-prompt.lua
+++ b/plugins/degesch/fancy-prompt.lua
@@ -64,12 +64,13 @@ 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]", "?")
+ -- Readline 7.0.003 seems to be broken and completely corrupts the prompt.
+ -- However 8.0.004 seems to be fine with these, as is libedit 20191231-3.1.
+ --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.
+ -- FIXME: this doesn't count with full-width or zero-width characters.
+ -- We might want to export wcwidth() above term_from_utf8 somehow.
local overflow = utf8.offset (x, cols - 1)
if overflow then x = x:sub (1, overflow) end
x = "\x01\x1b[0;4;1;38;5;16m\x1b[48;5;" .. bg_color .. "m\x02" ..