Skip to content
Myr

Allow dragging of scrollbar

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Junegunn Choi · committed by Junegunn Choi · parent 435d8fa · Browse files · 1 file+11 added−10 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+11 added−10 removed

  • other:+11 added−10 removed

1 file+11 added−10 removed

modified:src/terminal.go+11 added-10 removed
2580 unmodified lines
2581 <-barrier2582 t.eventChan <- t.tui.GetChar()2583 }2584 }()2585 dragging := false2586 for looping {2587 var newCommand *string2588 var reloadSync bool2589 changed := false
448 unmodified lines
3038 scrollPreviewBy(-me.S)3039 }3040 } else if t.window.Enclose(my, mx) {3041 mx -= t.window.Left()3041 bar := mx == t.window.Width()-13042 mx = util.Constrain(mx-t.promptLen, 0, len(t.input))3042 my -= t.window.Top()3043 min := 2 + len(t.header)3044 if t.noInfoLine() {3045 min--
8 unmodified lines
3054 } else {3055 my = h - my - 13056 }3057 }3058 dragging = me.Down && (dragging || my >= min && mx == t.window.Width()-1)3059 if me.Double {3060 // Double-click3059 if bar && my >= min {3061 if my >= min {3062 if t.vset(t.offset+my-min) && t.cy < t.merger.Length() {3063 return doActions(actionsFor(tui.DoubleClick))3064 }3065 }3066 } else if dragging && my >= min {3067 barLength, barStart := t.getScrollbar()3068 if barLength > 0 {3069 maxItems := t.maxItems()3070 if newBarStart := util.Constrain(my-min-barLength/2, 0, maxItems-barLength); newBarStart != barStart {
4 unmodified lines
3075 t.cy = t.offset + t.cy - prevOffset3076 req(reqList)3077 }3078 }3072 } else if me.Double {3073 // Double-click3074 if my >= min {3075 if t.vset(t.offset+my-min) && t.cy < t.merger.Length() {3076 return doActions(actionsFor(tui.DoubleClick))3077 }3078 }3079 } else if me.Down {3080 mx = util.Constrain(mx-t.promptLen, 0, len(t.input))3081 if my == t.promptLine() && mx >= 0 {3082 // Prompt3083 t.cx = mx + t.xoffset3084 } else if my >= min {
226 unmodified lines