aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2011-07-30 19:02:51 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2011-07-30 19:02:51 -0400
commitf34ffdf83c66991efc42b04bb312af0a787d201e (patch)
tree7888793f826bbfd5611f47176816412454d719ac /modules
parent36675f10b0cefaee7e9451b3eec3dfd715888625 (diff)
downloadtextadept-f34ffdf83c66991efc42b04bb312af0a787d201e.tar.gz
textadept-f34ffdf83c66991efc42b04bb312af0a787d201e.zip
Code cleanup.
Diffstat (limited to 'modules')
-rw-r--r--modules/textadept/keys.lua15
-rw-r--r--modules/textadept/menu.lua10
2 files changed, 13 insertions, 12 deletions
diff --git a/modules/textadept/keys.lua b/modules/textadept/keys.lua
index 8aeffbd2..a29d79d9 100644
--- a/modules/textadept/keys.lua
+++ b/modules/textadept/keys.lua
@@ -16,7 +16,7 @@ local c, OSX = _SCINTILLA.constants, OSX
-- Utility functions.
utils = {
enclose_as_xml_tags = function()
- enclose('<', '>')
+ m_editing.enclose('<', '>')
local buffer = buffer
local pos = buffer.current_pos
while buffer.char_at[pos - 1] ~= 60 do pos = pos - 1 end -- '<'
@@ -94,6 +94,7 @@ local function constantize_menu_buffer_functions()
for _, f in ipairs(menu_buffer_functions) do buffer[f] = buffer[f] end
end
events.connect(events.BUFFER_NEW, constantize_menu_buffer_functions)
+-- Scintilla's first buffer doesn't have this.
if not RESETTING then constantize_menu_buffer_functions() end
--[[
@@ -190,9 +191,9 @@ keys[not OSX and 'csdown' or 'msdown'] = _buffer.move_selected_lines_down
-- Search.
keys.cf = gui.find.focus
keys.cg = gui.find.find_next
-if not OSX then keys.f3 = gui.find.find_next end
+if not OSX then keys.f3 = keys.cg end
keys.cG = gui.find.find_prev
-if not OSX then keys.sf3 = gui.find.find_prev end
+if not OSX then keys.sf3 = keys.cG end
keys.cr = gui.find.replace
keys.cR = gui.find.replace_all
keys.caf = gui.find.find_incremental
@@ -229,9 +230,7 @@ keys.ci = utils.show_style
-- Buffer.
keys[not OSX and 'c\t' or 'm`'] = { _view.goto_buffer, _view, 1, false }
-if not OSX then keys.cpgdn = keys['c\t'] end
keys[not OSX and 'cs\t' or 'm~'] = { _view.goto_buffer, _view, -1, false }
-if not OSX then keys.cpgup = keys['cs\t'] end
keys.cb = gui.switch_buffer
-- Indentation.
-- TODO: { utils.set_indentation, 2 }
@@ -267,9 +266,11 @@ keys[not OSX and 'ca-' or 'm-'] = { utils.shrink, 10 }
keys[not OSX and 'ca\n' or 'm\n'] = { utils.toggle_property, 'view_eol' }
if not OSX then keys['ca\n\r'] = keys['ca\n'] end
keys[not OSX and 'ca\\' or 'm\\'] = { utils.toggle_property, 'wrap_mode' }
-keys[not OSX and 'caI' or 'mI'] = { utils.toggle_property, 'indentation_guides' }
+keys[not OSX and 'caI' or 'mI'] =
+ { utils.toggle_property, 'indentation_guides' }
keys[not OSX and 'ca ' or 'm '] = { utils.toggle_property, 'view_ws' }
-keys[not OSX and 'caV' or 'mV'] = { utils.toggle_property, 'virtual_space_options', c.SCVS_USERACCESSIBLE }
+keys[not OSX and 'caV' or 'mV'] =
+ { utils.toggle_property, 'virtual_space_options', c.SCVS_USERACCESSIBLE }
keys['c='] = _buffer.zoom_in
keys['c-'] = _buffer.zoom_out
keys.c0 = utils.reset_zoom
diff --git a/modules/textadept/menu.lua b/modules/textadept/menu.lua
index efe18e1f..541f18a6 100644
--- a/modules/textadept/menu.lua
+++ b/modules/textadept/menu.lua
@@ -13,7 +13,7 @@ module('_m.textadept.menu', package.seeall)
local _buffer, _view = buffer, view
local m_textadept, m_editing = _m.textadept, _m.textadept.editing
local c, SEPARATOR = _SCINTILLA.constants, { 'separator' }
-local utils = _m.textadept.keys.utils
+local utils = m_textadept.keys.utils
-- Get a string uniquely identifying a key command.
-- This is used to match menu items with key commands to show the key shortcut.
@@ -209,8 +209,9 @@ menubar = {
{ utils.open_webpage, _HOME..'/doc/manual/1_Introduction.html' } },
{ L('Show LuaDoc'), { utils.open_webpage, _HOME..'/doc/index.html' } },
SEPARATOR,
- { L('gtk-about'), { gui.dialog, 'ok-msgbox', '--title', 'Textadept',
- '--informative-text', _RELEASE, '--no-cancel' } },
+ { L('gtk-about'),
+ { gui.dialog, 'ok-msgbox', '--title', 'Textadept', '--informative-text',
+ _RELEASE, '--no-cancel' } },
},
}
@@ -245,8 +246,7 @@ local function read_menu_table(menu)
if menuitem.title then
gtkmenu[#gtkmenu + 1] = read_menu_table(menuitem)
else
- local label, f = menuitem[1], menuitem[2]
- local menu_id = #menu_actions + 1
+ local label, f, menu_id = menuitem[1], menuitem[2], #menu_actions + 1
local key, mods = keys.get_gdk_key(key_shortcuts[get_id(f)])
gtkmenu[#gtkmenu + 1] = { label, menu_id, key, mods }
if f then menu_actions[menu_id] = f end