]> git.lizzy.rs Git - micro.git/commitdiff
Use current view for every action
authorZachary Yedidia <zyedidia@gmail.com>
Fri, 2 Feb 2018 17:33:13 +0000 (12:33 -0500)
committerZachary Yedidia <zyedidia@gmail.com>
Fri, 2 Feb 2018 17:33:13 +0000 (12:33 -0500)
Fixes #1015

cmd/micro/view.go

index 09e8b05e4f61c325d4dd3945120b2075e1147b10..36dca76ae1065455d52a2ef681e1ee833e3a0d56 100644 (file)
@@ -525,7 +525,8 @@ func (v *View) ExecuteActions(actions []func(*View, bool) bool) bool {
        for _, action := range actions {
                readonlyBindingsResult := false
                funcName := ShortFuncName(action)
-               if v.Type.Readonly == true {
+               curv := CurView()
+               if curv.Type.Readonly == true {
                        // check for readonly and if true only let key bindings get called if they do not change the contents.
                        for _, readonlyBindings := range readonlyBindingsList {
                                if strings.Contains(funcName, readonlyBindings) {
@@ -535,7 +536,7 @@ func (v *View) ExecuteActions(actions []func(*View, bool) bool) bool {
                }
                if !readonlyBindingsResult {
                        // call the key binding
-                       relocate = action(v, true) || relocate
+                       relocate = action(curv, true) || relocate
                        // Macro
                        if funcName != "ToggleMacro" && funcName != "PlayMacro" {
                                if recordingMacro {