ronantakizawa/codereview-bench huggingface dataset:
Repository: zyedidia/micro
File: internal/display/bufwindow.go (Go)

Code before:
							return r, style.Reverse(true), bgoverridable
						}
					} else {
						return r, style.Underline(true), bgoverridable
					}
				}
			}

			if r != '\t' && r != ' ' {
				return r, style, bgoverridable
			}

			var indentrunes []rune
			switch r {
			case '\t':
				if bloc.X < leadingwsEnd {
					if indenttabchars != "" {
						indentrunes = []rune(indenttabchars)
					} else {
						indentrunes = []rune(tabchars)
					}
				} else {
					indentrunes = []rune(tabchars)
				}
			case ' ':
				if bloc.X%tabsize == 0 && bloc.X < leadingwsEnd {
					if indentspacechars != "" {
						indentrunes = []rune(indentspacechars)
					} else {
						indentrunes = []rune(spacechars)
					}
				} else {
					indentrunes = []rune(spacechars)
				}
			}

			var returnrune rune
			if showoffset < len(indentrunes) {
				returnrune = indentrunes[showoffset]
			} else {
				// use space if no showchars or after we showed showchars
				returnrune = ' '
			}

			if s, ok := config.Colorscheme["indent-char"]; ok {
				fg, _, _ := s.Decompose()
				style = style.Foreground(fg)
			}

			if b.Settings["hltaberrors"].(bool) && bloc.X < leadingwsEnd {
				if s, ok := config.Colorscheme["tab-error"]; ok {

Review comment (bug):
Simply checking `bloc.X%tabsize == 0` is buggy, since `bloc.X` is not necessarily the _visual_ position of the character in the line (since there may be tab characters in the line before this space character). Try it: put some space characters after some tab characters (before the first visible character in a line) -> result: `ispace` is displayed at wrong locations.

We should probably use `util.StringWidth()`.

Code after:
							return r, style.Reverse(true), false
						}
					} else {
						return r, style.Underline(true), false
					}
				}
			}

			if r != '\t' && r != ' ' {
				return r, style, false
			}

			var indentrunes []rune
			switch r {
			case '\t':
				if bloc.X < leadingwsEnd && indenttabchars != "" {
					indentrunes = []rune(indenttabchars)
				} else {
					indentrunes = []rune(tabchars)
				}
			case ' ':
				if linex%tabsize == 0 && bloc.X < leadingwsEnd && indentspacechars != "" {
					indentrunes = []rune(indentspacechars)
				} else {
					indentrunes = []rune(spacechars)
				}
			}

			var drawrune rune
			if showoffset < len(indentrunes) {
				drawrune = indentrunes[showoffset]
			} else {
				// use space if no showchars or after we showed showchars
				drawrune = ' '
			}

			if s, ok := config.Colorscheme["indent-char"]; ok {
				fg, _, _ := s.Decompose()
				style = style.Foreground(fg)
			}

			preservebg := false
			if b.Settings["hltaberrors"].(bool) && bloc.X < leadingwsEnd {
				if s, ok := config.Colorscheme["tab-error"]; ok {
					if b.Settings["tabstospaces"].(bool) && r == '\t' {
						fg, _, _ := s.Decompose()
						style = style.Background(fg)
						preservebg = true
					} else if !b.Settings["tabstospaces"].(bool) && r == ' ' {
						fg, _, _ := s.Decompose()
						style = style.Background(fg)
Repository: zyedidia/micro
File: internal/display/bufwindow.go (Go)

Code before:
							fg, _, _ := s.Decompose()
							style = style.Background(fg)
							bgoverridable = false
						}
					}
				}
			}

			return returnrune, style, bgoverridable
		}

		draw := func(r rune, combc []rune, style tcell.Style, highlight bool, showcursor bool, bgoverridable bool) {
			if nColsBeforeStart <= 0 && vloc.Y >= 0 {
				if highlight {
					if w.Buf.HighlightSearch && w.Buf.SearchMatch(bloc) {
						style = config.DefStyle.Reverse(true)
						if s, ok := config.Colorscheme["hlsearch"]; ok {
							style = s
						}
					}

					_, origBg, _ := style.Decompose()
					_, defBg, _ := config.DefStyle.Decompose()

					// syntax or hlsearch highlighting with non-default background takes precedence
					// over cursor-line and color-column
					if bgoverridable {
						bgoverridable = origBg == defBg
					}

					for _, c := range cursors {
						if c.HasSelection() &&
							(bloc.GreaterEqual(c.CurSelection[0]) && bloc.LessThan(c.CurSelection[1]) ||
								bloc.LessThan(c.CurSelection[0]) && bloc.GreaterEqual(c.CurSelection[1])) {
							// The current character is selected
							style = config.DefStyle.Reverse(true)

							if s, ok := config.Colorscheme["selection"]; ok {
								style = s
							}
						}

						if b.Settings["cursorline"].(bool) && w.active && bgoverridable &&
							!c.HasSelection() && c.Y == bloc.Y {
							if s, ok := config.Colorscheme["cursor-line"]; ok {
								fg, _, _ := s.Decompose()
								style = style.Background(fg)
							}
						}
					}


Review comment (refactor):
nit: maybe move this comment inside the `if` (since it relates specifically to the `origBg == defBg` check)?

Code after:
				// use space if no showchars or after we showed showchars
				drawrune = ' '
			}

			if s, ok := config.Colorscheme["indent-char"]; ok {
				fg, _, _ := s.Decompose()
				style = style.Foreground(fg)
			}

			preservebg := false
			if b.Settings["hltaberrors"].(bool) && bloc.X < leadingwsEnd {
				if s, ok := config.Colorscheme["tab-error"]; ok {
					if b.Settings["tabstospaces"].(bool) && r == '\t' {
						fg, _, _ := s.Decompose()
						style = style.Background(fg)
						preservebg = true
					} else if !b.Settings["tabstospaces"].(bool) && r == ' ' {
						fg, _, _ := s.Decompose()
						style = style.Background(fg)
						preservebg = true
					}
				}
			}

			if b.Settings["hltrailingws"].(bool) {
				if s, ok := config.Colorscheme["trailingws"]; ok {
					if bloc.X >= trailingwsStart && bloc.X < blineLen {
						hl := true
						for _, c := range cursors {
							if c.NewTrailingWsY == bloc.Y {
								hl = false
								break
							}
						}
						if hl {
							fg, _, _ := s.Decompose()
							style = style.Background(fg)
							preservebg = true
						}
					}
				}
			}

			return drawrune, style, preservebg
		}

		draw := func(r rune, combc []rune, style tcell.Style, highlight bool, showcursor bool, preservebg bool) {
			defer func() {
				if nColsBeforeStart <= 0 {
					vloc.X++
				}
Repository: zyedidia/micro
File: internal/display/bufwindow.go (Go)

Code before:

						if s, ok := config.Colorscheme["selection"]; ok {
							style = s
						}
					}

					if b.Settings["cursorline"].(bool) && w.active && !preservebg &&
						!c.HasSelection() && c.Y == bloc.Y {
						if s, ok := config.Colorscheme["cursor-line"]; ok {
							fg, _, _ := s.Decompose()
							style = style.Background(fg)
						}
					}
				}

				for _, m := range b.Messages {
					if bloc.GreaterEqual(m.Start) && bloc.LessThan(m.End) ||
						bloc.LessThan(m.End) && bloc.GreaterEqual(m.Start) {
						style = style.Underline(true)
						break
					}
				}

				if s, ok := config.Colorscheme["color-column"]; ok {
					if colorcolumn != 0 && vloc.X-w.gutterOffset+w.StartCol == colorcolumn && !preservebg {
						fg, _, _ := s.Decompose()
						style = style.Background(fg)
					}
				}
			}

			screen.SetContent(w.X+vloc.X, w.Y+vloc.Y, r, combc, style)

			if showcursor {
				for _, c := range cursors {
					if c.X == bloc.X && c.Y == bloc.Y && !c.HasSelection() {
						w.showCursor(w.X+vloc.X, w.Y+vloc.Y, c.Num == 0)
					}
				}
			}
		}

		wrap := func() {
			vloc.X = 0

			if vloc.Y >= 0 {
				if w.hasMessage {
					w.drawGutter(&vloc, &bloc)
				}
				if b.Settings["diffgutter"].(bool) {
					w.drawDiffGutter(lineNumStyle, true, &vloc, &bloc)

Review comment (suggestion):
Also just realized: this can be even simpler:

```go
// syntax or hlsearch highlighting with non-default background takes precedence
// over cursor-line and color-column
if !preservebg && origBg != defBg {
	preservebg = true
}
```

Code after:
			defer func() {
				if nColsBeforeStart <= 0 {
					vloc.X++
				}
				nColsBeforeStart--
			}()

			if nColsBeforeStart > 0 || vloc.Y < 0 {
				return
			}

			if highlight {
				if w.Buf.HighlightSearch && w.Buf.SearchMatch(bloc) {
					style = config.DefStyle.Reverse(true)
					if s, ok := config.Colorscheme["hlsearch"]; ok {
						style = s
					}
				}

				_, origBg, _ := style.Decompose()
				_, defBg, _ := config.DefStyle.Decompose()

				// syntax or hlsearch highlighting with non-default background takes precedence
				// over cursor-line and color-column
				if !preservebg && origBg != defBg {
					preservebg = true
				}

				for _, c := range cursors {
					if c.HasSelection() &&
						(bloc.GreaterEqual(c.CurSelection[0]) && bloc.LessThan(c.CurSelection[1]) ||
							bloc.LessThan(c.CurSelection[0]) && bloc.GreaterEqual(c.CurSelection[1])) {
						// The current character is selected
						style = config.DefStyle.Reverse(true)

						if s, ok := config.Colorscheme["selection"]; ok {
							style = s
						}
					}

					if b.Settings["cursorline"].(bool) && w.active && !preservebg &&
						!c.HasSelection() && c.Y == bloc.Y {
						if s, ok := config.Colorscheme["cursor-line"]; ok {
							fg, _, _ := s.Decompose()
							style = style.Background(fg)
						}
					}
				}

				for _, m := range b.Messages {
					if bloc.GreaterEqual(m.Start) && bloc.LessThan(m.End) ||
Repository: zyedidia/micro
File: internal/display/bufwindow.go (Go)

Code before:

			if b.Settings["diffgutter"].(bool) {
				w.drawDiffGutter(s, false, &vloc, &bloc)
			}

			if b.Settings["ruler"].(bool) {
				w.drawLineNum(s, false, &vloc, &bloc)
			}
		} else {
			vloc.X = w.gutterOffset
		}

		bline := b.LineBytes(bloc.Y)
		blineLen := util.CharacterCount(bline)

		leadingwsEnd := len(util.GetLeadingWhitespace(bline))
		trailingwsStart := blineLen - util.CharacterCount(util.GetTrailingWhitespace(bline))

		line, nColsBeforeStart, bslice, startStyle := w.getStartInfo(w.StartCol, bloc.Y)
		if startStyle != nil {
			curStyle = *startStyle
		}
		bloc.X = bslice

		// returns the rune to be drawn, style of it and if the bg should be preserved
		getRuneStyle := func(r rune, style tcell.Style, drawoffset int, linex int, isplaceholder bool) (rune, tcell.Style, bool) {
			if nColsBeforeStart > 0 || vloc.Y < 0 || isplaceholder {
				return r, style, false
			}

			for _, mb := range matchingBraces {
				if mb.X == bloc.X && mb.Y == bloc.Y {
					if b.Settings["matchbracestyle"].(string) == "highlight" {
						if s, ok := config.Colorscheme["match-brace"]; ok {
							return r, s, false
						} else {
							return r, style.Reverse(true), false
						}
					} else {
						return r, style.Underline(true), false
					}
				}
			}

			if r != '\t' && r != ' ' {
				return r, style, false
			}

			var indentrunes []rune
			switch r {
			case '\t':

Review comment (suggestion):
Any reason why you renamed `showoffset` to `drawoffset`?
Neither name seems quite intuitive to me, but at least `showoffset` somehow relates to `showchars` (and `showchars` is the only reason for the existence of this argument, right?).

Code after:

			if b.Settings["diffgutter"].(bool) {
				w.drawDiffGutter(s, false, &vloc, &bloc)
			}

			if b.Settings["ruler"].(bool) {
				w.drawLineNum(s, false, &vloc, &bloc)
			}
		} else {
			vloc.X = w.gutterOffset
		}

		bline := b.LineBytes(bloc.Y)
		blineLen := util.CharacterCount(bline)

		leadingwsEnd := len(util.GetLeadingWhitespace(bline))
		trailingwsStart := blineLen - util.CharacterCount(util.GetTrailingWhitespace(bline))

		line, nColsBeforeStart, bslice, startStyle := w.getStartInfo(w.StartCol, bloc.Y)
		if startStyle != nil {
			curStyle = *startStyle
		}
		bloc.X = bslice

		// returns the rune to be drawn, style of it and if the bg should be preserved
		getRuneStyle := func(r rune, style tcell.Style, showoffset int, linex int, isplaceholder bool) (rune, tcell.Style, bool) {
			if nColsBeforeStart > 0 || vloc.Y < 0 || isplaceholder {
				return r, style, false
			}

			for _, mb := range matchingBraces {
				if mb.X == bloc.X && mb.Y == bloc.Y {
					if b.Settings["matchbracestyle"].(string) == "highlight" {
						if s, ok := config.Colorscheme["match-brace"]; ok {
							return r, s, false
						} else {
							return r, style.Reverse(true), false
						}
					} else {
						return r, style.Underline(true), false
					}
				}
			}

			if r != '\t' && r != ' ' {
				return r, style, false
			}

			var indentrunes []rune
			switch r {
			case '\t':
Repository: zyedidia/micro
File: internal/display/bufwindow.go (Go)

Code before:
					}
				}
			}

			if r != '\t' && r != ' '{
				return r, style, false
			}

			var drawrune rune
			if r == '\t' {
				indentrunes := []rune(b.Settings["indentchar"].(string))
				// if empty indentchar settings, use space
				if len(indentrunes) == 0 {
					indentrunes = []rune{' '}
				}

				drawrune = indentrunes[0]
				if s, ok := config.Colorscheme["indent-char"]; ok && r != ' ' {
					fg, _, _ := s.Decompose()
					style = style.Foreground(fg)
				}

				if s, ok := config.Colorscheme["indent-char"]; ok {
					fg, _, _ := s.Decompose()
					style = style.Foreground(fg)
				}
			}

			preservebg := false
			if b.Settings["hltaberrors"].(bool) && bloc.X < leadingwsEnd {
				if s, ok := config.Colorscheme["tab-error"]; ok {
					if b.Settings["tabstospaces"].(bool) && r == '\t' {
						fg, _, _ := s.Decompose()
						style = style.Background(fg)
						preservebg = true
					} else if !b.Settings["tabstospaces"].(bool) && r == ' ' {
						fg, _, _ := s.Decompose()
						style = style.Background(fg)
						preservebg = true
					}
				}
			}

			if b.Settings["hltrailingws"].(bool) {
				if s, ok := config.Colorscheme["trailingws"]; ok {
					if bloc.X >= trailingwsStart && bloc.X < blineLen {
						hl := true
						for _, c := range cursors {
							if c.NewTrailingWsY == bloc.Y {
								hl = false
								break

Review comment (suggestion):
Do I oversee something here or are both blocks equal except the check for `&& r != ' '`, which is always true.
In the removed block we had no duplication.

Code after:
		leadingwsEnd := len(util.GetLeadingWhitespace(bline))
		trailingwsStart := blineLen - util.CharacterCount(util.GetTrailingWhitespace(bline))

		line, nColsBeforeStart, bslice, startStyle := w.getStartInfo(w.StartCol, bloc.Y)
		if startStyle != nil {
			curStyle = *startStyle
		}
		bloc.X = bslice

		// returns the rune to be drawn, style of it and if the bg should be preserved
		getRuneStyle := func(r rune, style tcell.Style, showoffset int, linex int, isplaceholder bool) (rune, tcell.Style, bool) {
			if nColsBeforeStart > 0 || vloc.Y < 0 || isplaceholder {
				return r, style, false
			}

			for _, mb := range matchingBraces {
				if mb.X == bloc.X && mb.Y == bloc.Y {
					if b.Settings["matchbracestyle"].(string) == "highlight" {
						if s, ok := config.Colorscheme["match-brace"]; ok {
							return r, s, false
						} else {
							return r, style.Reverse(true), false
						}
					} else {
						return r, style.Underline(true), false
					}
				}
			}

			if r != '\t' && r != ' ' {
				return r, style, false
			}

			var indentrunes []rune
			switch r {
			case '\t':
				if bloc.X < leadingwsEnd && indenttabchars != "" {
					indentrunes = []rune(indenttabchars)
				} else {
					indentrunes = []rune(tabchars)
				}
			case ' ':
				if linex%tabsize == 0 && bloc.X < leadingwsEnd && indentspacechars != "" {
					indentrunes = []rune(indentspacechars)
				} else {
					indentrunes = []rune(spacechars)
				}
			}

			var drawrune rune
			if showoffset < len(indentrunes) {
Repository: zyedidia/micro
File: internal/action/bufpane.go (Go)

Code before:
	action, more := binds.NextEvent(e, nil)
	if action != nil && !more {
		action(h)
		binds.ResetEvents()
		return true
	} else if action == nil && !more {
		binds.ResetEvents()
	}
	return more
}

func (h *BufPane) execAction(action BufAction, name string, te *tcell.EventMouse) bool {
	if name != "Autocomplete" && name != "CycleAutocompleteBack" {
		h.Buf.HasSuggestions = false
	}

	if !h.PluginCB("pre" + name) {
		return false
	}

	var success bool
	switch a := action.(type) {
	case BufKeyAction:
		success = a(h)
	case BufMouseAction:
		success = a(h, te)
	}
	success = success && h.PluginCB("on"+name)

	if _, ok := MultiActions[name]; ok {
		if recordingMacro {
			if name != "ToggleMacro" && name != "PlayMacro" {
				curmacro = append(curmacro, action)
			}
		}
	}

	return success
}

func (h *BufPane) completeAction(action string) {
	h.PluginCB("on" + action)
}

func (h *BufPane) HasKeyEvent(e Event) bool {
	// TODO
	return true
	// _, ok := BufKeyBindings[e]
	// return ok
}


Review comment (suggestion):
We add this now also for `BufKeyAction` too, right?
Furthermore...is this optional argument really backward compatible? :thinking: 

Code after:
		action(h)
		binds.ResetEvents()
		return true
	} else if action == nil && !more {
		binds.ResetEvents()
	}
	return more
}

func (h *BufPane) execAction(action BufAction, name string, te *tcell.EventMouse) bool {
	if name != "Autocomplete" && name != "CycleAutocompleteBack" {
		h.Buf.HasSuggestions = false
	}

	if !h.PluginCB("pre"+name, te) {
		return false
	}

	var success bool
	switch a := action.(type) {
	case BufKeyAction:
		success = a(h)
	case BufMouseAction:
		success = a(h, te)
	}
	success = success && h.PluginCB("on"+name, te)

	if _, ok := MultiActions[name]; ok {
		if recordingMacro {
			if name != "ToggleMacro" && name != "PlayMacro" {
				curmacro = append(curmacro, action)
			}
		}
	}

	return success
}

func (h *BufPane) completeAction(action string) {
	h.PluginCB("on" + action)
}

func (h *BufPane) HasKeyEvent(e Event) bool {
	// TODO
	return true
	// _, ok := BufKeyBindings[e]
	// return ok
}

// DoMouseEvent executes a mouse event by finding the action it is bound
// to and executing it
Repository: zyedidia/micro
File: internal/action/command.go (Go)

Code before:
		InfoBar.Error(err)
	}
}

// ToggleCmd toggles an option
func (h *BufPane) ToggleCmd(args []string) {
	if len(args) < 1 {
		InfoBar.Error("Please provide an option to toggle")
		return
	}
	
	option := args[0]
	curVal := config.GetGlobalOption(option)
	if curVal == nil {
		InfoBar.Error(config.ErrInvalidOption)
		return
	}
	
	optionKind := reflect.TypeOf(curVal).Kind()
	if optionKind != reflect.Bool {
		InfoBar.Error("Non-boolean option")
		return
	}
	
	newVal := strconv.FormatBool(!curVal.(bool))
	err := SetGlobalOption(option, newVal)
	if err == config.ErrInvalidOption {
		err := h.Buf.SetOption(option, newVal)
		if err != nil {
			InfoBar.Error(err)
		}
	}
}

// ToggleLocalCmd toggles an option local to the buffer
func (h *BufPane) ToggleLocalCmd(args []string) {
	if len(args) < 1 {
		InfoBar.Error("Not enough arguments")
		return
	}
	
	option := args[0]
	curVal := h.Buf.Settings[option]
	if curVal == nil {
		InfoBar.Error(config.ErrInvalidOption)
		return
	}
	
	optionKind := reflect.TypeOf(curVal).Kind()
	if optionKind != reflect.Bool {
		InfoBar.Error("Non-boolean option")

Review comment (suggestion):
We can just use `SetGlobalOptionNative()`. No point in converting it to string just to convert it back from string inside `SetGlobalOption()`.

Code after:
		InfoBar.Error(err)
	}
}

func (h *BufPane) toggleOption(option string, local bool) error {
	var curVal, newVal any

	if local {
		curVal = h.Buf.Settings[option]
	} else {
		curVal = config.GetGlobalOption(option)
	}
	if curVal == nil {
		return config.ErrInvalidOption
	}

	if choices, ok := config.OptionChoices[option]; ok && len(choices) == 2 {
		if curVal == choices[0] {
			newVal = choices[1]
		} else {
			newVal = choices[0]
		}
	} else if curValBool, ok := curVal.(bool); ok {
		newVal = !curValBool
	} else {
		return config.ErrOptNotToggleable
	}

	if local {
		if err := h.Buf.SetOptionNative(option, newVal); err != nil {
			return err
		}
	} else {
		if err := SetGlobalOptionNative(option, newVal); err != nil {
			return err
		}
	}

	return nil
}

// ToggleCmd toggles a toggleable option
func (h *BufPane) ToggleCmd(args []string) {
	if len(args) < 1 {
		InfoBar.Error("Not enough arguments: provide a toggleable option")
		return
	}
	if err := h.toggleOption(args[0], false); err != nil {
		InfoBar.Error(err)
	}
}
Repository: zyedidia/micro
File: internal/action/command.go (Go)

Code before:
	}

	curValBool, ok := curVal.(bool)
	if !ok {
		InfoBar.Error("Not a boolean option")
		return
	}
	
	err := SetGlobalOptionNative(option, !curValBool)
	if err == config.ErrInvalidOption {
		err := h.Buf.SetOptionNative(option, !curValBool)
		if err != nil {
			InfoBar.Error(err)
		}
	}
}

// ToggleLocalCmd toggles a boolean option local to the buffer
func (h *BufPane) ToggleLocalCmd(args []string) {
	if len(args) < 1 {
		InfoBar.Error("Not enough arguments")
		return
	}
	
	option := args[0]
	curVal := config.GetGlobalOption(option)
	if curVal == nil {
		InfoBar.Error(config.ErrInvalidOption)
		return
	}

	curValBool, ok := curVal.(bool)
	if !ok {
		InfoBar.Error("Not a boolean option")
		return
	}

	err := h.Buf.SetOptionNative(option, !curValBool)
	if err != nil {
		InfoBar.Error(err)
	}
}

// ShowCmd shows the value of the given option
func (h *BufPane) ShowCmd(args []string) {
	if len(args) < 1 {
		InfoBar.Error("Please provide an option to show")
		return
	}

	var option interface{}

Review comment (bug):
I think it's better to use `h.Buf.Settings[option]`, not just to avoid confusion when reading the code (although I understand the cause of this confusion is the confusing name of `GetGlobalOption()`, not your code), but also to check if this not a global-only option. With your current version, `togglelocal infobar` silently "succeeds" (and then `show infobar` meaninglessly says that infobar is false for this buffer). In comparison,  `setlocal infobar off` correctly fails and shows an error message (albeit perhaps not the clearest one).

Code after:
	if choices, ok := config.OptionChoices[option]; ok && len(choices) == 2 {
		if curVal == choices[0] {
			newVal = choices[1]
		} else {
			newVal = choices[0]
		}
	} else if curValBool, ok := curVal.(bool); ok {
		newVal = !curValBool
	} else {
		return config.ErrOptNotToggleable
	}

	if local {
		if err := h.Buf.SetOptionNative(option, newVal); err != nil {
			return err
		}
	} else {
		if err := SetGlobalOptionNative(option, newVal); err != nil {
			return err
		}
	}

	return nil
}

// ToggleCmd toggles a toggleable option
func (h *BufPane) ToggleCmd(args []string) {
	if len(args) < 1 {
		InfoBar.Error("Not enough arguments: provide a toggleable option")
		return
	}
	if err := h.toggleOption(args[0], false); err != nil {
		InfoBar.Error(err)
	}
}

// ToggleCmd toggles a toggleable option local to the buffer
func (h *BufPane) ToggleLocalCmd(args []string) {
	if len(args) < 1 {
		InfoBar.Error("Not enough arguments: provide a toggleable option")
		return
	}
	if err := h.toggleOption(args[0], true); err != nil {
		InfoBar.Error(err)
	}
}

// ShowCmd shows the value of the given option
func (h *BufPane) ShowCmd(args []string) {
	if len(args) < 1 {
		InfoBar.Error("Please provide an option to show")