aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2011-03-14 17:31:10 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2011-03-14 17:31:10 -0400
commit76d1961e1f9e0d081eac3ed4130a2d0080d538ca (patch)
treefa8475de9c8f9ab879fe1ace1058b5f5e693cd3f /modules
parent2449043c3712fb90782473c7c32afbc534553777 (diff)
downloadtextadept-76d1961e1f9e0d081eac3ed4130a2d0080d538ca.tar.gz
textadept-76d1961e1f9e0d081eac3ed4130a2d0080d538ca.zip
get_lexer(true) returns the lexer at the caret; modules/textadept/mime_types.lua
Diffstat (limited to 'modules')
-rw-r--r--modules/textadept/mime_types.lua9
1 files changed, 4 insertions, 5 deletions
diff --git a/modules/textadept/mime_types.lua b/modules/textadept/mime_types.lua
index 1f8d59b9..f642e3ed 100644
--- a/modules/textadept/mime_types.lua
+++ b/modules/textadept/mime_types.lua
@@ -157,15 +157,14 @@ end
local GETLEXERLANGUAGE = _SCINTILLA.functions.get_lexer_language[1]
--
-- Replacement for buffer:get_lexer_language().
--- Returns the lexer at the current caret position. This lexer can be different
--- from the lexer passed to buffer:set_lexer().
-- @param buffer The buffer to get the lexer language of.
--- @param parent If true, returns the lexer passed to buffer:set_lexer().
+-- @param current If true, returns the lexer at the current caret position. This
+-- lexer can be different from the lexer passed to buffer:set_lexer().
-- Defaults to false.
-local function get_lexer(buffer, parent)
+local function get_lexer(buffer, current)
gui.check_focused_buffer(buffer)
local lexer = buffer:private_lexer_call(GETLEXERLANGUAGE)
- if parent then return lexer end
+ if not current then return lexer end
local i, ws, style_at = buffer.current_pos, ws_styles[lexer], buffer.style_at
while i > 0 and not ws[style_at[i]] do i = i - 1 end
return get_style_name(buffer, style_at[i]):match('^(.+)_whitespace$') or lexer