diff options
author | mitchell <70453897+667e-11@users.noreply.github.com> | 2020-07-04 23:22:03 -0400 |
---|---|---|
committer | mitchell <70453897+667e-11@users.noreply.github.com> | 2020-07-04 23:22:03 -0400 |
commit | 021866de868fd074526fc63270639ec2f3ce9aa5 (patch) | |
tree | e86d22cad0ba6d50f5db7c6768728ecf46a188e8 /core/init.lua | |
parent | 9835ab92e265f4c83634f1bec49b4592e2deda8c (diff) |
Added `buffer:style_of_name()` as an analogue to `buffer:name_of_style()`.
Diffstat (limited to 'core/init.lua')
-rw-r--r-- | core/init.lua | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/core/init.lua b/core/init.lua index 1768b1e2..07c9e060 100644 --- a/core/init.lua +++ b/core/init.lua @@ -54,7 +54,17 @@ local function text_range(buffer, start_pos, end_pos) buffer:set_target_range(target_start, target_end) -- restore return text end -events.connect(events.BUFFER_NEW, function() buffer.text_range = text_range end) + +-- Documentation is in core/.buffer.luadoc. +local function style_of_name(buffer, style_name) + assert_type(style_name, 'string', 2) + local GETNAMEDSTYLE = _SCINTILLA.properties.named_styles[1] + return buffer:private_lexer_call(GETNAMEDSTYLE, style_name) +end + +events.connect(events.BUFFER_NEW, function() + buffer.text_range, buffer.style_of_name = text_range, style_of_name +end) --[[ This comment is for LuaDoc. --- |