aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/.buffer.luadoc9
-rw-r--r--core/init.lua12
2 files changed, 20 insertions, 1 deletions
diff --git a/core/.buffer.luadoc b/core/.buffer.luadoc
index 810075fd..175e1098 100644
--- a/core/.buffer.luadoc
+++ b/core/.buffer.luadoc
@@ -1783,6 +1783,15 @@ function new() end
function text_range(buffer, start_pos, end_pos) end
---
+-- Returns the style number associated with string *style_name*, or
+-- `view.STYLE_DEFAULT` if *style_name* is not in use.
+-- @param buffer A buffer.
+-- @param string The style name to get the number of.
+-- @return style number, between `1` and `256`.
+-- @see name_of_style
+function style_of_name(buffer, style_name) end
+
+---
-- Reloads the buffer's file contents, discarding any changes.
-- @param buffer A buffer.
-- @name reload
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.
---