diff options
author | 2010-08-17 00:28:31 -0400 | |
---|---|---|
committer | 2010-08-17 00:28:31 -0400 | |
commit | 3d4c3dc0cba751e6a765ea33f6780f8d1a3fca21 (patch) | |
tree | f86a91034ba90fe049cf4b73dac7c4883383d320 /modules/textadept/mime_types.lua | |
parent | 63bc0f15b6f475b53e86e31e88119781c560ba77 (diff) | |
download | textadept-3d4c3dc0cba751e6a765ea33f6780f8d1a3fca21.tar.gz textadept-3d4c3dc0cba751e6a765ea33f6780f8d1a3fca21.zip |
Upgraded to Scintilla/SciTE 2.20.
Diffstat (limited to 'modules/textadept/mime_types.lua')
-rw-r--r-- | modules/textadept/mime_types.lua | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/modules/textadept/mime_types.lua b/modules/textadept/mime_types.lua index 8f03adcd..70aa51fe 100644 --- a/modules/textadept/mime_types.lua +++ b/modules/textadept/mime_types.lua @@ -204,9 +204,33 @@ local function set_lexer(buffer, lang) end buffer:colourise(0, -1) end -events.connect('buffer_new', function() buffer.set_lexer = set_lexer end) --- Scintilla's first buffer doesn't have this -if not RESETTING then buffer.set_lexer = set_lexer end + +-- +-- Replacement for buffer:get_lexer_language(). +-- @param buffer The buffer to get the lexer langugae of. +local function get_lexer(buffer) + return buffer:private_lexer_call(-1) +end + +-- +-- Returns the name of the style associated with a style number. +-- @param buffer The buffer to get the style name of. +-- @param style_num A style number in the range 0 <= style_num < 256. +-- @see buffer.style_at +local function get_style_name(buffer, style_num) + if style_num < 0 or style_num > 255 then error('0 <= style_num < 256') end + return buffer:private_lexer_call(style_num) +end + +events.connect('buffer_new', function() + buffer.set_lexer, buffer.get_lexer = set_lexer, get_lexer + buffer.get_style_name = get_style_name +end) +-- Scintilla's first buffer doesn't have these +if not RESETTING then + buffer.set_lexer, buffer.get_lexer = set_lexer, get_lexer + buffer.get_style_name = get_style_name +end -- Performs actions suitable for a new buffer. -- Sets the buffer's lexer language and loads the language module. |