summary refs log tree commit diff stats
path: root/ranger.py
blob: 240b368727f378e3d9ab95c548b845746b90dd71 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/python -O
# -*- coding: utf-8 -*-
#
# Ranger: Explore your forest of files from inside your terminal
# Copyright (C) 2009, 2010  Roman Zimbelmann <romanz@lavabit.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

# Embed a script which allows you to change the directory of the parent shell
# after you exit ranger.  Run it with the command: source ranger ranger
"""":
if [ ! -z "$1" ]; then
	$@ --fail-unless-cd &&
	if [ -z "$XDG_CONFIG_HOME" ]; then
		cd "$(grep \^\' ~/.config/ranger/bookmarks | cut -b3-)"
	else
		cd "$(grep \^\' "$XDG_CONFIG_HOME"/ranger/bookmarks | cut -b3-)"
	fi && return 0
else
	echo "usage: source path/to/ranger.py path/to/ranger.py"
fi
return 1
"""

import sys

# When using the --clean option, not even bytecode should be written.
# Thus, we need to find out if --clean is used as soon as possible.
try:
	argv = sys.argv[0:sys.argv.index('--')]
except:
	argv = sys.argv
sys.dont_write_bytecode = '-c' in argv or '--clean' in argv

# Set the actual docstring
__doc__ = """Ranger - file browser for the unix terminal"""

# Start ranger
import ranger
sys.exit(ranger.main())
a> 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415
me the previous revision' href='/akspecs/aerc/blame/config/bindings.go?id=7a6c808c042bf6f662e6d6b6dba09829a1f9ed15'>^

8d20e92 ^





















24dfc47 ^
7a6c808 ^


1a75906 ^
7a6c808 ^
1a75906 ^
7a6c808 ^
1a75906 ^
7a6c808 ^
1a75906 ^
7a6c808 ^
1a75906 ^
7a6c808 ^





1a75906 ^
7a6c808 ^
1a75906 ^
7a6c808 ^











































































































































8d20e92 ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322








                 
                                     


                       
                               

                           






                          







                                                               









                                    
                            
                                                                      

                              

 









                                                                        

                                                    
                                                              







                                                                        
                                                   



                                                    


                                                                           





                                                                      
















                                                            
                                     

























                                                                                      
                                                              
                                
                                                                                




                                                                       
                                                         

                                                         





















                                                           
                                             


                                                                            
                                                                         
                                                                 
                                                                   
                                                                     
                                                                       
                                                                       
                                                                         
                                                                     
                                                                       





                                                                               
                                                                       
                                                                     
                                                                       











































































































































                                                                                                 
 
package config

import (
	"bytes"
	"errors"
	"fmt"
	"io"
	"strings"

	"github.com/gdamore/tcell/v2"
)

type KeyStroke struct {
	Modifiers tcell.ModMask
	Key       tcell.Key
	Rune      rune
}

type Binding struct {
	Output []KeyStroke
	Input  []KeyStroke
}

type KeyBindings struct {
	bindings []*Binding

	// If false, disable global keybindings in this context
	Globals bool
	// Which key opens the ex line (default is :)
	ExKey KeyStroke
}

const (
	BINDING_FOUND = iota
	BINDING_INCOMPLETE
	BINDING_NOT_FOUND
)

type BindingSearchResult int

func NewKeyBindings() *KeyBindings {
	return &KeyBindings{
		ExKey:   KeyStroke{tcell.ModNone, tcell.KeyRune, ':'},
		Globals: true,
	}
}

func MergeBindings(bindings ...*KeyBindings) *KeyBindings {
	merged := NewKeyBindings()
	for _, b := range bindings {
		merged.bindings = append(merged.bindings, b.bindings...)
	}
	merged.ExKey = bindings[0].ExKey
	merged.Globals = bindings[0].Globals
	return merged
}

func (bindings *KeyBindings) Add(binding *Binding) {
	// TODO: Search for conflicts?
	bindings.bindings = append(bindings.bindings, binding)
}

func (bindings *KeyBindings) GetBinding(
	input []KeyStroke) (BindingSearchResult, []KeyStroke) {

	incomplete := false
	// TODO: This could probably be a sorted list to speed things up
	// TODO: Deal with bindings that share a prefix
	for _, binding := range bindings.bindings {
		if len(binding.Input) < len(input) {
			continue
		}
		for i, stroke := range input {
			if stroke.Modifiers != binding.Input[i].Modifiers {
				goto next
			}
			if stroke.Key != binding.Input[i].Key {
				goto next
			}
			if stroke.Key == tcell.KeyRune &&
				stroke.Rune != binding.Input[i].Rune {

				goto next
			}
		}
		if len(binding.Input) != len(input) {
			incomplete = true
		} else {
			return BINDING_FOUND, binding.Output
		}
	next:
	}
	if incomplete {
		return BINDING_INCOMPLETE, nil
	}
	return BINDING_NOT_FOUND, nil
}

var (
	keyNames map[string]KeyStroke
)

func ParseKeyStrokes(keystrokes string) ([]KeyStroke, error) {
	var strokes []KeyStroke
	buf := bytes.NewBufferString(keystrokes)
	for {
		tok, _, err := buf.ReadRune()
		if err == io.EOF {
			break
		} else if err != nil {
			return nil, err
		}
		// TODO: make it possible to bind to < or > themselves (and default to
		// switching accounts)
		switch tok {
		case '<':
			name, err := buf.ReadString(byte('>'))
			if err == io.EOF {
				return nil, errors.New("Expecting '>'")
			} else if err != nil {
				return nil, err
			} else if name == ">" {
				return nil, errors.New("Expected a key name")
			}
			name = name[:len(name)-1]
			if key, ok := keyNames[strings.ToLower(name)]; ok {
				strokes = append(strokes, key)
			} else {
				return nil, fmt.Errorf("Unknown key '%s'", name)
			}
		case '>':
			return nil, errors.New("Found '>' without '<'")
		default:
			strokes = append(strokes, KeyStroke{
				Modifiers: tcell.ModNone,
				Key:       tcell.KeyRune,
				Rune:      tok,
			})
		}
	}
	return strokes, nil
}

func ParseBinding(input, output string) (*Binding, error) {
	in, err := ParseKeyStrokes(input)
	if err != nil {
		return nil, err
	}
	out, err := ParseKeyStrokes(output)
	if err != nil {
		return nil, err
	}
	return &Binding{
		Input:  in,
		Output: out,
	}, nil
}

func init() {
	keyNames = make(map[string]KeyStroke)
	keyNames["space"] = KeyStroke{tcell.ModNone, tcell.KeyRune, ' '}
	keyNames["semicolon"] = KeyStroke{tcell.ModNone, tcell.KeyRune, ';'}
	keyNames["enter"] = KeyStroke{tcell.ModNone, tcell.KeyEnter, 0}
	keyNames["c-enter"] = KeyStroke{tcell.ModCtrl, tcell.KeyEnter, 0}
	keyNames["up"] = KeyStroke{tcell.ModNone, tcell.KeyUp, 0}
	keyNames["c-up"] = KeyStroke{tcell.ModCtrl, tcell.KeyUp, 0}
	keyNames["down"] = KeyStroke{tcell.ModNone, tcell.KeyDown, 0}
	keyNames["c-down"] = KeyStroke{tcell.ModCtrl, tcell.KeyDown, 0}
	keyNames["right"] = KeyStroke{tcell.ModNone, tcell.KeyRight, 0}
	keyNames["c-right"] = KeyStroke{tcell.ModCtrl, tcell.KeyRight, 0}
	keyNames["left"] = KeyStroke{tcell.ModNone, tcell.KeyLeft, 0}
	keyNames["c-left"] = KeyStroke{tcell.ModCtrl, tcell.KeyLeft, 0}
	keyNames["upleft"] = KeyStroke{tcell.ModNone, tcell.KeyUpLeft, 0}
	keyNames["upright"] = KeyStroke{tcell.ModNone, tcell.KeyUpRight, 0}
	keyNames["downleft"] = KeyStroke{tcell.ModNone, tcell.KeyDownLeft, 0}
	keyNames["downright"] = KeyStroke{tcell.ModNone, tcell.KeyDownRight, 0}
	keyNames["center"] = KeyStroke{tcell.ModNone, tcell.KeyCenter, 0}
	keyNames["pgup"] = KeyStroke{tcell.ModNone, tcell.KeyPgUp, 0}
	keyNames["c-pgup"] = KeyStroke{tcell.ModCtrl, tcell.KeyPgUp, 0}
	keyNames["pgdn"] = KeyStroke{tcell.ModNone, tcell.KeyPgDn, 0}
	keyNames["c-pgdn"] = KeyStroke{tcell.ModCtrl, tcell.KeyPgDn, 0}
	keyNames["home"] = KeyStroke{tcell.ModNone, tcell.KeyHome, 0}
	keyNames["end"] = KeyStroke{tcell.ModNone, tcell.KeyEnd, 0}
	keyNames["insert"] = KeyStroke{tcell.ModNone, tcell.KeyInsert, 0}
	keyNames["delete"] = KeyStroke{tcell.ModNone, tcell.KeyDelete, 0}
	keyNames["help"] = KeyStroke{tcell.ModNone, tcell.KeyHelp, 0}
	keyNames["exit"] = KeyStroke{tcell.ModNone, tcell.KeyExit, 0}
	keyNames["clear"] = KeyStroke{tcell.ModNone, tcell.KeyClear, 0}
	keyNames["cancel"] = KeyStroke{tcell.ModNone, tcell.KeyCancel, 0}
	keyNames["print"] = KeyStroke{tcell.ModNone, tcell.KeyPrint, 0}
	keyNames["pause"] = KeyStroke{tcell.ModNone, tcell.KeyPause, 0}
	keyNames["backtab"] = KeyStroke{tcell.ModNone, tcell.KeyBacktab, 0}
	keyNames["f1"] = KeyStroke{tcell.ModNone, tcell.KeyF1, 0}
	keyNames["f2"] = KeyStroke{tcell.ModNone, tcell.KeyF2, 0}
	keyNames["f3"] = KeyStroke{tcell.ModNone, tcell.KeyF3, 0}
	keyNames["f4"] = KeyStroke{tcell.ModNone, tcell.KeyF4, 0}
	keyNames["f5"] = KeyStroke{tcell.ModNone, tcell.KeyF5, 0}
	keyNames["f6"] = KeyStroke{tcell.ModNone, tcell.KeyF6, 0}
	keyNames["f7"] = KeyStroke{tcell.ModNone, tcell.KeyF7, 0}
	keyNames["f8"] = KeyStroke{tcell.ModNone, tcell.KeyF8, 0}
	keyNames["f9"] = KeyStroke{tcell.ModNone, tcell.KeyF9, 0}
	keyNames["f10"] = KeyStroke{tcell.ModNone, tcell.KeyF10, 0}
	keyNames["f11"] = KeyStroke{tcell.ModNone, tcell.KeyF11, 0}
	keyNames["f12"] = KeyStroke{tcell.ModNone, tcell.KeyF12, 0}
	keyNames["f13"] = KeyStroke{tcell.ModNone, tcell.KeyF13, 0}
	keyNames["f14"] = KeyStroke{tcell.ModNone, tcell.KeyF14, 0}
	keyNames["f15"] = KeyStroke{tcell.ModNone, tcell.KeyF15, 0}
	keyNames["f16"] = KeyStroke{tcell.ModNone, tcell.KeyF16, 0}
	keyNames["f17"] = KeyStroke{tcell.ModNone, tcell.KeyF17, 0}
	keyNames["f18"] = KeyStroke{tcell.ModNone, tcell.KeyF18, 0}
	keyNames["f19"] = KeyStroke{tcell.ModNone, tcell.KeyF19, 0}
	keyNames["f20"] = KeyStroke{tcell.ModNone, tcell.KeyF20, 0}
	keyNames["f21"] = KeyStroke{tcell.ModNone, tcell.KeyF21, 0}
	keyNames["f22"] = KeyStroke{tcell.ModNone, tcell.KeyF22, 0}
	keyNames["f23"] = KeyStroke{tcell.ModNone, tcell.KeyF23, 0}
	keyNames["f24"] = KeyStroke{tcell.ModNone, tcell.KeyF24, 0}
	keyNames["f25"] = KeyStroke{tcell.ModNone, tcell.KeyF25, 0}
	keyNames["f26"] = KeyStroke{tcell.ModNone, tcell.KeyF26, 0}
	keyNames["f27"] = KeyStroke{tcell.ModNone, tcell.KeyF27, 0}
	keyNames["f28"] = KeyStroke{tcell.ModNone, tcell.KeyF28, 0}
	keyNames["f29"] = KeyStroke{tcell.ModNone, tcell.KeyF29, 0}
	keyNames["f30"] = KeyStroke{tcell.ModNone, tcell.KeyF30, 0}
	keyNames["f31"] = KeyStroke{tcell.ModNone, tcell.KeyF31, 0}
	keyNames["f32"] = KeyStroke{tcell.ModNone, tcell.KeyF32, 0}
	keyNames["f33"] = KeyStroke{tcell.ModNone, tcell.KeyF33, 0}
	keyNames["f34"] = KeyStroke{tcell.ModNone, tcell.KeyF34, 0}
	keyNames["f35"] = KeyStroke{tcell.ModNone, tcell.KeyF35, 0}
	keyNames["f36"] = KeyStroke{tcell.ModNone, tcell.KeyF36, 0}
	keyNames["f37"] = KeyStroke{tcell.ModNone, tcell.KeyF37, 0}
	keyNames["f38"] = KeyStroke{tcell.ModNone, tcell.KeyF38, 0}
	keyNames["f39"] = KeyStroke{tcell.ModNone, tcell.KeyF39, 0}
	keyNames["f40"] = KeyStroke{tcell.ModNone, tcell.KeyF40, 0}
	keyNames["f41"] = KeyStroke{tcell.ModNone, tcell.KeyF41, 0}
	keyNames["f42"] = KeyStroke{tcell.ModNone, tcell.KeyF42, 0}
	keyNames["f43"] = KeyStroke{tcell.ModNone, tcell.KeyF43, 0}
	keyNames["f44"] = KeyStroke{tcell.ModNone, tcell.KeyF44, 0}
	keyNames["f45"] = KeyStroke{tcell.ModNone, tcell.KeyF45, 0}
	keyNames["f46"] = KeyStroke{tcell.ModNone, tcell.KeyF46, 0}
	keyNames["f47"] = KeyStroke{tcell.ModNone, tcell.KeyF47, 0}
	keyNames["f48"] = KeyStroke{tcell.ModNone, tcell.KeyF48, 0}
	keyNames["f49"] = KeyStroke{tcell.ModNone, tcell.KeyF49, 0}
	keyNames["f50"] = KeyStroke{tcell.ModNone, tcell.KeyF50, 0}
	keyNames["f51"] = KeyStroke{tcell.ModNone, tcell.KeyF51, 0}
	keyNames["f52"] = KeyStroke{tcell.ModNone, tcell.KeyF52, 0}
	keyNames["f53"] = KeyStroke{tcell.ModNone, tcell.KeyF53, 0}
	keyNames["f54"] = KeyStroke{tcell.ModNone, tcell.KeyF54, 0}
	keyNames["f55"] = KeyStroke{tcell.ModNone, tcell.KeyF55, 0}
	keyNames["f56"] = KeyStroke{tcell.ModNone, tcell.KeyF56, 0}
	keyNames["f57"] = KeyStroke{tcell.ModNone, tcell.KeyF57, 0}
	keyNames["f58"] = KeyStroke{tcell.ModNone, tcell.KeyF58, 0}
	keyNames["f59"] = KeyStroke{tcell.ModNone, tcell.KeyF59, 0}
	keyNames["f60"] = KeyStroke{tcell.ModNone, tcell.KeyF60, 0}
	keyNames["f61"] = KeyStroke{tcell.ModNone, tcell.KeyF61, 0}
	keyNames["f62"] = KeyStroke{tcell.ModNone, tcell.KeyF62, 0}
	keyNames["f63"] = KeyStroke{tcell.ModNone, tcell.KeyF63, 0}
	keyNames["f64"] = KeyStroke{tcell.ModNone, tcell.KeyF64, 0}
	keyNames["c-space"] = KeyStroke{tcell.ModCtrl, tcell.KeyCtrlSpace, 0}
	keyNames["c-a"] = KeyStroke{tcell.ModCtrl, tcell.KeyCtrlA, 0}
	keyNames["c-b"] = KeyStroke{tcell.ModCtrl, tcell.KeyCtrlB, 0}
	keyNames["c-c"] = KeyStroke{tcell.ModCtrl, tcell.KeyCtrlC, 0}
	keyNames["c-d"] = KeyStroke{tcell.ModCtrl, tcell.KeyCtrlD, 0}
	keyNames["c-e"] = KeyStroke{tcell.ModCtrl, tcell.KeyCtrlE, 0}
	keyNames["c-f"] = KeyStroke{tcell.ModCtrl, tcell.KeyCtrlF, 0}
	keyNames["c-g"] = KeyStroke{tcell.ModCtrl, tcell.KeyCtrlG, 0}
	keyNames["c-h"] = KeyStroke{tcell.ModCtrl, tcell.KeyCtrlH, 0}
	keyNames["c-i"] = KeyStroke{tcell.ModCtrl, tcell.KeyCtrlI, 0}
	keyNames["c-j"] = KeyStroke{tcell.ModCtrl, tcell.KeyCtrlJ, 0}
	keyNames["c-k"] = KeyStroke{tcell.ModCtrl, tcell.KeyCtrlK, 0}
	keyNames["c-l"] = KeyStroke{tcell.ModCtrl, tcell.KeyCtrlL, 0}
	keyNames["c-m"] = KeyStroke{tcell.ModCtrl, tcell.KeyCtrlM, 0}
	keyNames["c-n"] = KeyStroke{tcell.ModCtrl, tcell.KeyCtrlN, 0}
	keyNames["c-o"] = KeyStroke{tcell.ModCtrl, tcell.KeyCtrlO, 0}
	keyNames["c-p"] = KeyStroke{tcell.ModCtrl, tcell.KeyCtrlP, 0}
	keyNames["c-q"] = KeyStroke{tcell.ModCtrl, tcell.KeyCtrlQ, 0}
	keyNames["c-r"] = KeyStroke{tcell.ModCtrl, tcell.KeyCtrlR, 0}
	keyNames["c-s"] = KeyStroke{tcell.ModCtrl, tcell.KeyCtrlS, 0}
	keyNames["c-t"] = KeyStroke{tcell.ModCtrl, tcell.KeyCtrlT, 0}
	keyNames["c-u"] = KeyStroke{tcell.ModCtrl, tcell.KeyCtrlU, 0}
	keyNames["c-v"] = KeyStroke{tcell.ModCtrl, tcell.KeyCtrlV, 0}
	keyNames["c-w"] = KeyStroke{tcell.ModCtrl, tcell.KeyCtrlW, 0}
	keyNames["c-x"] = KeyStroke{tcell.ModCtrl, tcell.KeyCtrlX, rune(tcell.KeyCAN)}
	keyNames["c-y"] = KeyStroke{tcell.ModCtrl, tcell.KeyCtrlY, 0} // TODO: runes for the rest
	keyNames["c-z"] = KeyStroke{tcell.ModCtrl, tcell.KeyCtrlZ, 0}
	keyNames["c-]"] = KeyStroke{tcell.ModCtrl, tcell.KeyCtrlLeftSq, 0}
	keyNames["c-\\"] = KeyStroke{tcell.ModCtrl, tcell.KeyCtrlBackslash, 0}
	keyNames["c-["] = KeyStroke{tcell.ModCtrl, tcell.KeyCtrlRightSq, 0}
	keyNames["c-^"] = KeyStroke{tcell.ModCtrl, tcell.KeyCtrlCarat, 0}
	keyNames["c-_"] = KeyStroke{tcell.ModCtrl, tcell.KeyCtrlUnderscore, 0}
	keyNames["nul"] = KeyStroke{tcell.ModNone, tcell.KeyNUL, 0}
	keyNames["soh"] = KeyStroke{tcell.ModNone, tcell.KeySOH, 0}
	keyNames["stx"] = KeyStroke{tcell.ModNone, tcell.KeySTX, 0}
	keyNames["etx"] = KeyStroke{tcell.ModNone, tcell.KeyETX, 0}
	keyNames["eot"] = KeyStroke{tcell.ModNone, tcell.KeyEOT, 0}
	keyNames["enq"] = KeyStroke{tcell.ModNone, tcell.KeyENQ, 0}
	keyNames["ack"] = KeyStroke{tcell.ModNone, tcell.KeyACK, 0}
	keyNames["bel"] = KeyStroke{tcell.ModNone, tcell.KeyBEL, 0}
	keyNames["bs"] = KeyStroke{tcell.ModNone, tcell.KeyBS, 0}
	keyNames["tab"] = KeyStroke{tcell.ModNone, tcell.KeyTAB, 0}
	keyNames["lf"] = KeyStroke{tcell.ModNone, tcell.KeyLF, 0}
	keyNames["vt"] = KeyStroke{tcell.ModNone, tcell.KeyVT, 0}
	keyNames["ff"] = KeyStroke{tcell.ModNone, tcell.KeyFF, 0}
	keyNames["cr"] = KeyStroke{tcell.ModNone, tcell.KeyCR, 0}
	keyNames["so"] = KeyStroke{tcell.ModNone, tcell.KeySO, 0}
	keyNames["si"] = KeyStroke{tcell.ModNone, tcell.KeySI, 0}
	keyNames["dle"] = KeyStroke{tcell.ModNone, tcell.KeyDLE, 0}
	keyNames["dc1"] = KeyStroke{tcell.ModNone, tcell.KeyDC1, 0}
	keyNames["dc2"] = KeyStroke{tcell.ModNone, tcell.KeyDC2, 0}
	keyNames["dc3"] = KeyStroke{tcell.ModNone, tcell.KeyDC3, 0}
	keyNames["dc4"] = KeyStroke{tcell.ModNone, tcell.KeyDC4, 0}
	keyNames["nak"] = KeyStroke{tcell.ModNone, tcell.KeyNAK, 0}
	keyNames["syn"] = KeyStroke{tcell.ModNone, tcell.KeySYN, 0}
	keyNames["etb"] = KeyStroke{tcell.ModNone, tcell.KeyETB, 0}
	keyNames["can"] = KeyStroke{tcell.ModNone, tcell.KeyCAN, 0}
	keyNames["em"] = KeyStroke{tcell.ModNone, tcell.KeyEM, 0}
	keyNames["sub"] = KeyStroke{tcell.ModNone, tcell.KeySUB, 0}
	keyNames["esc"] = KeyStroke{tcell.ModNone, tcell.KeyESC, 0}
	keyNames["fs"] = KeyStroke{tcell.ModNone, tcell.KeyFS, 0}
	keyNames["gs"] = KeyStroke{tcell.ModNone, tcell.KeyGS, 0}
	keyNames["rs"] = KeyStroke{tcell.ModNone, tcell.KeyRS, 0}
	keyNames["us"] = KeyStroke{tcell.ModNone, tcell.KeyUS, 0}
	keyNames["del"] = KeyStroke{tcell.ModNone, tcell.KeyDEL, 0}
}