aboutsummaryrefslogtreecommitdiff
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
parent36675f10b0cefaee7e9451b3eec3dfd715888625 (diff)
downloadtextadept-f34ffdf83c66991efc42b04bb312af0a787d201e.tar.gz
textadept-f34ffdf83c66991efc42b04bb312af0a787d201e.zip
Code cleanup.
-rw-r--r--doc/manual/14_Appendix.md62
-rw-r--r--modules/textadept/keys.lua15
-rw-r--r--modules/textadept/menu.lua10
3 files changed, 46 insertions, 41 deletions
diff --git a/doc/manual/14_Appendix.md b/doc/manual/14_Appendix.md
index 78e93128..e2b65bdd 100644
--- a/doc/manual/14_Appendix.md
+++ b/doc/manual/14_Appendix.md
@@ -29,7 +29,7 @@ Ctrl+A |⌘A |Select all
Ctrl+M |^M |Match brace
Ctrl+Enter |^⎋ |Complete word
Alt+Del |^⌦ |Delete word
-Ctrl+Shift+H |⌘⇧H |Highlight word
+Ctrl+Alt+Shift+H |⌘⇧H |Highlight word
Ctrl+/ |^/ |Toggle block comment
Ctrl+T |^T |Transpose characters
Ctrl+Shift+J |^J |Join lines
@@ -95,24 +95,24 @@ Ctrl+Alt+Shift+O|⌘⌥⇧O |Snapopen current directory
Ctrl+I |⌘I |Show style
**Buffer** |||
-Ctrl+Tab<br/>Ctrl+PageDown |^\` |Next buffer
-Ctrl+Shift+Tab<br/>Ctrl+PageUp|^~ |Previous buffer
-Ctrl+B |⌘B |Switch to buffer...
-None |None |Tab width: 2
-None |None |Tab width: 3
-None |None |Tab width: 4
-None |None |Tab width: 8
-Ctrl+Alt+Shift+T |^⇧T |Toggle use tabs
-Ctrl+Alt+I |^I |Convert indentation
-None |None |`CRLF` EOL mode
-None |None |`CR` EOL mode
-None |None |`LF` EOL mode
-None |None |`UTF-8` encoding
-None |None |`ASCII` encoding
-None |None |`ISO-8859-1` encoding
-None |None |`UTF-16` encoding
-Ctrl+Alt+L |⌘⌥L |Select lexer...
-F5 |F5 |Refresh syntax highlighting
+Ctrl+Tab |^\` |Next buffer
+Ctrl+Shift+Tab |^~ |Previous buffer
+Ctrl+B |⌘B |Switch to buffer...
+None |None |Tab width: 2
+None |None |Tab width: 3
+None |None |Tab width: 4
+None |None |Tab width: 8
+Ctrl+Alt+Shift+T|^⇧T |Toggle use tabs
+Ctrl+Alt+I |^I |Convert indentation
+None |None |`CRLF` EOL mode
+None |None |`CR` EOL mode
+None |None |`LF` EOL mode
+None |None |`UTF-8` encoding
+None |None |`ASCII` encoding
+None |None |`ISO-8859-1` encoding
+None |None |`UTF-16` encoding
+Ctrl+Alt+L |⌘⌥L |Select lexer...
+F5 |F5 |Refresh syntax highlighting
**View** |||
Ctrl+Alt+Tab |^⇥ |Next view
@@ -141,11 +141,11 @@ None |None|About
**Movement** |||
Down |⇣<br/>^N |Line down
Shift+Down |⇧⇣<br/>^⇧N |Line down extend selection
-Ctrl+Down |⌘↘ |Scroll line down
+Ctrl+Down |^⇣ |Scroll line down
Alt+Shift+Down |⌥⇧⇣ |Line down extend rect. selection
Up |⇡<br/>^P |Line up
Shift+Up |⇧⇡<br/>^⇧P |Line up extend selection
-Ctrl+Up |⌘↖ |Scroll line up
+Ctrl+Up |^⇡ |Scroll line up
Alt+Shift+Up |⌥⇧⇡ |Line up extend rect. selection
Left |⇠<br/>^B |Char left
Shift+Left |⇧⇠<br/>^⇧B |Char left extend selection
@@ -159,13 +159,13 @@ Ctrl+Shift+Right |^⇧⇢<br/>^⌥⇧F|Word right extend selection
Alt+Shift+Right |⌥⇧⇢ |Char right extend rect. selection
Home |⌘⇠<br/>^A |Line start
Shift+Home |⌘⇧⇠<br/>^⇧A |Line start extend selection
-Ctrl+Home |⌘⇡<br/>↖ |Document start
-Ctrl+Shift+Home |⌘⇧⇡<br/>⇧↖ |Document start extend selection
+Ctrl+Home |⌘⇡<br/>⌘↖ |Document start
+Ctrl+Shift+Home |⌘⇧⇡<br/>⌘⇧↖ |Document start extend selection
Alt+Shift+Home |⌥⇧↖ |Line start extend rect. selection
End |⌘⇢<br/>^E |Line end
Shift+End |⌘⇧⇢<br/>^⇧E |Line end extend selection
-Ctrl+End |⌘⇣<br/>↘ |Document end
-Ctrl+Shift+End |⌘⇧⇣<br/>⇧↘ |Document end extend selection
+Ctrl+End |⌘⇣<br/>⌘↘ |Document end
+Ctrl+Shift+End |⌘⇧⇣<br/>⌘⇧↘ |Document end extend selection
Alt+Shift+End |⌥⇧↘ |Line end extend rect. selection
PageUp |⇞ |Page up
Shift+PageUp |⇧⇞ |Page up extend selection
@@ -173,17 +173,21 @@ Alt+Shift+PageUp |⌥⇧⇞ |Page up extend rect. selection
PageDown |⇟ |Page down
Shift+PageDown |⇧⇟ |Page down extend selection
Alt+Shift+PageDown |⌥⇧⇟ |Page down extend rect. selection
-Ctrl+Del |⌥⌦ |Delete word right
-Ctrl+Shift+Del |⌘⌦ |Delete line right
+Ctrl+Del |⌘⌦ |Delete word right
+Ctrl+Shift+Del |⌘⇧⌦ |Delete line right
Ins |Ins |Toggle overtype
Backspace<br/>Shift+Backspace|⌫<br/>⇧⌫ |Delete back
-Ctrl+Backspace |⌥⌫ |Delete word left
-Ctrl+Shift+Backspace |⌘⌫ |Delete line left
+Ctrl+Backspace |⌘⌫ |Delete word left
+Ctrl+Shift+Backspace |⌘⇧⌫ |Delete line left
Tab |⇥ |Insert tab or indent
Shift+Tab |⇧⇥ |Dedent
None |^K |Cut to line end
None |^L |Center line vertically
+**Other** |||
+Ctrl+Shift+U, xxxx, Enter|None|Input Unicode character U-xxxx.
+
+
## Lua Patterns
The following is taken from the
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