parent
bf1258578c
commit
bad78797bb
5 changed files with 27 additions and 18 deletions
|
@ -113,6 +113,9 @@ func BufMapKey(k Event, action string) {
|
|||
success := true
|
||||
for i, a := range actionfns {
|
||||
for j, c := range cursors {
|
||||
if c == nil {
|
||||
continue
|
||||
}
|
||||
h.Buf.SetCurCursor(c.Num)
|
||||
h.Cursor = c
|
||||
if i == 0 || (success && types[i-1] == '&') || (!success && types[i-1] == '|') || (types[i-1] == ',') {
|
||||
|
|
|
@ -104,6 +104,13 @@ func (t *TabList) HandleEvent(event tcell.Event) {
|
|||
mx, my := e.Position()
|
||||
switch e.Buttons() {
|
||||
case tcell.Button1:
|
||||
if my == t.Y && mx == 0 {
|
||||
t.Scroll(-4)
|
||||
return
|
||||
} else if my == t.Y && mx == t.Width-1 {
|
||||
t.Scroll(4)
|
||||
return
|
||||
}
|
||||
if len(t.List) > 1 {
|
||||
ind := t.LocFromVisual(buffer.Loc{mx, my})
|
||||
if ind != -1 {
|
||||
|
|
|
@ -763,6 +763,7 @@ func (b *Buffer) ClearCursors() {
|
|||
b.UpdateCursors()
|
||||
b.curCursor = 0
|
||||
b.GetActiveCursor().ResetSelection()
|
||||
log.Println("Cleared cursors:", len(b.cursors))
|
||||
}
|
||||
|
||||
// MoveLinesUp moves the range of lines up one row
|
||||
|
|
|
@ -199,7 +199,6 @@ func InitRuntimeFiles() {
|
|||
}
|
||||
p.Info, err = NewPluginInfo(data)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
continue
|
||||
}
|
||||
p.Name = p.Info.Name
|
||||
|
@ -232,7 +231,6 @@ func InitRuntimeFiles() {
|
|||
}
|
||||
p.Info, err = NewPluginInfo(data)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
continue
|
||||
}
|
||||
p.Name = p.Info.Name
|
||||
|
|
|
@ -14,19 +14,19 @@ type TabWindow struct {
|
|||
Names []string
|
||||
active int
|
||||
Y int
|
||||
width int
|
||||
Width int
|
||||
hscroll int
|
||||
}
|
||||
|
||||
func NewTabWindow(w int, y int) *TabWindow {
|
||||
tw := new(TabWindow)
|
||||
tw.width = w
|
||||
tw.Width = w
|
||||
tw.Y = y
|
||||
return tw
|
||||
}
|
||||
|
||||
func (w *TabWindow) Resize(width, height int) {
|
||||
w.width = width
|
||||
w.Width = width
|
||||
}
|
||||
|
||||
func (w *TabWindow) LocFromVisual(vloc buffer.Loc) int {
|
||||
|
@ -40,7 +40,7 @@ func (w *TabWindow) LocFromVisual(vloc buffer.Loc) int {
|
|||
}
|
||||
x += s
|
||||
x += 3
|
||||
if x >= w.width {
|
||||
if x >= w.Width {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
@ -50,9 +50,9 @@ func (w *TabWindow) LocFromVisual(vloc buffer.Loc) int {
|
|||
func (w *TabWindow) Scroll(amt int) {
|
||||
w.hscroll += amt
|
||||
s := w.TotalSize()
|
||||
w.hscroll = util.Clamp(w.hscroll, 0, s-w.width)
|
||||
w.hscroll = util.Clamp(w.hscroll, 0, s-w.Width)
|
||||
|
||||
if s-w.width <= 0 {
|
||||
if s-w.Width <= 0 {
|
||||
w.hscroll = 0
|
||||
}
|
||||
}
|
||||
|
@ -77,17 +77,17 @@ func (w *TabWindow) SetActive(a int) {
|
|||
for i, n := range w.Names {
|
||||
c := utf8.RuneCountInString(n)
|
||||
if i == a {
|
||||
if x+c >= w.hscroll+w.width {
|
||||
w.hscroll = util.Clamp(x+c+1-w.width, 0, s-w.width)
|
||||
if x+c >= w.hscroll+w.Width {
|
||||
w.hscroll = util.Clamp(x+c+1-w.Width, 0, s-w.Width)
|
||||
} else if x < w.hscroll {
|
||||
w.hscroll = util.Clamp(x-4, 0, s-w.width)
|
||||
w.hscroll = util.Clamp(x-4, 0, s-w.Width)
|
||||
}
|
||||
break
|
||||
}
|
||||
x += c + 4
|
||||
}
|
||||
|
||||
if s-w.width <= 0 {
|
||||
if s-w.Width <= 0 {
|
||||
w.hscroll = 0
|
||||
}
|
||||
}
|
||||
|
@ -104,13 +104,13 @@ func (w *TabWindow) Display() {
|
|||
if j > 0 {
|
||||
c = ' '
|
||||
}
|
||||
if x == w.width-1 && !done {
|
||||
screen.SetContent(w.width-1, w.Y, '>', nil, config.DefStyle.Reverse(true))
|
||||
if x == w.Width-1 && !done {
|
||||
screen.SetContent(w.Width-1, w.Y, '>', nil, config.DefStyle.Reverse(true))
|
||||
x++
|
||||
break
|
||||
} else if x == 0 && w.hscroll > 0 {
|
||||
screen.SetContent(0, w.Y, '<', nil, config.DefStyle.Reverse(true))
|
||||
} else if x >= 0 && x < w.width {
|
||||
} else if x >= 0 && x < w.Width {
|
||||
screen.SetContent(x, w.Y, c, nil, config.DefStyle.Reverse(true))
|
||||
}
|
||||
x++
|
||||
|
@ -136,12 +136,12 @@ func (w *TabWindow) Display() {
|
|||
} else {
|
||||
draw(' ', 3)
|
||||
}
|
||||
if x >= w.width {
|
||||
if x >= w.Width {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if x < w.width {
|
||||
draw(' ', w.width-x)
|
||||
if x < w.Width {
|
||||
draw(' ', w.Width-x)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue