fancy-prompt.lua: change background on highlight

This commit is contained in:
Přemysl Eric Janouch 2016-12-02 12:27:33 +01:00
parent e2bb051bd3
commit b666ce6926
Signed by: p
GPG Key ID: B715679E3A361BE6
1 changed files with 7 additions and 3 deletions

View File

@ -34,6 +34,7 @@ local prompt = degesch.hook_prompt (function (hook)
local chan = current.channel local chan = current.channel
local s = current.server local s = current.server
local bg_color = "255"
local current_n = 0 local current_n = 0
local active = "" local active = ""
for i, buffer in ipairs (degesch.buffers) do for i, buffer in ipairs (degesch.buffers) do
@ -41,7 +42,10 @@ local prompt = degesch.hook_prompt (function (hook)
current_n = i current_n = i
elseif buffer.new_messages_count ~= buffer.new_unimportant_count then elseif buffer.new_messages_count ~= buffer.new_unimportant_count then
if active ~= "" then active = active .. "," end if active ~= "" then active = active .. "," end
if buffer.highlighted then active = active .. "!" end if buffer.highlighted then
active = active .. "!"
bg_color = "224"
end
active = active .. i active = active .. i
end end
end end
@ -65,8 +69,8 @@ local prompt = degesch.hook_prompt (function (hook)
-- Note that this doesn't count with full-width or zero-width characters. -- Note that this doesn't count with full-width or zero-width characters.
local overflow = utf8.offset (x, cols - 1) local overflow = utf8.offset (x, cols - 1)
if overflow then x = x:sub (1, overflow) end if overflow then x = x:sub (1, overflow) end
x = "\x01\x1b[0;4;1;38;5;16m\x1b[48;5;255m\x02" .. x = "\x01\x1b[0;4;1;38;5;16m\x1b[48;5;" .. bg_color .. "m\x02" ..
x .. "\x01\x1b[0;4;1;7;38;5;255m\x02 \x01\x1b[0;1m\x02" x .. "\x01\x1b[0;4;1;7;38;5;" .. bg_color .. "m\x02 \x01\x1b[0;1m\x02"
local user_prefix = function (chan, user) local user_prefix = function (chan, user)
for i, chan_user in ipairs (chan.users) do for i, chan_user in ipairs (chan.users) do