diff --git a/src/buffer.go b/src/buffer.go index fa32a631..fb4d6c3d 100644 --- a/src/buffer.go +++ b/src/buffer.go @@ -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 diff --git a/src/command.go b/src/command.go index 7acfcb57..7fcf41d6 100644 --- a/src/command.go +++ b/src/command.go @@ -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) } } diff --git a/src/view.go b/src/view.go index beef181f..351f37ad 100644 --- a/src/view.go +++ b/src/view.go @@ -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--