]> git.lizzy.rs Git - micro.git/commitdiff
Fix some formatting
authorZachary Yedidia <zyedidia@gmail.com>
Mon, 30 Dec 2019 03:02:14 +0000 (22:02 -0500)
committerZachary Yedidia <zyedidia@gmail.com>
Mon, 30 Dec 2019 03:02:14 +0000 (22:02 -0500)
internal/action/actions.go
internal/action/command.go
internal/action/infopane.go
internal/action/terminal_supported.go
internal/buffer/search.go
internal/display/bufwindow.go

index 85a62ddec0029cc1b6aac07646ca98079e950443..ed2ad367dae092f8f9f57bcc1e296da310153aea 100644 (file)
@@ -614,8 +614,6 @@ func (h *BufPane) Autocomplete() bool {
 // InsertTab inserts a tab or spaces
 func (h *BufPane) InsertTab() bool {
        b := h.Buf
-       l := b.LineBytes(h.Cursor.Y)
-       l = util.SliceStart(l, h.Cursor.X)
        indent := b.IndentString(util.IntOpt(b.Settings["tabsize"]))
        tabBytes := len(indent)
        bytesUntilIndent := tabBytes - (h.Cursor.GetVisualX() % tabBytes)
index 2656e1daa5d398a794462d4b4ca49deb93c75d80..31fc9f9cb77ff1a33b3ac39149c03445bfa50200 100644 (file)
@@ -35,37 +35,37 @@ var commands map[string]Command
 
 func InitCommands() {
        commands = map[string]Command{
-               "set":        Command{(*BufPane).SetCmd, OptionValueComplete},
-               "reset":      Command{(*BufPane).ResetCmd, OptionValueComplete},
-               "setlocal":   Command{(*BufPane).SetLocalCmd, OptionValueComplete},
-               "show":       Command{(*BufPane).ShowCmd, OptionComplete},
-               "showkey":    Command{(*BufPane).ShowKeyCmd, nil},
-               "run":        Command{(*BufPane).RunCmd, nil},
-               "bind":       Command{(*BufPane).BindCmd, nil},
-               "unbind":     Command{(*BufPane).UnbindCmd, nil},
-               "quit":       Command{(*BufPane).QuitCmd, nil},
-               "goto":       Command{(*BufPane).GotoCmd, nil},
-               "save":       Command{(*BufPane).SaveCmd, nil},
-               "replace":    Command{(*BufPane).ReplaceCmd, nil},
-               "replaceall": Command{(*BufPane).ReplaceAllCmd, nil},
-               "vsplit":     Command{(*BufPane).VSplitCmd, buffer.FileComplete},
-               "hsplit":     Command{(*BufPane).HSplitCmd, buffer.FileComplete},
-               "tab":        Command{(*BufPane).NewTabCmd, buffer.FileComplete},
-               "help":       Command{(*BufPane).HelpCmd, HelpComplete},
-               "eval":       Command{(*BufPane).EvalCmd, nil},
-               "log":        Command{(*BufPane).ToggleLogCmd, nil},
-               "plugin":     Command{(*BufPane).PluginCmd, PluginComplete},
-               "reload":     Command{(*BufPane).ReloadCmd, nil},
-               "reopen":     Command{(*BufPane).ReopenCmd, nil},
-               "cd":         Command{(*BufPane).CdCmd, buffer.FileComplete},
-               "pwd":        Command{(*BufPane).PwdCmd, nil},
-               "open":       Command{(*BufPane).OpenCmd, buffer.FileComplete},
-               "tabswitch":  Command{(*BufPane).TabSwitchCmd, nil},
-               "term":       Command{(*BufPane).TermCmd, nil},
-               "memusage":   Command{(*BufPane).MemUsageCmd, nil},
-               "retab":      Command{(*BufPane).RetabCmd, nil},
-               "raw":        Command{(*BufPane).RawCmd, nil},
-               "textfilter": Command{(*BufPane).TextFilterCmd, nil},
+               "set":        {(*BufPane).SetCmd, OptionValueComplete},
+               "reset":      {(*BufPane).ResetCmd, OptionValueComplete},
+               "setlocal":   {(*BufPane).SetLocalCmd, OptionValueComplete},
+               "show":       {(*BufPane).ShowCmd, OptionComplete},
+               "showkey":    {(*BufPane).ShowKeyCmd, nil},
+               "run":        {(*BufPane).RunCmd, nil},
+               "bind":       {(*BufPane).BindCmd, nil},
+               "unbind":     {(*BufPane).UnbindCmd, nil},
+               "quit":       {(*BufPane).QuitCmd, nil},
+               "goto":       {(*BufPane).GotoCmd, nil},
+               "save":       {(*BufPane).SaveCmd, nil},
+               "replace":    {(*BufPane).ReplaceCmd, nil},
+               "replaceall": {(*BufPane).ReplaceAllCmd, nil},
+               "vsplit":     {(*BufPane).VSplitCmd, buffer.FileComplete},
+               "hsplit":     {(*BufPane).HSplitCmd, buffer.FileComplete},
+               "tab":        {(*BufPane).NewTabCmd, buffer.FileComplete},
+               "help":       {(*BufPane).HelpCmd, HelpComplete},
+               "eval":       {(*BufPane).EvalCmd, nil},
+               "log":        {(*BufPane).ToggleLogCmd, nil},
+               "plugin":     {(*BufPane).PluginCmd, PluginComplete},
+               "reload":     {(*BufPane).ReloadCmd, nil},
+               "reopen":     {(*BufPane).ReopenCmd, nil},
+               "cd":         {(*BufPane).CdCmd, buffer.FileComplete},
+               "pwd":        {(*BufPane).PwdCmd, nil},
+               "open":       {(*BufPane).OpenCmd, buffer.FileComplete},
+               "tabswitch":  {(*BufPane).TabSwitchCmd, nil},
+               "term":       {(*BufPane).TermCmd, nil},
+               "memusage":   {(*BufPane).MemUsageCmd, nil},
+               "retab":      {(*BufPane).RetabCmd, nil},
+               "raw":        {(*BufPane).RawCmd, nil},
+               "textfilter": {(*BufPane).TextFilterCmd, nil},
        }
 }
 
@@ -240,7 +240,7 @@ func (h *BufPane) RawCmd(args []string) {
 
 // TextFilterCmd filters the selection through the command.
 // Selection goes to the command input.
-// On successfull run command output replaces the current selection.
+// On successful run command output replaces the current selection.
 func (h *BufPane) TextFilterCmd(args []string) {
        if len(args) == 0 {
                InfoBar.Error("usage: textfilter arguments")
@@ -691,7 +691,7 @@ func (h *BufPane) BindCmd(args []string) {
 // UnbindCmd binds a key to its default action
 func (h *BufPane) UnbindCmd(args []string) {
        if len(args) < 1 {
-               InfoBar.Error("Not enough arguements")
+               InfoBar.Error("Not enough arguments")
                return
        }
 
index 33b40268325ffa526e5984b15bfb8e9a7cf84511..00dde63350ef86c692688f30076610103c7fa290 100644 (file)
@@ -147,7 +147,7 @@ var InfoNones = []string{
        "SkipMultiCursor",
 }
 
-// InfoOverrides is the list of actions which have been overriden
+// InfoOverrides is the list of actions which have been overridden
 // by the infohandler
 var InfoOverrides = map[string]InfoKeyAction{
        "CursorUp":      (*InfoPane).CursorUp,
index 50e0a75d8b1a7d809b7375463364b589fe9be484..21a6de0ed124e1832584d0cee8e910ccfd2cb32f 100644 (file)
@@ -18,9 +18,8 @@ func RunTermEmulator(h *BufPane, input string, wait bool, getOutput bool, callba
        t := new(shell.Terminal)
        t.Start(args, getOutput, wait, callback, userargs)
 
-       id := h.ID()
        h.AddTab()
-       id = MainTab().Panes[0].ID()
+       id := MainTab().Panes[0].ID()
 
        v := h.GetView()
        MainTab().Panes[0] = NewTermPane(v.X, v.Y, v.Width, v.Height, t, id)
index 4382971d4915a4ac204b4ea4eef34764f07d92e6..0930ba2cac4c4c508fbe7cd99b53b2a7e7ea2f55 100644 (file)
@@ -115,7 +115,7 @@ func (b *Buffer) FindNext(s string, start, end, from Loc, down bool, useRegex bo
                return [2]Loc{}, false, err
        }
 
-       found := false
+       var found bool
        var l [2]Loc
        if down {
                l, found = b.findDown(r, from, end)
index 3b478e7c20609c51efb4f5c017de4dc0ea736faf..3993416626c21a6a266c1d78ac8c69626be0ee3d 100644 (file)
@@ -45,12 +45,12 @@ func (w *BufWindow) SetBuffer(b *buffer.Buffer) {
        w.Buf = b
 }
 
-func (v *View) GetView() *View {
-       return v
+func (w *BufWindow) GetView() *View {
+       return w.View
 }
 
-func (v *View) SetView(view *View) {
-       v = view
+func (w *BufWindow) SetView(view *View) {
+       w.View = view
 }
 
 func (w *BufWindow) Resize(width, height int) {