Last active
October 10, 2015 16:17
-
-
Save rgieseke/3717070 to your computer and use it in GitHub Desktop.
Textadept: highlight active buffer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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