aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2012-06-22 14:54:44 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2012-06-22 14:54:44 -0400
commit4bca2f464a111f8561cc69d79b0a202be1da4d48 (patch)
tree944a0497d45fe61dc62dbb030be5efea98dcbd24
parentf9cb3d98dc4b1246da7b71b2f5892667c0d64699 (diff)
downloadtextadept-4bca2f464a111f8561cc69d79b0a202be1da4d48.tar.gz
textadept-4bca2f464a111f8561cc69d79b0a202be1da4d48.zip
Updated key commands for ncurses.
-rw-r--r--core/keys.lua15
-rw-r--r--doc/14_Appendix.md352
-rw-r--r--modules/textadept/keys.lua365
-rw-r--r--modules/textadept/menu.lua6
-rw-r--r--src/textadept.c15
5 files changed, 423 insertions, 330 deletions
diff --git a/core/keys.lua b/core/keys.lua
index c8850fbe..be93c18f 100644
--- a/core/keys.lua
+++ b/core/keys.lua
@@ -105,8 +105,9 @@ module('keys')]]
local ADD = ''
local CTRL, ALT, META, SHIFT = 'c'..ADD, 'a'..ADD, 'm'..ADD, 's'..ADD
+if NCURSES then ALT = META end
M.CLEAR = 'esc'
-M.LANGUAGE_MODULE_PREFIX = (not OSX and CTRL or META)..'l'
+M.LANGUAGE_MODULE_PREFIX = (not OSX and not NCURSES and CTRL or META)..'l'
-- Optimize for speed.
local OSX = OSX
@@ -124,7 +125,14 @@ local error = function(e) events.emit(events.ERROR, e) end
-- return a string representation of the key if it exists.
-- @class table
-- @name KEYSYMS
-M.KEYSYMS = { -- from <gdk/gdkkeysyms.h>
+M.KEYSYMS = {
+ -- from Scintilla.h
+ [300] = 'down', [301] = 'up', [302] = 'left', [303] = 'right',
+ [304] = 'home', [305] = 'end',
+ [306] = 'pgup', [307] = 'pgdn',
+ [308] = 'del',
+ [309] = 'ins',
+ -- from <gdk/gdkkeysyms.h>
[0xFE20] = '\t', -- backtab; will be 'shift'ed
[0xFF08] = '\b',
[0xFF09] = '\t',
@@ -228,7 +236,7 @@ local function keypress(code, shift, control, alt, meta)
--print(code, M.KEYSYMS[ch], shift, control, alt, meta)
if code < 256 then
key = string_char(code)
- shift = false -- for printable characters, key is upper case
+ shift = shift and code < 32 -- for printable characters, key is upper case
else
key = M.KEYSYMS[code]
if not key then return end
@@ -238,6 +246,7 @@ local function keypress(code, shift, control, alt, meta)
--print(key_seq)
gui.statusbar_text = ''
+ --if NCURSES then gui.statusbar_text = '"'..key_seq..'"' end
if #keychain > 0 and key_seq == M.CLEAR then
clear_key_sequence()
return true
diff --git a/doc/14_Appendix.md b/doc/14_Appendix.md
index fb9f51b4..df0298e3 100644
--- a/doc/14_Appendix.md
+++ b/doc/14_Appendix.md
@@ -2,182 +2,182 @@
## Key Bindings
-Linux / Win32 | Mac OSX | Command |
---------------|---------|---------|
-**File** |||
-Ctrl+N |⌘N |New file
-Ctrl+O |⌘O |Open file
-Ctrl+Alt+O |^⌘O |Open recent file...
-Ctrl+Shift+O|⌘⇧O |Reload file
-Ctrl+S |⌘S |Save file
-Ctrl+Shift+S|⌘⇧S |Save file as..
-Ctrl+W |⌘W |Close file
-Ctrl+Shift+W|⌘⇧W |Close all files
-None |None|Load session...
-None |None|Load session...
-Ctrl+Q |⌘Q |Quit
-**Edit** |||
-Ctrl+Z<br/>Alt+Backspace|⌘Z |Undo
-Ctrl+Y<br/>Ctrl+Shift+Z |⌘⇧Z |Redo
-Ctrl+X<br/>Shift+Del |⌘X<br/>⇧⌦|Cut
-Ctrl+C<br/>Ctrl+Ins |⌘C |Copy
-Ctrl+V<br/>Shift+Ins |⌘V |Paste
-Ctrl+D |⌘D |Duplicate line
-Del |⌦<br/>^D |Delete
-Alt+Del |^⌦ |Delete word
-Ctrl+A |⌘A |Select all
-Ctrl+M |^M |Match brace
-Ctrl+Enter |^⎋ |Complete word
-Ctrl+Alt+Shift+H |⌘⇧H |Highlight word
-Ctrl+/ |^/ |Toggle block comment
-Ctrl+T |^T |Transpose characters
-Ctrl+Shift+J |^J |Join lines
-Ctrl+Shift+M |^⇧M |Select to matching brace
-Ctrl+< |⌘< |Select between XML tags
-Ctrl+> |⌘> |Select in XML tag
-Ctrl+" |⌘" |Select in double quotes
-Ctrl+' |⌘' |Select in single quotes
-Ctrl+( |⌘( |Select in parentheses
-Ctrl+[ |⌘[ |Select in brackets
-Ctrl+{ |⌘{ |Select in braces
-Ctrl+Shift+D |⌘⇧D |Select word
-Ctrl+Shift+N |⌘⇧N |Select line
-Ctrl+Shift+P |⌘⇧P |Select paragraph
-Ctrl+Shift+I |⌘⇧I |Select indented block
-Ctrl+Alt+U |^U |Upper case selection
-Ctrl+Alt+Shift+U |^⇧U |Lower case selection
-Alt+< |^< |Enclose as XML tags
-Alt+> |^> |Enclose as single XML tag
-Alt+" |^" |Enclose in double quotes
-Alt+' |^' |Enclose in single quotes
-Alt+( |^( |Enclose in parentheses
-Alt+[ |^[ |Enclose in brackets
-Alt+{ |^{ |Enclose in braces
-Ctrl++ |⌘+ |Grow selection by 1 on either side
-Ctrl+\_ |⌘\_ |Shrink selection by 1 on either side
-Ctrl+Shift+Up |^⇧⇡ |Move selected lines up
-Ctrl+Shift+Down |^⇧⇣ |Move selected lines down
-**Search** |||
-Ctrl+F |⌘F |Find
-Ctrl+G<br/>F3 |⌘G |Find next
-Ctrl+Shift+G<br/>Shift+F3|⌘⇧G |Find previous
-Ctrl+Alt+R |^R |Replace
-Ctrl+Alt+Shift+R |^⇧R |Replace all
-Ctrl+Alt+F |^⌘F |Find incremental
-Ctrl+Shift+F |⌘⇧F |Find in files
-Ctrl+Alt+G |^⌘G |Goto next file found
-Ctrl+Alt+Shift+G |^⌘⇧G|Goto previous file found
-Ctrl+J |⌘J |Jump to line
-**Tools** |||
-Ctrl+E |⌘E |Command entry
-Ctrl+Shift+E |⌘⇧E |Select command
-Ctrl+R |⌘R |Run
-Ctrl+Shift+R |⌘⇧R |Compile
-Ctrl+&#124; |⌘&#124;|Filter text through
-Ctrl+Space |⌥⎋ |Complete symbol
-Ctrl+H |^H |Show documentation
-Tab |⇥ |Expand snippet or next placeholder
-Ctrl+K |⌥⇥ |Insert snippet...
-Shift+Tab |⇧⇥ |Previous snippet placeholder
-Ctrl+Shift+K |⌥⇧⇥ |Cancel snippet
-Ctrl+F2 |⌘F2 |Toggle bookmark
-Ctrl+Shift+F2 |⌘⇧F2 |Clear bookmarks
-F2 |F2 |Next bookark
-Shift+F2 |⇧F2 |Previous bookmark
-Alt+F2 |⌥F2 |Goto bookmark...
-Ctrl+U |⌘U |Snapopen `_USERHOME`
-None |None |Snapopen `_HOME`
-Ctrl+Alt+Shift+O|^⌘⇧O |Snapopen current directory
-Ctrl+I |⌘I |Show style
-**Buffer** |||
-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+Shift+L |⌘⇧L |Select lexer...
-F5 |F5 |Refresh syntax highlighting
-**View** |||
-Ctrl+Alt+N |^⌥⇥ |Next view
-Ctrl+Alt+P |^⌥⇧⇥ |Previous view
-Ctrl+Alt+S<br/>Ctrl+Alt+H|^S |Split view horizontal
-Ctrl+Alt+V |^V |Split view vertical
-Ctrl+Alt+W |^W |Unsplit view
-Ctrl+Alt+Shift+W |^⇧W |Unsplit all views
-Ctrl+Alt++<br/>Ctrl+Alt+=|^+<br/>^=|Grow view
-Ctrl+Alt+- |^- |Shrink view
-None |None |Toggle current fold
-Ctrl+Alt+Enter |^↩ |Toggle view EOL
-Ctrl+Alt+\\ |^\\ |Toggle wrap mode
-Ctrl+Alt+Shift+I |^⇧I |Toggle show indent guides
-Ctrl+Alt+Shift+S |^⇧S |Toggle view whitespace
-Ctrl+Alt+Shift+V |^⇧V |Toggle virtual space
-Ctrl+= |⌘= |Zoom in
-Ctrl+- |⌘- |Zoom out
-Ctrl+0 |⌘0 |Reset zoom
-Ctrl+Shift+T |⌘⇧T |Select theme...
-**Help** |||
-F1 |F1 |Open manual
-Shift+F1|⇧F1 |Open LuaDoc
-None |None|About
-**Movement** |||
-Down |⇣<br/>^N |Line down
-Shift+Down |⇧⇣<br/>^⇧N |Line down extend selection
-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
-Alt+Shift+Up |⌥⇧⇡ |Line up extend rect. selection
-Left |⇠<br/>^B |Char left
-Shift+Left |⇧⇠<br/>^⇧B |Char left extend selection
-Ctrl+Left |^⇠<br/>^⌘B |Word left
-Ctrl+Shift+Left |^⇧⇠<br/>^⌘⇧B|Word left extend selection
-Alt+Shift+Left |⌥⇧⇠ |Char left extend rect. selection
-Right |⇢<br/>^F |Char right
-Shift+Right |⇧⇢<br/>^⇧F |Char right extend selection
-Ctrl+Right |^⇢<br/>^⌘F |Word right
-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
-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
-Alt+Shift+End |⌥⇧↘ |Line end extend rect. selection
-PageUp |⇞ |Page up
-Shift+PageUp |⇧⇞ |Page up extend selection
-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
-Ins |Ins |Toggle overtype
-Backspace<br/>Shift+Backspace|⌫<br/>⇧⌫ |Delete back
-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.
+Linux / Win32 | Mac OSX | Terminal | Command |
+--------------|---------|----------|---------|
+**File** ||||
+Ctrl+N |⌘N |M-^N|New file
+Ctrl+O |⌘O |^O |Open file
+Ctrl+Alt+O |^⌘O |M-^O|Open recent file...
+Ctrl+Shift+O|⌘⇧O |M-O |Reload file
+Ctrl+S |⌘S |^S |Save file
+Ctrl+Shift+S|⌘⇧S |M-^S|Save file as..
+Ctrl+W |⌘W |^W |Close file
+Ctrl+Shift+W|⌘⇧W |M-^W|Close all files
+None |None|None|Load session...
+None |None|None|Load session...
+Ctrl+Q |⌘Q |^Q |Quit
+**Edit** ||||
+Ctrl+Z<br/>Alt+Backspace|⌘Z |^Z |Undo
+Ctrl+Y<br/>Ctrl+Shift+Z |⌘⇧Z |^Y |Redo
+Ctrl+X<br/>Shift+Del |⌘X<br/>⇧⌦|^X |Cut
+Ctrl+C<br/>Ctrl+Ins |⌘C |^C |Copy
+Ctrl+V<br/>Shift+Ins |⌘V |^V |Paste
+Ctrl+D |⌘D |None |Duplicate line
+Del |⌦<br/>^D |Del<br/>^D |Delete
+Alt+Del |^⌦ |M-Del<br/>M-D|Delete word
+Ctrl+A |⌘A |M-A |Select all
+Ctrl+M<br/>Ctrl+] |^M |M-M |Match brace
+Ctrl+Enter |^⎋ |M-Enter |Complete word
+Ctrl+Alt+Shift+H |⌘⇧H |None |Highlight word
+Ctrl+/ |^/ |M-/ |Toggle block comment
+Ctrl+T |^T |^T |Transpose characters
+Ctrl+Shift+J |^J |M-J |Join lines
+Ctrl+Shift+M |^⇧M |M-S-M |Select to matching brace
+Ctrl+< |⌘< |M-< |Select between XML tags
+Ctrl+> |⌘> |None |Select in XML tag
+Ctrl+" |⌘" |M-" |Select in double quotes
+Ctrl+' |⌘' |M-' |Select in single quotes
+Ctrl+( |⌘( |M-( |Select in parentheses
+Ctrl+[ |⌘[ |M-[ |Select in brackets
+Ctrl+{ |⌘{ |M-{ |Select in braces
+Ctrl+Shift+D |⌘⇧D |M-S-W |Select word
+Ctrl+Shift+N |⌘⇧N |M-S-N |Select line
+Ctrl+Shift+P |⌘⇧P |M-S-P |Select paragraph
+Ctrl+Shift+I |⌘⇧I |M-S-I |Select indented block
+Ctrl+Alt+U |^U |M-^U |Upper case selection
+Ctrl+Alt+Shift+U |^⇧U |M-^L |Lower case selection
+Alt+< |^< |M-> |Enclose as XML tags
+Alt+> |^> |None |Enclose as single XML tag
+Alt+" |^" |None |Enclose in double quotes
+Alt+' |^' |None |Enclose in single quotes
+Alt+( |^( |M-) |Enclose in parentheses
+Alt+[ |^[ |M-] |Enclose in brackets
+Alt+{ |^{ |M-} |Enclose in braces
+Ctrl++ |⌘+ |M-+ |Grow selection bounds by 1
+Ctrl+\_ |⌘\_ |M-\_ |Shrink selection bounds by 1
+Ctrl+Shift+Up |^⇧⇡ |S-^Up |Move selected lines up
+Ctrl+Shift+Down |^⇧⇣ |S-^Down |Move selected lines down
+**Search** ||||
+Ctrl+F |⌘F |M-F<br/>M-S-F|Find
+Ctrl+G<br/>F3 |⌘G |M-G |Find next
+Ctrl+Shift+G<br/>Shift+F3|⌘⇧G |M-S-G |Find previous
+Ctrl+Alt+R |^R |M-R |Replace
+Ctrl+Alt+Shift+R |^⇧R |M-S-R |Replace all
+Ctrl+Alt+F |^⌘F |M-^F |Find incremental
+Ctrl+Shift+F |⌘⇧F |None |Find in files
+Ctrl+Alt+G |^⌘G |None |Goto next file found
+Ctrl+Alt+Shift+G |^⌘⇧G|None |Goto previous file found
+Ctrl+J |⌘J |^J |Jump to line
+**Tools** ||||
+Ctrl+E |⌘E |M-C |Command entry
+Ctrl+Shift+E |⌘⇧E |M-S-C |Select command
+Ctrl+R |⌘R |^R |Run
+Ctrl+Shift+R |⌘⇧R |M-^R |Compile
+Ctrl+&#124; |⌘&#124;|^\ |Filter text through
+Ctrl+Space |⌥⎋ |^Space |Complete symbol
+Ctrl+H |^H |M-H<br/>M-S-H|Show documentation
+Tab |⇥ |Tab |Expand snippet or next placeholder
+Ctrl+K |⌥⇥ |M-K |Insert snippet...
+Shift+Tab |⇧⇥ |S-Tab |Previous snippet placeholder
+Ctrl+Shift+K |⌥⇧⇥ |M-S-K |Cancel snippet
+Ctrl+F2 |⌘F2 |None |Toggle bookmark
+Ctrl+Shift+F2 |⌘⇧F2 |None |Clear bookmarks
+F2 |F2 |None |Next bookmark
+Shift+F2 |⇧F2 |None |Previous bookmark
+Alt+F2 |⌥F2 |None |Goto bookmark...
+Ctrl+U |⌘U |^U |Snapopen `_USERHOME`
+None |None |None |Snapopen `_HOME`
+Ctrl+Alt+Shift+O|^⌘⇧O |M-S-O |Snapopen current directory
+Ctrl+I |⌘I |None |Show style
+**Buffer** ||||
+Ctrl+Tab |^⇥ |M-N |Next buffer
+Ctrl+Shift+Tab |^⇧⇥ |M-P |Previous buffer
+Ctrl+B |⌘B |M-B<br/>M-S-B|Switch to buffer...
+None |None |None |Tab width: 2
+None |None |None |Tab width: 3
+None |None |None |Tab width: 4
+None |None |None |Tab width: 8
+Ctrl+Alt+Shift+T|^⇧T |M-T<br/>M-S-T|Toggle use tabs
+Ctrl+Alt+I |^I |M-I |Convert indentation
+None |None |None |`CRLF` EOL mode
+None |None |None |`CR` EOL mode
+None |None |None |`LF` EOL mode
+None |None |None |`UTF-8` encoding
+None |None |None |`ASCII` encoding
+None |None |None |`ISO-8859-1` encoding
+None |None |None |`UTF-16` encoding
+Ctrl+Shift+L |⌘⇧L |M-S-L |Select lexer...
+F5 |F5 |^L<br/>F5 |Refresh syntax highlighting
+**View** ||||
+Ctrl+Alt+N |^⌥⇥ |N/A |Next view
+Ctrl+Alt+P |^⌥⇧⇥ |N/A |Previous view
+Ctrl+Alt+S<br/>Ctrl+Alt+H|^S |N/A |Split view horizontal
+Ctrl+Alt+V |^V |N/A |Split view vertical
+Ctrl+Alt+W |^W |N/A |Unsplit view
+Ctrl+Alt+Shift+W |^⇧W |N/A |Unsplit all views
+Ctrl+Alt++<br/>Ctrl+Alt+=|^+<br/>^=|N/A |Grow view
+Ctrl+Alt+- |^- |N/A |Shrink view
+None |None |None |Toggle current fold
+Ctrl+Alt+Enter |^↩ |None |Toggle view EOL
+Ctrl+Alt+\\ |^\\ |None |Toggle wrap mode
+Ctrl+Alt+Shift+I |^⇧I |None |Toggle show indent guides
+Ctrl+Alt+Shift+S |^⇧S |None |Toggle view whitespace
+Ctrl+Alt+Shift+V |^⇧V |None |Toggle virtual space
+Ctrl+= |⌘= |M-= |Zoom in
+Ctrl+- |⌘- |M-- |Zoom out
+Ctrl+0 |⌘0 |M-0 |Reset zoom
+Ctrl+Shift+T |⌘⇧T |None |Select theme...
+**Help** ||||
+F1 |F1 |None|Open manual
+Shift+F1|⇧F1 |None|Open LuaDoc
+None |None|None|About
+**Movement** ||||
+Down |⇣<br/>^N |^N<br/>Down |Line down
+Shift+Down |⇧⇣<br/>^⇧N |S-Down |Line down extend selection
+Ctrl+Down |^⇣ |^Down |Scroll line down
+Alt+Shift+Down |⌥⇧⇣ |M-S-Down |Line down extend rect. selection
+Up |⇡<br/>^P |^P<br/>Up |Line up
+Shift+Up |⇧⇡<br/>^⇧P |S-Up |Line up extend selection
+Ctrl+Up |^⇡ |^Up |Scroll line up
+Alt+Shift+Up |⌥⇧⇡ |M-S-Up |Line up extend rect. selection
+Left |⇠<br/>^B |^B<br/>Left |Char left
+Shift+Left |⇧⇠<br/>^⇧B |S-Left |Char left extend selection
+Ctrl+Left |^⇠<br/>^⌘B |^Left |Word left
+Ctrl+Shift+Left |^⇧⇠<br/>^⌘⇧B|S-^Left |Word left extend selection
+Alt+Shift+Left |⌥⇧⇠ |M-S-Left |Char left extend rect. selection
+Right |⇢<br/>^F |^F<br/>Right|Char right
+Shift+Right |⇧⇢<br/>^⇧F |S-Right |Char right extend selection
+Ctrl+Right |^⇢<br/>^⌘F |^Right |Word right
+Ctrl+Shift+Right |^⇧⇢<br/>^⌘⇧F|S-^Right |Word right extend selection
+Alt+Shift+Right |⌥⇧⇢ |M-S-Right |Char right extend rect. selection
+Home |⌘⇠<br/>^A |^A<br/>Home |Line start
+Shift+Home |⌘⇧⇠<br/>^⇧A |M-S-A |Line start extend selection
+Ctrl+Home |⌘⇡<br/>⌘↖ |M-^A |Document start
+Ctrl+Shift+Home |⌘⇧⇡<br/>⌘⇧↖ |None |Document start extend selection
+Alt+Shift+Home |⌥⇧↖ |None |Line start extend rect. selection
+End |⌘⇢<br/>^E |^E<br/>End |Line end
+Shift+End |⌘⇧⇢<br/>^⇧E |M-S-E |Line end extend selection
+Ctrl+End |⌘⇣<br/>⌘↘ |M-^E |Document end
+Ctrl+Shift+End |⌘⇧⇣<br/>⌘⇧↘ |None |Document end extend selection
+Alt+Shift+End |⌥⇧↘ |None |Line end extend rect. selection
+PageUp |⇞ |PageUp |Page up
+Shift+PageUp |⇧⇞ |M-S-U |Page up extend selection
+Alt+Shift+PageUp |⌥⇧⇞ |None |Page up extend rect. selection
+PageDown |⇟ |PageDown |Page down
+Shift+PageDown |⇧⇟ |M-S-D |Page down extend selection
+Alt+Shift+PageDown |⌥⇧⇟ |None |Page down extend rect. selection
+Ctrl+Del |⌘⌦ |^Del |Delete word right
+Ctrl+Shift+Del |⌘⇧⌦ |S-^Del |Delete line right
+Ins |Ins |Ins |Toggle overtype
+Backspace |⌫<br/>⇧⌫ |^H<br/>Bksp |Delete back
+Ctrl+Backspace |⌘⌫ |None |Delete word left
+Ctrl+Shift+Backspace|⌘⇧⌫ |None |Delete line left
+Tab |⇥ |Tab |Insert tab or indent
+Shift+Tab |⇧⇥ |S-Tab |Dedent
+None |^K |^K |Cut to line end
+None |^L |None |Center line vertically
+**Other** ||||
+Ctrl+Shift+U, xxxx, Enter|None|None|Input Unicode character U-xxxx.
## Lua Patterns
diff --git a/modules/textadept/keys.lua b/modules/textadept/keys.lua
index df39cd7a..3f6a1f70 100644
--- a/modules/textadept/keys.lua
+++ b/modules/textadept/keys.lua
@@ -106,47 +106,77 @@ local m_bookmarks, m_snippets = m_textadept.bookmarks, m_textadept.snippets
local OSX, c = OSX, _SCINTILLA.constants
local utils = M.utils
---[[
- Windows and Linux menu key commands.
-
- Unassigned keys (~ denotes keys reserved by the operating system):
- c: A B C H p Q ~ V X Y ) ] } * \n
- a: aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ_ ) ] } *+-/=~~\n\s
- ca: aAbBcCdDeE F jJkKlLmM N PqQ t xXy zZ_"'()[]{}<>* / ~~ \s
-
- CTRL = 'c' (Control ^)
- ALT = 'a' (Alt)
- META = [unused]
- SHIFT = 's' (Shift ⇧)
- ADD = ''
- Control, Alt, Shift, and 'a' = 'caA'
- Control, Alt, Shift, and '\t' = 'cas\t'
-
- Mac OSX menu key commands.
-
- Unassigned keys (~ denotes keys reserved by the operating system):
- m: A B C ~ JkK ~M p ~ t U V XyY ) ] } * ~~\n~~
- c: cC D gG H J K L oO qQ xXyYzZ_ ) ] } * / \s
- cm: aAbBcC~DeE F ~HiIjJkKlL~MnN pPq~rRsStTuUvVwWxXyYzZ_"'()[]{}<>*+-/=\t\n~~
-
- CTRL = 'c' (Control ^)
- ALT = 'a' (Alt/option ⌥)
- META = 'm' (Command ⌘)
- SHIFT = 's' (Shift ⇧)
- ADD = ''
- Command, Option, Shift, and 'a' = 'amA'
- Command, Option, Shift, and '\t' = 'ams\t'
-]]--
+-- Windows and Linux menu key commands.
+--
+-- Unassigned keys (~ denotes keys reserved by the operating system):
+-- c: A B C H p Q ~ V X Y ) ] } *
+-- a: aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ_ ) ] } *+-/=\n\s
+-- ca: aAbBcCdDeE F jJkKlLmM N PqQ t xXy zZ_"'()[]{}<>* / \s
+--
+-- CTRL = 'c' (Control ^)
+-- ALT = 'a' (Alt)
+-- META = [unused]
+-- SHIFT = 's' (Shift ⇧)
+-- ADD = ''
+-- Control, Alt, Shift, and 'a' = 'caA'
+-- Control, Alt, Shift, and '\t' = 'cas\t'
+--
+-- Mac OSX menu key commands.
+--
+-- Unassigned keys (~ denotes keys reserved by the operating system):
+-- m: A B C ~ JkK ~M p ~ t U V XyY ) ] } * ~~\n
+-- c: cC D gG H J K L oO qQ xXyYzZ_ ) ] } * /
+-- cm: aAbBcC~DeE F ~HiIjJkKlL~MnN pPq~rRsStTuUvVwWxXyYzZ_"'()[]{}<>*+-/=\t\n
+--
+-- CTRL = 'c' (Control ^)
+-- ALT = 'a' (Alt/option ⌥)
+-- META = 'm' (Command ⌘)
+-- SHIFT = 's' (Shift ⇧)
+-- ADD = ''
+-- Command, Option, Shift, and 'a' = 'amA'
+-- Command, Option, Shift, and '\t' = 'ams\t'
+--
+-- ncurses key commands.
+--
+-- The terminal keymap is much more limited and complicated:
+-- * Control+[Shift+](digit/symbol) gives limited results.
+-- Here are example keymaps for a US English keyboard:
+-- Pressing Control+ `1234567890-=[]\;',./
+-- Results in c: @ @ \]^_ __ ]\ g
+-- (e.g. `keys.c2` in the GUI would be `keys['c@']` in the terminal.)
+-- Notes:
+-- * Adding the Shift modifier to any of the above keys gives the same
+-- result.
+-- * Adding the Alt and/or Shift modifiers to any of the above keys also
+-- gives the same result, but with only the Alt modifier being
+-- recognized (e.g. `keys['ca$']` would be `keys['ca\']`).
+-- * Control+[Alt+]Shift+letter does not report the uppercase letter (e.g.
+-- `keys.cA` in the GUI would be `keys.ca` in the terminal and similarly,
+-- `keys.caA` would be `keys.caa`).
+-- * No modifiers are recognized for the function keys (e.g. F1-F12).
+--
+-- Unassigned keys (~ denotes keys reserved by the operating system):
+-- c: g~~ ~ ^]
+-- cm: bcd g~~ k ~ pq t v xyz
+-- m: e J qQ sS u vVw xXyYzZ*
+-- Note: m[befhstv] may be used by GUI terminals.
+--
+-- CTRL = 'c' (Control ^)
+-- ALT = [unused]
+-- META = 'm' (Alt)
+-- SHIFT = 's' (Shift ⇧)
+-- ADD = ''
+-- Control, Meta, and 'a' = 'cma'
-- File.
-keys[not OSX and 'cn' or 'mn'] = new_buffer
+keys[not OSX and (not NCURSES and 'cn' or 'cmn') or 'mn'] = new_buffer
keys[not OSX and 'co' or 'mo'] = io.open_file
-keys[not OSX and 'cao' or 'cmo'] = io.open_recent_file
-keys[not OSX and 'cO' or 'mO'] = buffer.reload
+keys[not OSX and not NCURSES and 'cao' or 'cmo'] = io.open_recent_file
+keys[not OSX and (not NCURSES and 'cO' or 'mo') or 'mO'] = buffer.reload
keys[not OSX and 'cs' or 'ms'] = buffer.save
-keys[not OSX and 'cS' or 'mS'] = buffer.save_as
+keys[not OSX and (not NCURSES and 'cS' or 'cms') or 'mS'] = buffer.save_as
keys[not OSX and 'cw' or 'mw'] = buffer.close
-keys[not OSX and 'cW' or 'mW'] = io.close_all
+keys[not OSX and (not NCURSES and 'cW' or 'cmw') or 'mW'] = io.close_all
-- TODO: m_textadept.sessions.prompt_load
-- TODO: m_textadept.sessions.prompt_save
keys[not OSX and 'cq' or 'mq'] = quit
@@ -154,104 +184,140 @@ keys[not OSX and 'cq' or 'mq'] = quit
-- Edit.
keys[not OSX and 'cz' or 'mz'] = buffer.undo
if not OSX then keys.cy = buffer.redo end
-keys[not OSX and 'cZ' or 'mZ'] = buffer.redo
+if not NCURSES then keys[not OSX and 'cZ' or 'mZ'] = buffer.redo end
keys[not OSX and 'cx' or 'mx'] = buffer.cut
keys[not OSX and 'cc' or 'mc'] = buffer.copy
keys[not OSX and 'cv' or 'mv'] = buffer.paste
-keys[not OSX and 'cd' or 'md'] = buffer.line_duplicate
+if not NCURSES then keys[not OSX and 'cd' or 'md'] = buffer.line_duplicate end
keys.del = buffer.clear
-keys[not OSX and 'ca' or 'ma'] = buffer.select_all
-keys.cm = m_editing.match_brace
-keys[not OSX and 'c\n' or 'cesc'] = { m_editing.autocomplete_word, '%w_' }
-keys[not OSX and 'adel' or 'cdel'] = utils.delete_word
-keys[not OSX and 'caH' or 'mH'] = m_editing.highlight_word
-keys[not OSX and 'c/' or 'm/'] = m_editing.block_comment
+keys[not OSX and (not NCURSES and 'adel' or 'mdel')
+ or 'cdel'] = utils.delete_word
+keys[not OSX and not NCURSES and 'ca' or 'ma'] = buffer.select_all
+keys[not NCURSES and 'cm' or 'mm'] = m_editing.match_brace
+keys[not OSX and (not NCURSES and 'c\n' or 'cmj')
+ or 'cesc'] = { m_editing.autocomplete_word, '%w_' }
+if not NCURSES then
+ keys[not OSX and 'caH' or 'mH'] = m_editing.highlight_word
+end
+keys[not OSX and not NCURSES and 'c/' or 'm/'] = m_editing.block_comment
keys.ct = m_editing.transpose_chars
-keys[not OSX and 'cJ' or 'cj'] = m_editing.join_lines
+keys[not OSX and (not NCURSES and 'cJ' or 'mj') or 'cj'] = m_editing.join_lines
-- Select.
-keys.cM = { m_editing.match_brace, 'select' }
-keys[not OSX and 'c<' or 'm<'] = { m_editing.select_enclosed, '>', '<' }
-keys[not OSX and 'c>' or 'm>'] = { m_editing.select_enclosed, '<', '>' }
-keys[not OSX and "c'" or "m'"] = { m_editing.select_enclosed, "'", "'" }
-keys[not OSX and 'c"' or 'm"'] = { m_editing.select_enclosed, '"', '"' }
-keys[not OSX and 'c(' or 'm('] = { m_editing.select_enclosed, '(', ')' }
-keys[not OSX and 'c[' or 'm['] = { m_editing.select_enclosed, '[', ']' }
-keys[not OSX and 'c{' or 'm{'] = { m_editing.select_enclosed, '{', '}' }
-keys[not OSX and 'cD' or 'mD'] = m_editing.select_word
-keys[not OSX and 'cN' or 'mN'] = m_editing.select_line
-keys[not OSX and 'cP' or 'mP'] = m_editing.select_paragraph
-keys[not OSX and 'cI' or 'mI'] = m_editing.select_indented_block
+keys[not NCURSES and 'cM' or 'mM'] = { m_editing.match_brace, 'select' }
+keys[not OSX and not NCURSES and 'c<'
+ or 'm<'] = { m_editing.select_enclosed, '>', '<' }
+if not NCURSES then
+ keys[not OSX and 'c>' or 'm>'] = { m_editing.select_enclosed, '<', '>' }
+end
+keys[not OSX and not NCURSES and "c'"
+ or "m'"] = { m_editing.select_enclosed, "'", "'" }
+keys[not OSX and not NCURSES and 'c"'
+ or 'm"'] = { m_editing.select_enclosed, '"', '"' }
+keys[not OSX and not NCURSES and 'c('
+ or 'm('] = { m_editing.select_enclosed, '(', ')' }
+keys[not OSX and not NCURSES and 'c['
+ or 'm['] = { m_editing.select_enclosed, '[', ']' }
+keys[not OSX and not NCURSES and 'c{'
+ or 'm{'] = { m_editing.select_enclosed, '{', '}' }
+keys[not OSX and (not NCURSES and 'cD' or 'mW') or 'mD'] = m_editing.select_word
+keys[not OSX and not NCURSES and 'cN' or 'mN'] = m_editing.select_line
+keys[not OSX and not NCURSES and 'cP' or 'mP'] = m_editing.select_paragraph
+keys[not OSX and not NCURSES and 'cI' or 'mI'] = m_editing.select_indented_block
-- Selection.
keys[not OSX and 'cau' or 'cu'] = buffer.upper_case
-keys[not OSX and 'caU' or 'cU'] = buffer.lower_case
-keys[not OSX and 'a<' or 'c<'] = utils.enclose_as_xml_tags
-keys[not OSX and 'a>' or 'c>'] = { m_editing.enclose, '<', ' />' }
-keys[not OSX and "a'" or "c'"] = { m_editing.enclose, "'", "'" }
-keys[not OSX and 'a"' or 'c"'] = { m_editing.enclose, '"', '"' }
-keys[not OSX and 'a(' or 'c('] = { m_editing.enclose, '(', ')' }
-keys[not OSX and 'a[' or 'c['] = { m_editing.enclose, '[', ']' }
-keys[not OSX and 'a{' or 'c{'] = { m_editing.enclose, '{', '}' }
-keys[not OSX and 'c+' or 'm+'] = { m_editing.grow_selection, 1 }
-keys[not OSX and 'c_' or 'm_'] = { m_editing.grow_selection, -1 }
+keys[not OSX and (not NCURSES and 'caU' or 'cml') or 'cU'] = buffer.lower_case
+keys[not OSX and (not NCURSES and 'a<' or 'm>')
+ or 'c<'] = utils.enclose_as_xml_tags
+if not NCURSES then
+ keys[not OSX and 'a>' or 'c>'] = { m_editing.enclose, '<', ' />' }
+ keys[not OSX and "a'" or "c'"] = { m_editing.enclose, "'", "'" }
+ keys[not OSX and 'a"' or 'c"'] = { m_editing.enclose, '"', '"' }
+end
+keys[not OSX and (not NCURSES and 'a(' or 'm)')
+ or 'c('] = { m_editing.enclose, '(', ')' }
+keys[not OSX and (not NCURSES and 'a[' or 'm]')
+ or 'c['] = { m_editing.enclose, '[', ']' }
+keys[not OSX and (not NCURSES and 'a{' or 'm}')
+ or 'c{'] = { m_editing.enclose, '{', '}' }
+keys[not OSX and not NCURSES and 'c+' or 'm+'] = { m_editing.grow_selection, 1 }
+keys[not OSX and not NCURSES and 'c_'
+ or 'm_'] = { m_editing.grow_selection, -1 }
keys.csup = buffer.move_selected_lines_up
keys.csdown = buffer.move_selected_lines_down
-- Search.
-keys[not OSX and 'cf' or 'mf'] = gui_find.focus
-keys[not OSX and 'cg' or 'mg'] = gui_find.find_next
-if not OSX then keys.f3 = keys.cg end
-keys[not OSX and 'cG' or 'mG'] = gui_find.find_prev
-if not OSX then keys.sf3 = keys.cG end
-keys[not OSX and 'car' or 'cr'] = gui_find.replace
-keys[not OSX and 'caR' or 'cR'] = gui_find.replace_all
--- Find Next is an when find pane is focused.
--- Find Prev is ap when find pane is focused.
--- Replace is ar when find pane is focused.
--- Replace All is aa when find pane is focused.
-keys[not OSX and 'caf' or 'cmf'] = gui_find.find_incremental
-keys[not OSX and 'cF' or 'mF'] = utils.find_in_files
--- Find in Files is ai when find pane is focused.
-keys[not OSX and 'cag' or 'cmg'] = { gui_find.goto_file_in_list, true }
-keys[not OSX and 'caG' or 'cmG'] = { gui_find.goto_file_in_list, false }
+keys[not OSX and not NCURSES and 'cf' or 'mf'] = gui_find.focus
+if NCURSES then keys.mF = keys.mf end -- in case mf is used by GUI terminals
+keys[not OSX and not NCURSES and 'cg' or 'mg'] = gui_find.find_next
+if not OSX and not NCURSES then keys.f3 = keys.cg end
+keys[not OSX and not NCURSES and 'cG' or 'mG'] = gui_find.find_prev
+if not OSX and not NCURSES then keys.sf3 = keys.cG end
+keys[not OSX and (not NCURSES and 'car' or 'mr') or 'cr'] = gui_find.replace
+keys[not OSX and (not NCURSES and 'caR' or 'mR') or 'cR'] = gui_find.replace_all
+-- Find Next is an when find pane is focused in GUI.
+-- Find Prev is ap when find pane is focused in GUI.
+-- Replace is ar when find pane is focused in GUI.
+-- Replace All is aa when find pane is focused in GUI.
+keys[not OSX and not NCURSES and 'caf' or 'cmf'] = gui_find.find_incremental
+if not NCURSES then keys[not OSX and 'cF' or 'mF'] = utils.find_in_files end
+-- Find in Files is ai when find pane is focused in GUI.
+if not NCURSES then
+ keys[not OSX and 'cag' or 'cmg'] = { gui_find.goto_file_in_list, true }
+ keys[not OSX and 'caG' or 'cmG'] = { gui_find.goto_file_in_list, false }
+end
keys[not OSX and 'cj' or 'mj'] = m_editing.goto_line
-- Tools.
-keys[not OSX and 'ce' or 'me'] = gui.command_entry.focus
-keys[not OSX and 'cE' or 'mE'] = utils.select_command
+keys[not OSX and (not NCURSES and 'ce' or 'mc')
+ or 'me'] = gui.command_entry.focus
+keys[not OSX and (not NCURSES and 'cE' or 'mC')
+ or 'mE'] = utils.select_command
keys[not OSX and 'cr' or 'mr'] = m_textadept.run.run
-keys[not OSX and 'cR' or 'mR'] = m_textadept.run.compile
-keys[not OSX and 'c|' or 'm|'] = m_textadept.filter_through.filter_through
+keys[not OSX and (not NCURSES and 'cR' or 'cmr')
+ or 'mR'] = m_textadept.run.compile
+keys[not OSX and (not NCURSES and 'c|' or 'c\\')
+ or 'm|'] = m_textadept.filter_through.filter_through
-- Adeptsense.
-keys[not OSX and 'c ' or 'aesc'] = m_textadept.adeptsense.complete_symbol
-keys.ch = m_textadept.adeptsense.show_documentation
+keys[not OSX and (not NCURSES and 'c ' or 'c@')
+ or 'aesc'] = m_textadept.adeptsense.complete_symbol
+keys[not NCURSES and 'ch' or 'mh'] = m_textadept.adeptsense.show_documentation
+if NCURSES then keys.mH = keys.mh end -- in case mh is used by GUI terminals
-- Snippets.
-keys[not OSX and 'ck' or 'a\t'] = m_snippets._select
+keys[not OSX and (not NCURSES and 'ck' or 'mk') or 'a\t'] = m_snippets._select
keys['\t'] = m_snippets._insert
keys['s\t'] = m_snippets._previous
-keys[not OSX and 'cK' or 'as\t'] = m_snippets._cancel_current
--- Bookmark.
-keys[not OSX and 'cf2' or 'mf2'] = m_bookmarks.toggle
-keys[not OSX and 'csf2' or 'msf2'] = m_bookmarks.clear
-keys.f2 = m_bookmarks.goto_next
-keys.sf2 = m_bookmarks.goto_prev
-keys.af2 = m_bookmarks.goto_bookmark
+keys[not OSX and (not NCURSES and 'cK' or 'mK')
+ or 'as\t'] = m_snippets._cancel_current
+if not NCURSES then
+ -- Bookmark.
+ keys[not OSX and 'cf2' or 'mf2'] = m_bookmarks.toggle
+ keys[not OSX and 'csf2' or 'msf2'] = m_bookmarks.clear
+ keys.f2 = m_bookmarks.goto_next
+ keys.sf2 = m_bookmarks.goto_prev
+ keys.af2 = m_bookmarks.goto_bookmark
+end
-- Snapopen.
keys[not OSX and 'cu' or 'mu'] = { m_textadept.snapopen.open, _USERHOME }
-- TODO: { m_textadept.snapopen.open, _HOME }
-keys[not OSX and 'caO' or 'cmO'] = utils.snapopen_filedir
-keys[not OSX and 'ci' or 'mi'] = utils.show_style
+keys[not OSX and (not NCURSES and 'caO' or 'mO')
+ or 'cmO'] = utils.snapopen_filedir
+if not NCURSES then keys[not OSX and 'ci' or 'mi'] = utils.show_style end
-- Buffer.
-keys['c\t'] = { view.goto_buffer, view, 1, true }
-keys['cs\t'] = { view.goto_buffer, view, -1, true }
-keys[not OSX and 'cb' or 'mb'] = gui.switch_buffer
+keys[not NCURSES and 'c\t' or 'mn'] = { view.goto_buffer, view, 1, true }
+keys[not NCURSES and 'cs\t' or 'mp'] = { view.goto_buffer, view, -1, true }
+keys[not OSX and not NCURSES and 'cb' or 'mb'] = gui.switch_buffer
+if NCURSES then keys.mB = keys.mb end -- in case mb is used by GUI terminals
-- Indentation.
-- TODO: { utils.set_indentation, 2 }
-- TODO: { utils.set_indentation, 3 }
-- TODO: { utils.set_indentation, 4 }
-- TODO: { utils.set_indentation, 8 }
-keys[not OSX and 'caT' or 'cT'] = { utils.toggle_property, 'use_tabs' }
-keys[not OSX and 'cai' or 'ci'] = m_editing.convert_indentation
+keys[not OSX and (not NCURSES and 'caT' or 'mt')
+ or 'cT'] = { utils.toggle_property, 'use_tabs' }
+if NCURSES then keys.mT = keys.mt end -- in case mt is used by GUI terminals
+keys[not OSX and (not NCURSES and 'cai' or 'mi')
+ or 'ci'] = m_editing.convert_indentation
-- EOL Mode.
-- TODO: { utils.set_eol_mode, c.SC_EOL_CRLF }
-- TODO: { utils.set_eol_mode, c.SC_EOL_CR }
@@ -264,65 +330,80 @@ keys[not OSX and 'cai' or 'ci'] = m_editing.convert_indentation
-- TODO: { utils.set_encoding, 'UTF-16LE' }
keys[not OSX and 'cL' or 'mL'] = m_textadept.mime_types.select_lexer
keys.f5 = { buffer.colourise, buffer, 0, -1 }
+if NCURSES then keys.cl = keys.f5 end
-- View.
-keys[not OSX and 'can' or 'ca\t'] = { gui.goto_view, 1, true }
-keys[not OSX and 'cap' or 'cas\t'] = { gui.goto_view, -1, true }
-keys[not OSX and 'cas' or 'cs'] = { view.split, view }
-if not OSX then keys.cah = keys.cas end
-keys[not OSX and 'cav' or 'cv'] = { view.split, view, true }
-keys[not OSX and 'caw' or 'cw'] = { view.unsplit, view }
-keys[not OSX and 'caW' or 'cW'] = utils.unsplit_all
-keys[not OSX and 'ca+' or 'c+'] = { utils.grow, 10 }
-keys[not OSX and 'ca=' or 'c='] = { utils.grow, 10 }
-keys[not OSX and 'ca-' or 'c-'] = { utils.shrink, 10 }
+if not NCURSES then
+ keys[not OSX and 'can' or 'ca\t'] = { gui.goto_view, 1, true }
+ keys[not OSX and 'cap' or 'cas\t'] = { gui.goto_view, -1, true }
+ keys[not OSX and 'cas' or 'cs'] = { view.split, view }
+ if not OSX then keys.cah = keys.cas end
+ keys[not OSX and 'cav' or 'cv'] = { view.split, view, true }
+ keys[not OSX and 'caw' or 'cw'] = { view.unsplit, view }
+ keys[not OSX and 'caW' or 'cW'] = utils.unsplit_all
+ keys[not OSX and 'ca+' or 'c+'] = { utils.grow, 10 }
+ keys[not OSX and 'ca=' or 'c='] = { utils.grow, 10 }
+ keys[not OSX and 'ca-' or 'c-'] = { utils.shrink, 10 }
+end
-- TODO: utils.toggle_current_fold
-keys[not OSX and 'ca\n' or 'c\n'] = { utils.toggle_property, 'view_eol' }
-if not OSX then keys['ca\n\r'] = keys['ca\n'] end
-keys[not OSX and 'ca\\' or 'c\\'] = { utils.toggle_property, 'wrap_mode' }
-keys[not OSX and 'caI' or 'cI'] =
- { utils.toggle_property, 'indentation_guides' }
-keys[not OSX and 'caS' or 'cS'] = { utils.toggle_property, 'view_ws' }
-keys[not OSX and 'caV' or 'cV'] =
- { utils.toggle_property, 'virtual_space_options', c.SCVS_USERACCESSIBLE }
-keys[not OSX and 'c=' or 'm='] = buffer.zoom_in
-keys[not OSX and 'c-' or 'm-'] = buffer.zoom_out
-keys[not OSX and 'c0' or 'm0'] = utils.reset_zoom
-keys[not OSX and 'cT' or 'mT'] = gui.select_theme
+if not NCURSES then
+ keys[not OSX and 'ca\n' or 'c\n'] = { utils.toggle_property, 'view_eol' }
+ if not OSX then keys['ca\n\r'] = keys['ca\n'] end
+ keys[not OSX and 'ca\\' or 'c\\'] = { utils.toggle_property, 'wrap_mode' }
+ keys[not OSX and 'caI' or 'cI'] =
+ { utils.toggle_property, 'indentation_guides' }
+ keys[not OSX and 'caS' or 'cS'] = { utils.toggle_property, 'view_ws' }
+ keys[not OSX and 'caV' or 'cV'] =
+ { utils.toggle_property, 'virtual_space_options', c.SCVS_USERACCESSIBLE }
+end
+keys[not OSX and not NCURSES and 'c=' or 'm='] = buffer.zoom_in
+keys[not OSX and not NCURSES and 'c-' or 'm-'] = buffer.zoom_out
+keys[not OSX and not NCURSES and 'c0' or 'm0'] = utils.reset_zoom
+if not NCURSES then keys[not OSX and 'cT' or 'mT'] = gui.select_theme end
-- Help.
-keys.f1 = { utils.open_webpage, _HOME..'/doc/01_Introduction.html' }
-keys.sf1 = { utils.open_webpage, _HOME..'/doc/api/index.html' }
+if not NCURSES then
+ keys.f1 = { utils.open_webpage, _HOME..'/doc/01_Introduction.html' }
+ keys.sf1 = { utils.open_webpage, _HOME..'/doc/api/index.html' }
+end
-- TODO: { gui.dialog, 'ok-msgbox', '--title', 'Textadept'
-- '--informative-text', _RELEASE, '--button1', _L['_OK'],
-- '--no-cancel' }
-- Movement commands.
-if OSX then
+if OSX or NCURSES then
keys.ck = function()
_G.buffer:line_end_extend()
_G.buffer:cut()
end
keys.cf = buffer.char_right
- keys.cF = buffer.char_right_extend
- keys.cmf = buffer.word_right
- keys.cmF = buffer.word_right_extend
keys.cb = buffer.char_left
- keys.cB = buffer.char_left_extend
- keys.cmb = buffer.word_left
- keys.cmB = buffer.word_left_extend
keys.cn = buffer.line_down
- keys.cN = buffer.line_down_extend
keys.cp = buffer.line_up
- keys.cP = buffer.line_up_extend
keys.ca = buffer.vc_home
- keys.cA = buffer.vc_home_extend
keys.ce = buffer.line_end
- keys.cE = buffer.line_end_extend
+ keys[OSX and 'cA' or 'mA'] = buffer.vc_home_extend
+ keys[OSX and 'cE' or 'mE'] = buffer.line_end_extend
keys.cd = buffer.clear
- keys.cl = buffer.vertical_centre_caret
- keys.aright = buffer.word_right
- keys.aleft = buffer.word_left
+ if OSX then
+ keys.cF = buffer.char_right_extend
+ keys.cmf = buffer.word_right
+ keys.cmF = buffer.word_right_extend
+ keys.cB = buffer.char_left_extend
+ keys.cmb = buffer.word_left
+ keys.cmB = buffer.word_left_extend
+ keys.cN = buffer.line_down_extend
+ keys.cP = buffer.line_up_extend
+ keys.cl = buffer.vertical_centre_caret
+ keys.aright = buffer.word_right
+ keys.aleft = buffer.word_left
+ else
+ keys.md = utils.delete_word
+ keys.cma = buffer.document_start
+ keys.cme = buffer.document_end
+ keys.mU = buffer.page_up_extend
+ keys.mD = buffer.page_down_extend
+ end
end
return M
diff --git a/modules/textadept/menu.lua b/modules/textadept/menu.lua
index 1bdcbd41..675428b4 100644
--- a/modules/textadept/menu.lua
+++ b/modules/textadept/menu.lua
@@ -325,7 +325,11 @@ local columns = { _L['Command'], _L['Key Command'] }
-- Prompts the user with a filteredlist to run menu commands.
-- @name select_command
function M.select_command()
- local i = gui.filteredlist(_L['Run Command'], columns, items, true)
+ local i = gui.filteredlist(_L['Run Command'], columns, items, true,
+ NCURSES and {
+ '--width', gui.size[1] - 2,
+ '--height', gui.size[2] - 2,
+ } or '')
if i then keys.run_command(commands[i + 1], type(commands[i + 1])) end
end
diff --git a/src/textadept.c b/src/textadept.c
index 351756bb..fe87a735 100644
--- a/src/textadept.c
+++ b/src/textadept.c
@@ -2235,29 +2235,28 @@ int main(int argc, char **argv) {
gtk_main();
#endif
#elif NCURSES
- // Ignore some termios (from GNU Nano) and signals.
+ // Ignore some termios (from GNU Nano).
struct termios term;
tcgetattr(0, &term);
term.c_iflag &= ~IEXTEN, term.c_iflag &= ~IXON;
term.c_oflag &= ~OPOST;
term.c_lflag &= ~ISIG;
tcsetattr(0, TCSANOW, &term);
- struct sigaction ignore;
- memset(&ignore, 0, sizeof(struct sigaction)), ignore.sa_handler = SIG_IGN;
- /*sigaction(SIGINT, &ignore, NULL),*/ sigaction(SIGTSTP, &ignore, NULL);
TermKeyResult res;
TermKeyKey key;
int keysyms[] = {
- 0, SCK_BACK, SCK_TAB, SCK_RETURN, SCK_ESCAPE, 0, 0, SCK_UP, SCK_DOWN,
- SCK_LEFT, SCK_RIGHT, 0, 0, SCK_INSERT, SCK_DELETE, 0, SCK_PRIOR, SCK_NEXT,
- SCK_HOME, SCK_END
- };
+ 0, SCK_BACK, SCK_TAB, SCK_RETURN, 0xFF1B /* GDK esc */, 0, 0, SCK_UP,
+ SCK_DOWN, SCK_LEFT, SCK_RIGHT, 0, 0, SCK_INSERT, SCK_DELETE, 0, SCK_PRIOR,
+ SCK_NEXT, SCK_HOME, SCK_END
+ }; // note: use GDK keysym value for esc for now
int c = 0;
while ((res = termkey_waitkey(tk, &key)) != TERMKEY_RES_EOF) {
if (res == TERMKEY_RES_ERROR) continue;
if (key.type == TERMKEY_TYPE_UNICODE)
c = key.code.codepoint;
+ else if (key.type == TERMKEY_TYPE_FUNCTION)
+ c = 0xFFBD + key.code.number; // use GDK keysym values for now
else if (key.type == TERMKEY_TYPE_KEYSYM &&
key.code.sym >= 0 && key.code.sym <= TERMKEY_SYM_END)
c = keysyms[key.code.sym];