]> git.lizzy.rs Git - micro.git/blobdiff - cmd/micro/command.go
Use the new and updated version of tcell
[micro.git] / cmd / micro / command.go
index e54b044142cae85240e30a9d0b89a0309e90e5aa..1e41a7b25b636ad857391140800f479ccdb8f838 100644 (file)
@@ -103,7 +103,7 @@ func HandleCommand(input string, view *View) {
                        os.Exit(0)
                }
        case "save":
-               Save(view)
+               view.Save()
        case "replace":
                r := regexp.MustCompile(`"[^"\\]*(?:\\.[^"\\]*)*"|[^\s]*`)
                replaceCmd := r.FindAllString(strings.Join(args, " "), -1)
@@ -141,7 +141,7 @@ func HandleCommand(input string, view *View) {
 
                found := false
                for {
-                       match := regex.FindStringIndex(view.buf.text)
+                       match := regex.FindStringIndex(view.Buf.String())
                        if match == nil {
                                break
                        }
@@ -153,23 +153,23 @@ func HandleCommand(input string, view *View) {
                                Redraw(view)
                                choice, canceled := messenger.YesNoPrompt("Perform replacement? (y,n)")
                                if canceled {
-                                       if view.cursor.HasSelection() {
-                                               view.cursor.SetLoc(view.cursor.curSelection[0])
-                                               view.cursor.ResetSelection()
+                                       if view.Cursor.HasSelection() {
+                                               view.Cursor.SetLoc(view.Cursor.curSelection[0])
+                                               view.Cursor.ResetSelection()
                                        }
                                        messenger.Reset()
                                        return
                                }
                                if choice {
-                                       view.cursor.DeleteSelection()
+                                       view.Cursor.DeleteSelection()
                                        view.eh.Insert(match[0], replace)
-                                       view.cursor.ResetSelection()
+                                       view.Cursor.ResetSelection()
                                        messenger.Reset()
                                } else {
-                                       if view.cursor.HasSelection() {
-                                               searchStart = view.cursor.curSelection[1]
+                                       if view.Cursor.HasSelection() {
+                                               searchStart = view.Cursor.curSelection[1]
                                        } else {
-                                               searchStart = ToCharPos(view.cursor.x, view.cursor.y, view.buf)
+                                               searchStart = ToCharPos(view.Cursor.x, view.Cursor.y, view.Buf)
                                        }
                                        continue
                                }