Skip to content

Instantly share code, notes, and snippets.

@rgieseke
Last active October 10, 2015 16:17
Show Gist options
  • Save rgieseke/3717070 to your computer and use it in GitHub Desktop.
Save rgieseke/3717070 to your computer and use it in GitHub Desktop.
Textadept: highlight active buffer
local line_number_back = buffer.style_back[33]
local current_line_back = buffer.caret_line_back
local function active()
local buffer = buffer
buffer.style_back[33] = current_line_back
buffer.set_fold_margin_colour(1, current_line_back)
buffer:set_fold_margin_hi_colour(1, current_line_back)
end
local function inactive()
local buffer = buffer
buffer.style_back[33] = line_number_back
buffer.set_fold_margin_colour(1, line_number_back)
buffer:set_fold_margin_hi_colour(1, line_number_back)
end
events.connect(events.VIEW_BEFORE_SWITCH, function() inactive() end)
events.connect(events.VIEW_AFTER_SWITCH, function() active() end)
events.connect(events.BUFFER_AFTER_SWITCH, function() active() end)
events.connect(events.BUFFER_AFTER_SWITCH, function()
local buffer = buffer
if buffer._textui then
buffer.style_fore[33] = current_line_back
buffer.set_fold_margin_colour(1, line_number_back)
buffer:set_fold_margin_hi_colour(1, line_number_back)
end
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment