Minor bug fixes

This commit is contained in:
Zachary Yedidia
2016-04-04 18:05:34 -04:00
parent e7a048ca02
commit eadfbf8469
3 changed files with 4 additions and 3 deletions

View 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

View 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)
}
}

View 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--