mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-29 22:27:13 +09:00
Fix problems recognizing CtrlH
Fixes #368 The 'Backspace2' key has been renamed to 'Backspace'.
This commit is contained in:
@@ -205,12 +205,11 @@ var bindingKeys = map[string]tcell.Key{
|
|||||||
"CtrlRightSq": tcell.KeyCtrlRightSq,
|
"CtrlRightSq": tcell.KeyCtrlRightSq,
|
||||||
"CtrlCarat": tcell.KeyCtrlCarat,
|
"CtrlCarat": tcell.KeyCtrlCarat,
|
||||||
"CtrlUnderscore": tcell.KeyCtrlUnderscore,
|
"CtrlUnderscore": tcell.KeyCtrlUnderscore,
|
||||||
"Backspace": tcell.KeyBackspace,
|
|
||||||
"Tab": tcell.KeyTab,
|
"Tab": tcell.KeyTab,
|
||||||
"Esc": tcell.KeyEsc,
|
"Esc": tcell.KeyEsc,
|
||||||
"Escape": tcell.KeyEscape,
|
"Escape": tcell.KeyEscape,
|
||||||
"Enter": tcell.KeyEnter,
|
"Enter": tcell.KeyEnter,
|
||||||
"Backspace2": tcell.KeyBackspace2,
|
"Backspace": tcell.KeyBackspace2,
|
||||||
|
|
||||||
// I renamed these keys to PageUp and PageDown but I don't want to break someone's keybindings
|
// I renamed these keys to PageUp and PageDown but I don't want to break someone's keybindings
|
||||||
"PgUp": tcell.KeyPgUp,
|
"PgUp": tcell.KeyPgUp,
|
||||||
@@ -267,7 +266,8 @@ modSearch:
|
|||||||
case strings.HasPrefix(k, "-"):
|
case strings.HasPrefix(k, "-"):
|
||||||
// We optionally support dashes between modifiers
|
// We optionally support dashes between modifiers
|
||||||
k = k[1:]
|
k = k[1:]
|
||||||
case strings.HasPrefix(k, "Ctrl"):
|
case strings.HasPrefix(k, "Ctrl") && !k == "CtrlH":
|
||||||
|
// CtrlH technically does not have a 'Ctrl' modifier because it is really backspace
|
||||||
k = k[4:]
|
k = k[4:]
|
||||||
modifiers |= tcell.ModCtrl
|
modifiers |= tcell.ModCtrl
|
||||||
case strings.HasPrefix(k, "Alt"):
|
case strings.HasPrefix(k, "Alt"):
|
||||||
@@ -373,10 +373,10 @@ func DefaultBindings() map[string]string {
|
|||||||
"CtrlShiftDown": "SelectToEnd",
|
"CtrlShiftDown": "SelectToEnd",
|
||||||
"Enter": "InsertNewline",
|
"Enter": "InsertNewline",
|
||||||
"Space": "InsertSpace",
|
"Space": "InsertSpace",
|
||||||
|
"CtrlH": "Backspace",
|
||||||
"Backspace": "Backspace",
|
"Backspace": "Backspace",
|
||||||
"Backspace2": "Backspace",
|
"Alt-CtrlH": "DeleteWordLeft",
|
||||||
"Alt-Backspace": "DeleteWordLeft",
|
"Alt-Backspace": "DeleteWordLeft",
|
||||||
"Alt-Backspace2": "DeleteWordLeft",
|
|
||||||
"Tab": "IndentSelection,InsertTab",
|
"Tab": "IndentSelection,InsertTab",
|
||||||
"Backtab": "OutdentSelection",
|
"Backtab": "OutdentSelection",
|
||||||
"CtrlO": "OpenFile",
|
"CtrlO": "OpenFile",
|
||||||
@@ -421,11 +421,11 @@ func DefaultBindings() map[string]string {
|
|||||||
"Alt-n": "CursorDown",
|
"Alt-n": "CursorDown",
|
||||||
|
|
||||||
// Integration with file managers
|
// Integration with file managers
|
||||||
"F1": "ToggleHelp",
|
"F1": "ToggleHelp",
|
||||||
"F2": "Save",
|
"F2": "Save",
|
||||||
"F4": "Quit",
|
"F4": "Quit",
|
||||||
"F7": "Find",
|
"F7": "Find",
|
||||||
"F10": "Quit",
|
"F10": "Quit",
|
||||||
"Esc": "Quit",
|
"Esc": "Quit",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -364,6 +364,7 @@ func (v *View) HandleEvent(event tcell.Event) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,82 +5,82 @@ you can rebind them to your liking.
|
|||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"Up": "CursorUp",
|
"Up": "CursorUp",
|
||||||
"Down": "CursorDown",
|
"Down": "CursorDown",
|
||||||
"Right": "CursorRight",
|
"Right": "CursorRight",
|
||||||
"Left": "CursorLeft",
|
"Left": "CursorLeft",
|
||||||
"ShiftUp": "SelectUp",
|
"ShiftUp": "SelectUp",
|
||||||
"ShiftDown": "SelectDown",
|
"ShiftDown": "SelectDown",
|
||||||
"ShiftLeft": "SelectLeft",
|
"ShiftLeft": "SelectLeft",
|
||||||
"ShiftRight": "SelectRight",
|
"ShiftRight": "SelectRight",
|
||||||
"AltLeft": "WordLeft",
|
"AltLeft": "WordLeft",
|
||||||
"AltRight": "WordRight",
|
"AltRight": "WordRight",
|
||||||
"AltShiftRight": "SelectWordRight",
|
"AltShiftRight": "SelectWordRight",
|
||||||
"AltShiftLeft": "SelectWordLeft",
|
"AltShiftLeft": "SelectWordLeft",
|
||||||
"CtrlLeft": "StartOfLine",
|
"CtrlLeft": "StartOfLine",
|
||||||
"CtrlRight": "EndOfLine",
|
"CtrlRight": "EndOfLine",
|
||||||
"CtrlShiftLeft": "SelectToStartOfLine",
|
"CtrlShiftLeft": "SelectToStartOfLine",
|
||||||
"CtrlShiftRight": "SelectToEndOfLine",
|
"CtrlShiftRight": "SelectToEndOfLine",
|
||||||
"CtrlUp": "CursorStart",
|
"CtrlUp": "CursorStart",
|
||||||
"CtrlDown": "CursorEnd",
|
"CtrlDown": "CursorEnd",
|
||||||
"CtrlShiftUp": "SelectToStart",
|
"CtrlShiftUp": "SelectToStart",
|
||||||
"CtrlShiftDown": "SelectToEnd",
|
"CtrlShiftDown": "SelectToEnd",
|
||||||
"Enter": "InsertEnter",
|
"Enter": "InsertNewline",
|
||||||
"Space": "InsertSpace",
|
"Space": "InsertSpace",
|
||||||
"Backspace": "Backspace",
|
"CtrlH": "Backspace",
|
||||||
"Backspace2": "Backspace",
|
"Backspace": "Backspace",
|
||||||
"Alt-Backspace": "DeleteWordLeft",
|
"Alt-CtrlH": "DeleteWordLeft",
|
||||||
"Alt-Backspace2": "DeleteWordLeft",
|
"Alt-Backspace": "DeleteWordLeft",
|
||||||
"Tab": "InsertTab,IndentSelection",
|
"Tab": "IndentSelection,InsertTab",
|
||||||
"CtrlO": "OpenFile",
|
"Backtab": "OutdentSelection",
|
||||||
"CtrlS": "Save",
|
"CtrlO": "OpenFile",
|
||||||
"CtrlF": "Find",
|
"CtrlS": "Save",
|
||||||
"CtrlN": "FindNext",
|
"CtrlF": "Find",
|
||||||
"CtrlP": "FindPrevious",
|
"CtrlN": "FindNext",
|
||||||
"CtrlZ": "Undo",
|
"CtrlP": "FindPrevious",
|
||||||
"CtrlY": "Redo",
|
"CtrlZ": "Undo",
|
||||||
"CtrlC": "Copy",
|
"CtrlY": "Redo",
|
||||||
"CtrlX": "Cut",
|
"CtrlC": "Copy",
|
||||||
"CtrlK": "CutLine",
|
"CtrlX": "Cut",
|
||||||
"CtrlD": "DuplicateLine",
|
"CtrlK": "CutLine",
|
||||||
"CtrlV": "Paste",
|
"CtrlD": "DuplicateLine",
|
||||||
"CtrlA": "SelectAll",
|
"CtrlV": "Paste",
|
||||||
"CtrlT": "AddTab",
|
"CtrlA": "SelectAll",
|
||||||
"CtrlRightSq": "PreviousTab",
|
"CtrlT": "AddTab",
|
||||||
"CtrlBackslash": "NextTab",
|
"CtrlRightSq": "PreviousTab",
|
||||||
"Home": "Start",
|
"CtrlBackslash": "NextTab",
|
||||||
"End": "End",
|
"Home": "StartOfLine",
|
||||||
"CtrlHome": "CursorStart",
|
"End": "EndOfLine",
|
||||||
"CtrlEnd": "CursorEnd",
|
"CtrlHome": "CursorStart",
|
||||||
"PageUp": "CursorPageUp",
|
"CtrlEnd": "CursorEnd",
|
||||||
"PageDown": "CursorPageDown",
|
"PageUp": "CursorPageUp",
|
||||||
"CtrlG": "ToggleHelp",
|
"PageDown": "CursorPageDown",
|
||||||
"CtrlR": "ToggleRuler",
|
"CtrlG": "ToggleHelp",
|
||||||
"CtrlL": "JumpLine",
|
"CtrlR": "ToggleRuler",
|
||||||
"Delete": "Delete",
|
"CtrlL": "JumpLine",
|
||||||
"Esc": "ClearStatus",
|
"Delete": "Delete",
|
||||||
"CtrlB": "ShellMode",
|
"CtrlB": "ShellMode",
|
||||||
"CtrlQ": "Quit",
|
"CtrlQ": "Quit",
|
||||||
"CtrlE": "CommandMode",
|
"CtrlE": "CommandMode",
|
||||||
"CtrlW": "NextSplit",
|
"CtrlW": "NextSplit",
|
||||||
"CtrlU": "ToggleMacro",
|
"CtrlU": "ToggleMacro",
|
||||||
"CtrlJ": "PlayMacro",
|
"CtrlJ": "PlayMacro",
|
||||||
|
|
||||||
// Emacs-style keybindings
|
|
||||||
"Alt-f": "WordRight",
|
|
||||||
"Alt-b": "WordLeft",
|
|
||||||
"Alt-a": "StartOfLine",
|
|
||||||
"Alt-e": "EndOfLine",
|
|
||||||
"Alt-p": "CursorUp",
|
|
||||||
"Alt-n": "CursorDown",
|
|
||||||
|
|
||||||
// Integration with file managers
|
// Emacs-style keybindings
|
||||||
"F1": "ToggleHelp",
|
"Alt-f": "WordRight",
|
||||||
"F2": "Save",
|
"Alt-b": "WordLeft",
|
||||||
"F4": "Quit",
|
"Alt-a": "StartOfLine",
|
||||||
"F7": "Find",
|
"Alt-e": "EndOfLine",
|
||||||
"F10": "Quit",
|
"Alt-p": "CursorUp",
|
||||||
"Esc": "Quit",
|
"Alt-n": "CursorDown",
|
||||||
|
|
||||||
|
// Integration with file managers
|
||||||
|
"F1": "ToggleHelp",
|
||||||
|
"F2": "Save",
|
||||||
|
"F4": "Quit",
|
||||||
|
"F7": "Find",
|
||||||
|
"F10": "Quit",
|
||||||
|
"Esc": "Quit",
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -318,9 +318,11 @@ Tab
|
|||||||
Esc
|
Esc
|
||||||
Escape
|
Escape
|
||||||
Enter
|
Enter
|
||||||
Backspace2
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Note: On some old terminal emulators and on Windows machines, `CtrlH` should be used
|
||||||
|
for backspace.
|
||||||
|
|
||||||
Additionally, alt keys can be bound by using `Alt-key`. For example `Alt-a`
|
Additionally, alt keys can be bound by using `Alt-key`. For example `Alt-a`
|
||||||
or `Alt-Up`. Micro supports an optional `-` between modifiers like `Alt` and `Ctrl`
|
or `Alt-Up`. Micro supports an optional `-` between modifiers like `Alt` and `Ctrl`
|
||||||
so `Alt-a` could be rewritten as `Alta` (case matters for alt bindings). This is
|
so `Alt-a` could be rewritten as `Alta` (case matters for alt bindings). This is
|
||||||
|
|||||||
Reference in New Issue
Block a user