Posted by
| Nick Gammon
Australia (23,068 posts) Bio
Forum Administrator |
Message
| In the middle of the plugin, try changing:
-- display one line
function Display_Line (line, styles, backfill)
local left = TEXT_INSET
if (backfill) then
WindowRectOp(Win, miniwin.rect_fill, 1, theme.TITLE_HEIGHT+(line*line_height)+1, WINDOW_WIDTH-SCROLL_BAR_WIDTH, theme.TITLE_HEIGHT+(line*line_height)+line_height+1, ColourNameToRGB("#333333"))
end -- backfill
if (styles) then
for _, v in ipairs (styles) do
left = left + WindowText (Win, "bodyfont"..Win, v.text, left, theme.TITLE_HEIGHT+(line*line_height), 0, 0, v.textcolour)
end -- for each style run
end -- if
Redraw()
end -- function Display_Line
to:
-- display one line
function Display_Line (line, styles)
local left = TEXT_INSET
local top = theme.TITLE_HEIGHT + (line * line_height) + 1
local bottom = top + line_height
local font = "bodyfont" .. Win
if backfill then
WindowRectOp (Win, miniwin.rect_fill, 1, top, WINDOW_WIDTH - SCROLL_BAR_WIDTH, bottom, ColourNameToRGB("#333333"))
end -- backfill
if styles then
for _, style in ipairs (styles) do
local width = WindowTextWidth (Win, font, style.text) -- get width of text
local right = left + width
WindowRectOp (Win, miniwin.rect_fill, left, top, right, bottom, style.backcolour) -- draw background
WindowText (Win, font, style.text, left, top, 0, 0, style.textcolour) -- draw text
left = left + width -- advance horizontally
end -- for each style run
end -- if styles
Redraw()
end -- Display_Line
As for the timestamp colour, try changing:
-- inject timestamp if wanted
if timestamp then
tstamp = os.date (date_format)
styles[1].text = tstamp..styles[1].text
styles[1].length = styles[1].length+string.len(tstamp)
end -- if
to:
-- inject timestamp if wanted
if timestamp then
local tstamp = os.date (date_format)
table.insert (styles, 1, {
text = tstamp,
textcolour = ColourNameToRGB ("white"),
backcolour = ColourNameToRGB ("black"),
length = string.len (tstamp),
style = 0,
} )
end -- if
This adds a new style at the start of the line with the timestamp in whatever colours you specify. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|