mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-02-09 13:47:11 +02:00
bump gocui
This commit is contained in:
parent
c0cad91cb6
commit
6472bda29e
@ -1357,14 +1357,13 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
|
||||
Modifier: gocui.ModNone,
|
||||
Handler: gui.handleLBLMouseDown,
|
||||
},
|
||||
// TODO: see how to get mouse dragging in tcell
|
||||
// {
|
||||
// ViewName: "main",
|
||||
// Contexts: []string{MAIN_PATCH_BUILDING_CONTEXT_KEY, MAIN_STAGING_CONTEXT_KEY},
|
||||
// Key: gocui.MouseLeft,
|
||||
// Modifier: gocui.ModMotion,
|
||||
// Handler: gui.handleMouseDrag,
|
||||
// },
|
||||
{
|
||||
ViewName: "main",
|
||||
Contexts: []string{MAIN_PATCH_BUILDING_CONTEXT_KEY, MAIN_STAGING_CONTEXT_KEY},
|
||||
Key: gocui.MouseLeft,
|
||||
Modifier: gocui.ModMotion,
|
||||
Handler: gui.handleMouseDrag,
|
||||
},
|
||||
{
|
||||
ViewName: "main",
|
||||
Contexts: []string{MAIN_PATCH_BUILDING_CONTEXT_KEY, MAIN_STAGING_CONTEXT_KEY},
|
||||
|
19
vendor/github.com/jesseduffield/gocui/edit.go
generated
vendored
19
vendor/github.com/jesseduffield/gocui/edit.go
generated
vendored
@ -356,17 +356,18 @@ func (v *View) writeRune(x, y int, ch rune) error {
|
||||
}
|
||||
|
||||
olen := len(v.lines[y])
|
||||
w := runewidth.RuneWidth(ch)
|
||||
|
||||
var s []cell
|
||||
if x >= len(v.lines[y]) {
|
||||
s = make([]cell, x-len(v.lines[y])+1)
|
||||
s = make([]cell, x-len(v.lines[y])+w)
|
||||
} else if !v.Overwrite {
|
||||
s = make([]cell, 1)
|
||||
s = make([]cell, w)
|
||||
}
|
||||
v.lines[y] = append(v.lines[y], s...)
|
||||
|
||||
if !v.Overwrite || (v.Overwrite && x >= olen-1) {
|
||||
copy(v.lines[y][x+1:], v.lines[y][x:])
|
||||
if !v.Overwrite || (v.Overwrite && x >= olen-w) {
|
||||
copy(v.lines[y][x+w:], v.lines[y][x:])
|
||||
}
|
||||
v.lines[y][x] = cell{
|
||||
fgColor: v.FgColor,
|
||||
@ -374,6 +375,14 @@ func (v *View) writeRune(x, y int, ch rune) error {
|
||||
chr: ch,
|
||||
}
|
||||
|
||||
for i := 1; i < w; i++ {
|
||||
v.lines[y][x+i] = cell{
|
||||
fgColor: v.FgColor,
|
||||
bgColor: v.BgColor,
|
||||
chr: '\x00',
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -400,7 +409,7 @@ func (v *View) deleteRune(x, y int) (int, error) {
|
||||
w := runewidth.RuneWidth(v.lines[y][i].chr)
|
||||
tw += w
|
||||
if tw > x {
|
||||
v.lines[y] = append(v.lines[y][:i], v.lines[y][i+1:]...)
|
||||
v.lines[y] = append(v.lines[y][:i], v.lines[y][i+w:]...)
|
||||
return w, nil
|
||||
}
|
||||
|
||||
|
5
vendor/github.com/jesseduffield/gocui/keybinding.go
generated
vendored
5
vendor/github.com/jesseduffield/gocui/keybinding.go
generated
vendored
@ -317,8 +317,9 @@ const (
|
||||
|
||||
// Modifiers.
|
||||
const (
|
||||
ModNone Modifier = Modifier(0)
|
||||
ModAlt = Modifier(tcell.ModAlt)
|
||||
ModNone Modifier = Modifier(0)
|
||||
ModAlt = Modifier(tcell.ModAlt)
|
||||
ModMotion = Modifier(2) // just picking an arbitrary number here that doesn't clash with tcell.ModAlt
|
||||
// ModCtrl doesn't work with keyboard keys. Use CtrlKey in Key and ModNone. This is was for mouse clicks only (tcell.v1)
|
||||
// ModCtrl = Modifier(tcell.ModCtrl)
|
||||
)
|
||||
|
35
vendor/github.com/jesseduffield/gocui/tcell_driver.go
generated
vendored
35
vendor/github.com/jesseduffield/gocui/tcell_driver.go
generated
vendored
@ -104,9 +104,18 @@ const (
|
||||
eventRaw
|
||||
)
|
||||
|
||||
const (
|
||||
NOT_DRAGGING int = iota
|
||||
MAYBE_DRAGGING
|
||||
DRAGGING
|
||||
)
|
||||
|
||||
var (
|
||||
lastMouseKey tcell.ButtonMask = tcell.ButtonNone
|
||||
lastMouseMod tcell.ModMask = tcell.ModNone
|
||||
dragState int = NOT_DRAGGING
|
||||
lastX int = 0
|
||||
lastY int = 0
|
||||
)
|
||||
|
||||
// pollEvent get tcell.Event and transform it into gocuiEvent
|
||||
@ -172,6 +181,17 @@ func pollEvent() GocuiEvent {
|
||||
if button != tcell.ButtonNone && lastMouseKey == tcell.ButtonNone {
|
||||
lastMouseKey = button
|
||||
lastMouseMod = tev.Modifiers()
|
||||
switch button {
|
||||
case tcell.ButtonPrimary:
|
||||
mouseKey = MouseLeft
|
||||
dragState = MAYBE_DRAGGING
|
||||
lastX = x
|
||||
lastY = y
|
||||
case tcell.ButtonSecondary:
|
||||
mouseKey = MouseRight
|
||||
case tcell.ButtonMiddle:
|
||||
mouseKey = MouseMiddle
|
||||
}
|
||||
}
|
||||
|
||||
switch tev.Buttons() {
|
||||
@ -179,11 +199,9 @@ func pollEvent() GocuiEvent {
|
||||
if lastMouseKey != tcell.ButtonNone {
|
||||
switch lastMouseKey {
|
||||
case tcell.ButtonPrimary:
|
||||
mouseKey = MouseLeft
|
||||
dragState = NOT_DRAGGING
|
||||
case tcell.ButtonSecondary:
|
||||
mouseKey = MouseRight
|
||||
case tcell.ButtonMiddle:
|
||||
mouseKey = MouseMiddle
|
||||
}
|
||||
mouseMod = Modifier(lastMouseMod)
|
||||
lastMouseMod = tcell.ModNone
|
||||
@ -191,6 +209,17 @@ func pollEvent() GocuiEvent {
|
||||
}
|
||||
}
|
||||
|
||||
switch dragState {
|
||||
// if we haven't released the left mouse button and we've moved the cursor then we're dragging
|
||||
case MAYBE_DRAGGING:
|
||||
if x != lastX || y != lastY {
|
||||
dragState = DRAGGING
|
||||
}
|
||||
case DRAGGING:
|
||||
mouseMod = ModMotion
|
||||
mouseKey = MouseLeft
|
||||
}
|
||||
|
||||
return GocuiEvent{
|
||||
Type: eventMouse,
|
||||
MouseX: x,
|
||||
|
Loading…
x
Reference in New Issue
Block a user