aboutsummaryrefslogtreecommitdiff
path: root/modules/textadept/editing.lua
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2020-05-25 21:16:01 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2020-05-25 21:16:01 -0400
commitf2374c4aba53fa462dc88d4104e10d8cb97e61ba (patch)
tree5e5a9d26a5ad8915c0e12187dd059b1109fcf22d /modules/textadept/editing.lua
parenteffc636745e8d9c680c3acf42e8e25eed10cd903 (diff)
downloadtextadept-f2374c4aba53fa462dc88d4104e10d8cb97e61ba.tar.gz
textadept-f2374c4aba53fa462dc88d4104e10d8cb97e61ba.zip
Allow views to be used as buffers and update API.
This allows for a superficial separation of buffer- and view-specific Scintilla functionality. buffers and views can now be used interchangeably for the most part, and the APIs are guidance, not hard requirements. User scripts do not require any modification and will continue to function normally.
Diffstat (limited to 'modules/textadept/editing.lua')
-rw-r--r--modules/textadept/editing.lua8
1 files changed, 4 insertions, 4 deletions
diff --git a/modules/textadept/editing.lua b/modules/textadept/editing.lua
index 8206b93e..e7e5d9d0 100644
--- a/modules/textadept/editing.lua
+++ b/modules/textadept/editing.lua
@@ -53,7 +53,7 @@ M.XPM_IMAGES = {
}
events.connect(events.VIEW_NEW, function()
for name, i in pairs(M.XPM_IMAGES) do
- if type(name) == 'string' then buffer:register_image(i, M.XPM_IMAGES[i]) end
+ if type(name) == 'string' then view:register_image(i, M.XPM_IMAGES[i]) end
end
end)
for _ = 1, #M.XPM_IMAGES do _SCINTILLA.next_image_type() end -- sync
@@ -160,11 +160,11 @@ events.connect(events.UPDATE_UI, function(updated)
local pos = buffer.selection_n_caret[buffer.main_selection]
if M.brace_matches[buffer.char_at[pos]] then
local match = buffer:brace_match(pos, 0)
- local f = match ~= -1 and buffer.brace_highlight or buffer.brace_bad_light
+ local f = match ~= -1 and view.brace_highlight or view.brace_bad_light
f(buffer, pos, match)
return
end
- buffer:brace_bad_light(-1)
+ view:brace_bad_light(-1)
end)
-- Moves over typeover characters when typed, taking multiple selections into
@@ -364,7 +364,7 @@ function M.goto_line(line)
line = tonumber(value)
if button ~= 1 or not line then return end
end
- buffer:ensure_visible_enforce_policy(line)
+ view:ensure_visible_enforce_policy(line)
buffer:goto_line(line)
end
args.register(