From f7be510d2669646c60845b091087362d51ae29ea Mon Sep 17 00:00:00 2001 From: Přemysl Eric Janouch
Date: Sat, 27 Aug 2022 08:55:44 +0200 Subject: xC: make fancy-prompt.lua alignment more reliable And generally clean up that script. --- plugins/xC/fancy-prompt.lua | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) (limited to 'plugins/xC') diff --git a/plugins/xC/fancy-prompt.lua b/plugins/xC/fancy-prompt.lua index 8ec697a..0b7000c 100644 --- a/plugins/xC/fancy-prompt.lua +++ b/plugins/xC/fancy-prompt.lua @@ -1,7 +1,7 @@ -- -- fancy-prompt.lua: the fancy multiline prompt you probably want -- --- Copyright (c) 2016, Přemysl Eric Janouch
+-- Copyright (c) 2016 - 2022, Přemysl Eric Janouch
--
-- Permission to use, copy, modify, and/or distribute this software for any
-- purpose with or without fee is hereby granted.
@@ -40,7 +40,7 @@ xC.hook_prompt (function (hook)
if buffer == current then
current_n = i
elseif buffer.new_messages_count ~= buffer.new_unimportant_count then
- if active ~= "" then active = active .. "," end
+ active = active .. ","
if buffer.highlighted then
active = active .. "!"
bg_color = "224"
@@ -48,7 +48,6 @@ xC.hook_prompt (function (hook)
active = active .. i
end
end
- if active ~= "" then active = "(" .. active .. ")" end
local x = current_n .. ":" .. current.name
if chan and chan.users_len ~= 0 then
local params = ""
@@ -56,25 +55,34 @@ xC.hook_prompt (function (hook)
params = params .. " +" .. mode .. " " .. param
end
local modes = chan.no_param_modes .. params:sub (3)
- if modes ~= "" then x = x .. "(+" .. modes .. ")" end
+ if modes ~= "" then
+ x = x .. "(+" .. modes .. ")"
+ end
x = x .. "{" .. chan.users_len .. "}"
end
- if current.hide_unimportant then x = x .. "