This thread contains a patchset. You're looking at the original emails,
but you may wish to use the patch review UI.
Review patch
2
[PATCH v2 1/3] Prevent the part-switcher from acting on events not meant for it
---
widgets/msgviewer.go | 2 ++
1 file changed, 2 insertions(+)
diff --git a/widgets/msgviewer.go b/widgets/msgviewer.go
index 6c69577..406185e 100644
--- a/widgets/msgviewer.go
+++ b/widgets/msgviewer.go
@@ -405,6 +405,7 @@ func (ps *PartSwitcher) MouseEvent(localX int, localY int, event tcell.Event) {
y := ps.height - height
if localY < y && ps.parts[ps.selected].term != nil {
ps.parts[ps.selected].term.MouseEvent(localX, localY, event)
+ return
}
if ps.parts[ps.selected].term != nil {
ps.parts[ps.selected].term.Focus(false)
@@ -418,6 +419,7 @@ func (ps *PartSwitcher) MouseEvent(localX int, localY int, event tcell.Event) {
y := ps.height - height
if localY < y && ps.parts[ps.selected].term != nil {
ps.parts[ps.selected].term.MouseEvent(localX, localY, event)
+ return
}
if ps.parts[ps.selected].term != nil {
ps.parts[ps.selected].term.Focus(false)
--
2.29.2
[PATCH v2 2/3] Pass mouse events to the undeliying terminal widget
---
widgets/terminal.go | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/widgets/terminal.go b/widgets/terminal.go
index 77da71e..5342891 100644
--- a/widgets/terminal.go
+++ b/widgets/terminal.go
@@ -324,6 +324,22 @@ func (term *Terminal) MouseEvent(localX int, localY int, event tcell.Event) {
if term.closed {
return
}
+ button := event.Buttons()
+ internal_value := int(button)
+ switch button {
+ case tcell.WheelUp:
+ internal_value = 4
+ case tcell.WheelDown:
+ internal_value = 5
+ case tcell.WheelRight:
+ internal_value = 6
+ case tcell.WheelLeft:
+ internal_value = 7
+ }
+ term.vterm.MouseMove(localX, localY, convertMods(event.Modifiers()))
+ term.vterm.MouseButton(internal_value, button == tcell.ButtonNone,
+ convertMods(event.Modifiers()))
+ term.flushTerminal()
}
}
--
2.29.2
[PATCH v2 3/3] Correctly pass MouseEvents to the terminal widget when a message only has one part
---
widgets/msgviewer.go | 4 ++--
widgets/terminal.go | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/widgets/msgviewer.go b/widgets/msgviewer.go
index 406185e..ffc0161 100644
--- a/widgets/msgviewer.go
+++ b/widgets/msgviewer.go
@@ -403,7 +403,7 @@ func (ps *PartSwitcher) MouseEvent(localX int, localY int, event tcell.Event) {
case tcell.WheelDown:
height := len(ps.parts)
y := ps.height - height
- if localY < y && ps.parts[ps.selected].term != nil {
+ if ps.height == 0 || (localY < y && ps.parts[ps.selected].term != nil) {
ps.parts[ps.selected].term.MouseEvent(localX, localY, event)
return
}
@@ -417,7 +417,7 @@ func (ps *PartSwitcher) MouseEvent(localX int, localY int, event tcell.Event) {
case tcell.WheelUp:
height := len(ps.parts)
y := ps.height - height
- if localY < y && ps.parts[ps.selected].term != nil {
+ if ps.height == 0 || (localY < y && ps.parts[ps.selected].term != nil) {
ps.parts[ps.selected].term.MouseEvent(localX, localY, event)
return
}
diff --git a/widgets/terminal.go b/widgets/terminal.go
index 5342891..3cda421 100644
--- a/widgets/terminal.go
+++ b/widgets/terminal.go
@@ -9,7 +9,7 @@ import (
"git.sr.ht/~sircmpwn/aerc/lib/ui"
"github.com/creack/pty"
- "github.com/ddevault/go-libvterm"
+ "git.sr.ht/~sircmpwn/go-libvterm"
"github.com/gdamore/tcell"
)
--
2.29.2