diff options
Diffstat (limited to 'modules/textadept')
-rw-r--r-- | modules/textadept/command_entry.lua | 2 | ||||
-rw-r--r-- | modules/textadept/editing.lua | 8 | ||||
-rw-r--r-- | modules/textadept/file_types.lua | 2 | ||||
-rw-r--r-- | modules/textadept/find.lua | 8 | ||||
-rw-r--r-- | modules/textadept/keys.lua | 6 | ||||
-rw-r--r-- | modules/textadept/menu.lua | 30 | ||||
-rw-r--r-- | modules/textadept/session.lua | 4 | ||||
-rw-r--r-- | modules/textadept/snippets.lua | 4 |
8 files changed, 31 insertions, 33 deletions
diff --git a/modules/textadept/command_entry.lua b/modules/textadept/command_entry.lua index 29bea5b0..001dfa14 100644 --- a/modules/textadept/command_entry.lua +++ b/modules/textadept/command_entry.lua @@ -105,7 +105,7 @@ local function run_lua(code) end table.sort(items) result = string.format('{%s}', table.concat(items, ', ')) - if buffer.edge_column > 0 and #result > buffer.edge_column then + if view.edge_column > 0 and #result > view.edge_column then local indent = string.rep(' ', buffer.tab_width) result = string.format( '{\n%s%s\n}', indent, table.concat(items, ',\n' .. indent)) 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( diff --git a/modules/textadept/file_types.lua b/modules/textadept/file_types.lua index 2889734c..34ae1dae 100644 --- a/modules/textadept/file_types.lua +++ b/modules/textadept/file_types.lua @@ -70,7 +70,7 @@ local function set_lexer(buffer, lang) buffer._lexer = lang if package.searchpath(lang, package.path) then _M[lang] = require(lang) end if buffer ~= ui.command_entry then events.emit(events.LEXER_LOADED, lang) end - local last_line = buffer.first_visible_line + buffer.lines_on_screen + local last_line = view.first_visible_line + view.lines_on_screen buffer:colourise(1, buffer:position_from_line(last_line + 1)) -- refresh end diff --git a/modules/textadept/find.lua b/modules/textadept/find.lua index d15558fb..e98b1403 100644 --- a/modules/textadept/find.lua +++ b/modules/textadept/find.lua @@ -122,7 +122,7 @@ local function find(text, next, flags, no_wrap, wrapped) if text == '' then return end if not flags then flags = get_flags() end if flags >= 1 << 31 then M.find_in_files() return end -- not performed here - local first_visible_line = buffer.first_visible_line -- for 'no results found' + local first_visible_line = view.first_visible_line -- for 'no results found' -- If text is selected, assume it is from the current search and move the -- caret appropriately for the next search. @@ -132,8 +132,8 @@ local function find(text, next, flags, no_wrap, wrapped) buffer:search_anchor() local f = next and buffer.search_next or buffer.search_prev local pos = f(buffer, flags, text) - buffer:ensure_visible_enforce_policy(buffer:line_from_position(pos)) - buffer:scroll_range(buffer.anchor, buffer.current_pos) + view:ensure_visible_enforce_policy(buffer:line_from_position(pos)) + view:scroll_range(buffer.anchor, buffer.current_pos) find_text, found_text = text, buffer:get_sel_text() -- track for "replace all" -- If nothing was found, wrap the search. @@ -144,7 +144,7 @@ local function find(text, next, flags, no_wrap, wrapped) pos = find(text, next, flags, true, true) if pos == -1 then ui.statusbar_text = _L['No results found'] - buffer:line_scroll(0, first_visible_line - buffer.first_visible_line) + view:line_scroll(0, first_visible_line - view.first_visible_line) buffer:goto_pos(anchor) end elseif not wrapped then diff --git a/modules/textadept/keys.lua b/modules/textadept/keys.lua index a72899ca..212f85ea 100644 --- a/modules/textadept/keys.lua +++ b/modules/textadept/keys.lua @@ -486,8 +486,8 @@ if GUI then keys[not OSX and 'caI' or 'cI'] = m_view[_L['Toggle Show Indent Guides']][2] keys[not OSX and 'caV' or 'cV'] = m_view[_L['Toggle Virtual Space']][2] end -keys[not OSX and GUI and 'c=' or 'm='] = buffer.zoom_in -keys[not OSX and GUI and 'c-' or 'm-'] = buffer.zoom_out +keys[not OSX and GUI and 'c=' or 'm='] = view.zoom_in +keys[not OSX and GUI and 'c-' or 'm-'] = view.zoom_out keys[not OSX and GUI and 'c0' or 'm0'] = m_view[_L['Reset Zoom']][2] -- Help. @@ -512,7 +512,7 @@ if OSX then buffer:line_end_extend() if not buffer.selection_empty then buffer:cut() else buffer:clear() end end - keys.cl = buffer.vertical_centre_caret + keys.cl = view.vertical_centre_caret -- GTK-OSX reports Fn-key as a single keycode which confuses Scintilla. Do -- not propagate it. keys.fn = function() return true end diff --git a/modules/textadept/menu.lua b/modules/textadept/menu.lua index a92c2498..c998ade6 100644 --- a/modules/textadept/menu.lua +++ b/modules/textadept/menu.lua @@ -292,17 +292,15 @@ local default_menubar = { {_L['UTF-16 Encoding'], function() set_encoding('UTF-16LE') end} }, SEPARATOR, - {_L['Toggle View EOL'], function() - buffer.view_eol = not buffer.view_eol - end}, + {_L['Toggle View EOL'], function() view.view_eol = not view.view_eol end}, {_L['Toggle Wrap Mode'], function() - local first_visible_line = buffer.first_visible_line - local display_line = buffer:visible_from_doc_line(first_visible_line) - buffer.wrap_mode = buffer.wrap_mode == 0 and buffer.WRAP_WHITESPACE or 0 - buffer:line_scroll(0, first_visible_line - display_line) + local first_visible_line = view.first_visible_line + local display_line = view:visible_from_doc_line(first_visible_line) + view.wrap_mode = view.wrap_mode == 0 and view.WRAP_WHITESPACE or 0 + view:line_scroll(0, first_visible_line - display_line) end}, {_L['Toggle View Whitespace'], function() - buffer.view_ws = buffer.view_ws == 0 and buffer.WS_VISIBLEALWAYS or 0 + view.view_ws = view.view_ws == 0 and view.WS_VISIBLEALWAYS or 0 end}, SEPARATOR, {_L['Select Lexer...'], textadept.file_types.select_lexer}, @@ -318,28 +316,28 @@ local default_menubar = { {_L['Unsplit View'], function() view:unsplit() end}, {_L['Unsplit All Views'], function() while view:unsplit() do end end}, {_L['Grow View'], function() - if view.size then view.size = view.size + buffer:text_height(1) end + if view.size then view.size = view.size + view:text_height(1) end end}, {_L['Shrink View'], function() - if view.size then view.size = view.size - buffer:text_height(1) end + if view.size then view.size = view.size - view:text_height(1) end end}, SEPARATOR, {_L['Toggle Current Fold'], function() - buffer:toggle_fold(buffer:line_from_position(buffer.current_pos)) + view:toggle_fold(buffer:line_from_position(buffer.current_pos)) end}, SEPARATOR, {_L['Toggle Show Indent Guides'], function() - local off = buffer.indentation_guides == 0 - buffer.indentation_guides = off and buffer.IV_LOOKBOTH or 0 + local off = view.indentation_guides == 0 + view.indentation_guides = off and view.IV_LOOKBOTH or 0 end}, {_L['Toggle Virtual Space'], function() local off = buffer.virtual_space_options == 0 buffer.virtual_space_options = off and buffer.VS_USERACCESSIBLE or 0 end}, SEPARATOR, - {_L['Zoom In'], buffer.zoom_in}, - {_L['Zoom Out'], buffer.zoom_out}, - {_L['Reset Zoom'], function() buffer.zoom = 0 end} + {_L['Zoom In'], view.zoom_in}, + {_L['Zoom Out'], view.zoom_out}, + {_L['Reset Zoom'], function() view.zoom = 0 end} }, { title = _L['Help'], diff --git a/modules/textadept/session.lua b/modules/textadept/session.lua index b446ca54..43bb9e08 100644 --- a/modules/textadept/session.lua +++ b/modules/textadept/session.lua @@ -62,7 +62,7 @@ function M.load(filename) if lfs.attributes(buf.filename) then io.open_file(buf.filename) buffer:set_sel(buf.anchor, buf.current_pos) - buffer:line_scroll(0, buf.top_line - buffer.first_visible_line) + view:line_scroll(0, buf.top_line - view.first_visible_line) for _, line in ipairs(buf.bookmarks) do buffer:marker_add(line, textadept.bookmarks.MARK_BOOKMARK) end @@ -165,7 +165,7 @@ function M.save(filename) filename = buffer.filename or buffer._type, anchor = current and buffer.anchor or buffer._anchor, current_pos = current and buffer.current_pos or buffer._current_pos, - top_line = current and buffer.first_visible_line or buffer._top_line, + top_line = current and view.first_visible_line or buffer._top_line, } local bookmarks = {} local BOOKMARK_BIT = 1 << textadept.bookmarks.MARK_BOOKMARK - 1 diff --git a/modules/textadept/snippets.lua b/modules/textadept/snippets.lua index 707ab7ca..73f46bde 100644 --- a/modules/textadept/snippets.lua +++ b/modules/textadept/snippets.lua @@ -653,8 +653,8 @@ events.connect(events.UPDATE_UI, function(updated) end) events.connect(events.VIEW_NEW, function() - buffer.indic_style[INDIC_SNIPPET] = buffer.INDIC_HIDDEN - buffer.indic_style[INDIC_CURRENTPLACEHOLDER] = buffer.INDIC_HIDDEN + view.indic_style[INDIC_SNIPPET] = view.INDIC_HIDDEN + view.indic_style[INDIC_CURRENTPLACEHOLDER] = view.INDIC_HIDDEN end) -- Returns for the word behind the caret a list of snippet trigger word |