Fix some formatting

This commit is contained in:
Zachary Yedidia
2019-12-29 22:02:14 -05:00
parent 9b03a3dc6d
commit 3b66a3364c
6 changed files with 40 additions and 43 deletions

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

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

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

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

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

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