Browse Source

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

tags/v0.9.6
Přemysl Janouch 1 year ago
parent
commit
94b0ec80cf
No known key found for this signature in database
1 changed files with 4 additions and 0 deletions
  1. 4
    0
      plugins/degesch/fancy-prompt.lua

+ 4
- 0
plugins/degesch/fancy-prompt.lua 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)

Loading…
Cancel
Save