Re: [code] [textadept] 2 Questions

From: Jay Young <jyng7.att.hotmail.com>
Date: Thu, 20 Aug 2015 02:34:37 +0000

Thanks again Robert. I added your code to the init.lua file and
made a few changes after researching the API. I use the
'bespin' theme, and have the line numbers themselves change
to the indic_highlight color. I noticed when Textadept is first launched
the line numbers aren't changed in any buffer, so I added an
'active()' in the function itself which seems to work. I'm assuming
that's ok?

-- Highlight the active buffer/view.
events.connect(events.INITIALIZED, function()
    local line_number_fore =
        buffer.style_fore[_SCINTILLA.constants.STYLE_LINENUMBER]
    local highlight_fore =
        buffer.indic_fore[textadept.editing.INDIC_HIGHLIGHT]

    local function active()
        local buffer = buffer
        buffer.style_fore[33] = highlight_fore
    end

    local function inactive()
        local buffer = buffer
        buffer.style_fore[33] = line_number_fore
    end

    active()

    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_NEW, function() active() end)
    events.connect(events.FILE_OPENED, function() active() end)
    events.connect(events.RESET_AFTER, function() active() end)
end)

-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Wed 19 Aug 2015 - 22:34:37 EDT

This archive was generated by hypermail 2.2.0 : Thu 20 Aug 2015 - 06:50:40 EDT