aboutsummaryrefslogtreecommitdiff
path: root/modules/textadept/mime_types.lua
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2010-08-17 00:28:31 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2010-08-17 00:28:31 -0400
commit3d4c3dc0cba751e6a765ea33f6780f8d1a3fca21 (patch)
treef86a91034ba90fe049cf4b73dac7c4883383d320 /modules/textadept/mime_types.lua
parent63bc0f15b6f475b53e86e31e88119781c560ba77 (diff)
downloadtextadept-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.lua30
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.