]> git.lizzy.rs Git - micro.git/commitdiff
Minor bug fixes
authorZachary Yedidia <zyedidia@gmail.com>
Mon, 4 Apr 2016 22:05:34 +0000 (18:05 -0400)
committerZachary Yedidia <zyedidia@gmail.com>
Mon, 4 Apr 2016 22:05:34 +0000 (18:05 -0400)
src/buffer.go
src/command.go
src/view.go

index fa32a6313205502588f38ae0577bb681349d69b3..fb4d6c3df10e247ba9f897dba2c6fc0a9e4b7c53 100644 (file)
@@ -75,6 +75,7 @@ func (b *Buffer) Save() error {
 
 // SaveAs saves the buffer to a specified path (filename), creating the file if it does not exist
 func (b *Buffer) SaveAs(filename string) error {
+       b.UpdateRules()
        err := ioutil.WriteFile(filename, []byte(b.text), 0644)
        if err == nil {
                b.savedText = b.text
index 7acfcb57c6f2b203bb7068c68687cd6f6572d96f..7fcf41d6501bcec532c5903fd7c794a6c1ff8cf7 100644 (file)
@@ -11,7 +11,7 @@ func HandleCommand(input string, view *View) {
        inputCmd := strings.Split(input, " ")[0]
        args := strings.Split(input, " ")[1:]
 
-       commands := []string{"set", "quit", "save"}
+       commands := []string{"set", "quit", "save", "replace"}
 
        i := 0
        cmd := inputCmd
@@ -92,6 +92,6 @@ func HandleCommand(input string, view *View) {
                        messenger.Message("Nothing matched " + search)
                }
        default:
-               messenger.Error("Unknown command: " + cmd)
+               messenger.Error("Unknown command: " + inputCmd)
        }
 }
index beef181feb84e96a9b934192e1efd3462176283f..351f37ad25658867ef4b16f00576938e058f89ca 100644 (file)
@@ -453,7 +453,7 @@ func (v *View) HandleEvent(event tcell.Event) {
                }
        case *tcell.EventMouse:
                x, y := e.Position()
-               x -= v.lineNumOffset + v.leftCol
+               x -= v.lineNumOffset - v.leftCol
                y += v.topline
                // Position always seems to be off by one
                x--