]> git.lizzy.rs Git - micro.git/blobdiff - internal/action/bufpane.go
Filename completion for all non-command prompts
[micro.git] / internal / action / bufpane.go
index d2bd87e1359030efc8fc48f12cfb4a56b22c4e96..d63f0a2056a8a6c06c303121cc1dfc35a27adcb0 100644 (file)
@@ -113,6 +113,9 @@ func BufMapKey(k Event, action string) {
                success := true
                for i, a := range actionfns {
                        for j, c := range cursors {
+                               if c == nil {
+                                       continue
+                               }
                                h.Buf.SetCurCursor(c.Num)
                                h.Cursor = c
                                if i == 0 || (success && types[i-1] == '&') || (!success && types[i-1] == '|') || (types[i-1] == ',') {
@@ -272,8 +275,11 @@ func (h *BufPane) Name() string {
 
 // HandleEvent executes the tcell event properly
 func (h *BufPane) HandleEvent(event tcell.Event) {
-       if h.Buf.ExternallyModified() {
-               InfoBar.YNPrompt("The file on disk has changed. Reload file? (y,n)", func(yes, canceled bool) {
+       if h.Buf.ExternallyModified() && !h.Buf.ReloadDisabled {
+               InfoBar.YNPrompt("The file on disk has changed. Reload file? (y,n,esc)", func(yes, canceled bool) {
+                       if canceled {
+                               h.Buf.DisableReload()
+                       }
                        if !yes || canceled {
                                h.Buf.UpdateModTime()
                        } else {
@@ -452,6 +458,7 @@ func (h *BufPane) DoRuneInsert(r rune) {
                if recording_macro {
                        curmacro = append(curmacro, r)
                }
+               h.Relocate()
                h.PluginCBRune("onRune", r)
        }
 }
@@ -556,6 +563,7 @@ var BufKeyActions = map[string]BufKeyAction{
        "Autocomplete":           (*BufPane).Autocomplete,
        "CycleAutocompleteBack":  (*BufPane).CycleAutocompleteBack,
        "OutdentLine":            (*BufPane).OutdentLine,
+       "IndentLine":             (*BufPane).IndentLine,
        "Paste":                  (*BufPane).Paste,
        "PastePrimary":           (*BufPane).PastePrimary,
        "SelectAll":              (*BufPane).SelectAll,
@@ -573,6 +581,7 @@ var BufKeyActions = map[string]BufKeyAction{
        "EndOfLine":              (*BufPane).EndOfLine,
        "ToggleHelp":             (*BufPane).ToggleHelp,
        "ToggleKeyMenu":          (*BufPane).ToggleKeyMenu,
+       "ToggleDiffGutter":       (*BufPane).ToggleDiffGutter,
        "ToggleRuler":            (*BufPane).ToggleRuler,
        "ClearStatus":            (*BufPane).ClearStatus,
        "ShellMode":              (*BufPane).ShellMode,
@@ -595,6 +604,8 @@ var BufKeyActions = map[string]BufKeyAction{
        "ScrollUp":               (*BufPane).ScrollUpAction,
        "ScrollDown":             (*BufPane).ScrollDownAction,
        "SpawnMultiCursor":       (*BufPane).SpawnMultiCursor,
+       "SpawnMultiCursorUp":     (*BufPane).SpawnMultiCursorUp,
+       "SpawnMultiCursorDown":   (*BufPane).SpawnMultiCursorDown,
        "SpawnMultiCursorSelect": (*BufPane).SpawnMultiCursorSelect,
        "RemoveMultiCursor":      (*BufPane).RemoveMultiCursor,
        "RemoveAllMultiCursors":  (*BufPane).RemoveAllMultiCursors,
@@ -639,6 +650,7 @@ var MultiActions = map[string]bool{
        "DeleteWordLeft":      true,
        "SelectLine":          true,
        "SelectToStartOfLine": true,
+       "SelectToStartOfText": true,
        "SelectToEndOfLine":   true,
        "ParagraphPrevious":   true,
        "ParagraphNext":       true,
@@ -657,11 +669,13 @@ var MultiActions = map[string]bool{
        "IndentSelection":     true,
        "OutdentSelection":    true,
        "OutdentLine":         true,
+       "IndentLine":          true,
        "Paste":               true,
        "PastePrimary":        true,
        "SelectPageUp":        true,
        "SelectPageDown":      true,
        "StartOfLine":         true,
+       "StartOfText":         true,
        "EndOfLine":           true,
        "JumpToMatchingBrace": true,
 }