@@ -1068,6 +1068,9 @@ func (h *BufPane) ToggleHighlightSearch() bool {
10681068
10691069// UnhighlightSearch unhighlights all instances of the last used search term
10701070func (h * BufPane ) UnhighlightSearch () bool {
1071+ if ! h .Buf .HighlightSearch {
1072+ return false
1073+ }
10711074 h .Buf .HighlightSearch = false
10721075 return true
10731076}
@@ -1632,12 +1635,18 @@ func (h *BufPane) Escape() bool {
16321635
16331636// Deselect deselects on the current cursor
16341637func (h * BufPane ) Deselect () bool {
1638+ if ! h .Cursor .HasSelection () {
1639+ return false
1640+ }
16351641 h .Cursor .Deselect (true )
16361642 return true
16371643}
16381644
16391645// ClearInfo clears the infobar
16401646func (h * BufPane ) ClearInfo () bool {
1647+ if InfoBar .Msg == "" {
1648+ return false
1649+ }
16411650 InfoBar .Message ("" )
16421651 return true
16431652}
@@ -1728,6 +1737,10 @@ func (h *BufPane) AddTab() bool {
17281737// PreviousTab switches to the previous tab in the tab list
17291738func (h * BufPane ) PreviousTab () bool {
17301739 tabsLen := len (Tabs .List )
1740+ if tabsLen == 1 {
1741+ return false
1742+ }
1743+
17311744 a := Tabs .Active () + tabsLen
17321745 Tabs .SetActive ((a - 1 ) % tabsLen )
17331746
@@ -1736,8 +1749,13 @@ func (h *BufPane) PreviousTab() bool {
17361749
17371750// NextTab switches to the next tab in the tab list
17381751func (h * BufPane ) NextTab () bool {
1752+ tabsLen := len (Tabs .List )
1753+ if tabsLen == 1 {
1754+ return false
1755+ }
1756+
17391757 a := Tabs .Active ()
1740- Tabs .SetActive ((a + 1 ) % len ( Tabs . List ) )
1758+ Tabs .SetActive ((a + 1 ) % tabsLen )
17411759
17421760 return true
17431761}
@@ -1773,6 +1791,10 @@ func (h *BufPane) Unsplit() bool {
17731791
17741792// NextSplit changes the view to the next split
17751793func (h * BufPane ) NextSplit () bool {
1794+ if len (h .tab .Panes ) == 1 {
1795+ return false
1796+ }
1797+
17761798 a := h .tab .active
17771799 if a < len (h .tab .Panes )- 1 {
17781800 a ++
@@ -1787,6 +1809,10 @@ func (h *BufPane) NextSplit() bool {
17871809
17881810// PreviousSplit changes the view to the previous split
17891811func (h * BufPane ) PreviousSplit () bool {
1812+ if len (h .tab .Panes ) == 1 {
1813+ return false
1814+ }
1815+
17901816 a := h .tab .active
17911817 if a > 0 {
17921818 a --
0 commit comments