File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package action
2
2
3
3
import (
4
4
luar "layeh.com/gopher-luar"
5
+ "strconv"
5
6
6
7
"github.com/micro-editor/tcell/v2"
7
8
"github.com/zyedidia/micro/v2/internal/buffer"
@@ -17,6 +18,8 @@ import (
17
18
type TabList struct {
18
19
* display.TabWindow
19
20
List []* Tab
21
+ // captures whether the mouse is released
22
+ release bool
20
23
}
21
24
22
25
// NewTabList creates a TabList from a list of buffers by creating a Tab
@@ -35,6 +38,7 @@ func NewTabList(bufs []*buffer.Buffer) *TabList {
35
38
}
36
39
tl .TabWindow = display .NewTabWindow (w , 0 )
37
40
tl .Names = make ([]string , len (bufs ))
41
+ tl .release = true
38
42
39
43
return tl
40
44
}
@@ -114,13 +118,26 @@ func (t *TabList) HandleEvent(event tcell.Event) {
114
118
t .Scroll (4 )
115
119
} else {
116
120
ind := t .LocFromVisual (buffer.Loc {mx , my })
117
- if ind != - 1 {
121
+ if ind == - 1 {
122
+ ind = len (t .List ) + 1
123
+ }
124
+
125
+ if t .release {
126
+ t .release = false
118
127
t .SetActive (ind )
128
+ } else {
129
+ MainTab ().CurPane ().TabMoveCmd ([]string {strconv .Itoa (ind + 1 )})
119
130
}
120
131
}
121
132
return
122
133
}
134
+ if ! t .release {
135
+ return
136
+ }
123
137
case tcell .ButtonNone :
138
+ if ! t .release {
139
+ t .release = true
140
+ }
124
141
if t .List [t .Active ()].release {
125
142
// Mouse release received, while already released
126
143
t .ResetMouse ()
You can’t perform that action at this time.
0 commit comments