Remove the unused Timestamp of replayed input events

Every caller passes 0, and nothing reads it. The next commit makes
replayed mouse events carry the time they were created; a second, unused
timestamp next to it would only confuse.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Stefan HallerandClaude Opus 5.5 committed 2026-10-14 14:14:08 +02:00
1 parent 9e76ed7c03
commit 0855e981cf
2 files changed
+16 -30

No files matched your search

+16 -24
View File
@@ -217,20 +217,18 @@ var (
// this wrapper struct has public keys so we can easily serialize/deserialize to JSON
type TcellKeyEventWrapper struct {
Timestamp int64
Mod tcell.ModMask
Key tcell.Key
Ch string
Mod tcell.ModMask
Key tcell.Key
Ch string
task Task // see GocuiEvent.task
}
func NewTcellKeyEventWrapper(event *tcell.EventKey, timestamp int64) *TcellKeyEventWrapper {
func NewTcellKeyEventWrapper(event *tcell.EventKey) *TcellKeyEventWrapper {
return &TcellKeyEventWrapper{
Timestamp: timestamp,
Mod: event.Modifiers(),
Key: event.Key(),
Ch: event.Str(),
Mod: event.Modifiers(),
Key: event.Key(),
Ch: event.Str(),
}
}
@@ -239,7 +237,6 @@ func (wrapper TcellKeyEventWrapper) toTcellEvent() tcell.Event {
}
type TcellMouseEventWrapper struct {
Timestamp int64
X int
Y int
ButtonMask tcell.ButtonMask
@@ -248,10 +245,9 @@ type TcellMouseEventWrapper struct {
task Task // see GocuiEvent.task
}
func NewTcellMouseEventWrapper(event *tcell.EventMouse, timestamp int64) *TcellMouseEventWrapper {
func NewTcellMouseEventWrapper(event *tcell.EventMouse) *TcellMouseEventWrapper {
x, y := event.Position()
return &TcellMouseEventWrapper{
Timestamp: timestamp,
X: x,
Y: y,
ButtonMask: event.Buttons(),
@@ -264,18 +260,16 @@ func (wrapper TcellMouseEventWrapper) toTcellEvent() tcell.Event {
}
type TcellResizeEventWrapper struct {
Timestamp int64
Width int
Height int
Width int
Height int
}
func NewTcellResizeEventWrapper(event *tcell.EventResize, timestamp int64) *TcellResizeEventWrapper {
func NewTcellResizeEventWrapper(event *tcell.EventResize) *TcellResizeEventWrapper {
w, h := event.Size()
return &TcellResizeEventWrapper{
Timestamp: timestamp,
Width: w,
Height: h,
Width: w,
Height: h,
}
}
@@ -284,16 +278,14 @@ func (wrapper TcellResizeEventWrapper) toTcellEvent() tcell.Event {
}
type TcellFocusEventWrapper struct {
Timestamp int64
Focused bool
Focused bool
task Task // see GocuiEvent.task
}
func NewTcellFocusEventWrapper(event *tcell.EventFocus, timestamp int64) *TcellFocusEventWrapper {
func NewTcellFocusEventWrapper(event *tcell.EventFocus) *TcellFocusEventWrapper {
return &TcellFocusEventWrapper{
Timestamp: timestamp,
Focused: event.Focused,
Focused: event.Focused,
}
}
-6
View File
@@ -43,7 +43,6 @@ func (self *GuiDriver) PressKeysRapidly(keyStrs ...string) {
self.gui.g.ReplayKeyEvent(gocui.NewTcellKeyEventWrapper(
tcell.NewEventKey(tcell.Key(key.KeyName()), key.Str(), tcell.ModMask(key.Mod())),
0,
))
}
@@ -115,7 +114,6 @@ func (self *GuiDriver) replayMouseEventWithoutWaiting(
) {
self.gui.g.ReplayMouseEvent(gocui.NewTcellMouseEventWrapper(
tcell.NewEventMouse(x, y, buttons, tcell.ModMask(modifier)),
0,
))
}
@@ -125,11 +123,9 @@ func (self *GuiDriver) replayMouseEventWithoutWaiting(
func (self *GuiDriver) replayFocusIn() {
self.gui.g.ReplayFocusEvent(gocui.NewTcellFocusEventWrapper(
tcell.NewEventFocus(false),
0,
))
self.gui.g.ReplayFocusEvent(gocui.NewTcellFocusEventWrapper(
tcell.NewEventFocus(true),
0,
))
}
@@ -148,12 +144,10 @@ func (self *GuiDriver) FocusInAndClick(x, y int) {
self.replayFocusIn()
self.gui.g.ReplayMouseEvent(gocui.NewTcellMouseEventWrapper(
tcell.NewEventMouse(x, y, tcell.ButtonPrimary, 0),
0,
))
self.waitTillIdle()
self.gui.g.ReplayMouseEvent(gocui.NewTcellMouseEventWrapper(
tcell.NewEventMouse(x, y, tcell.ButtonNone, 0),
0,
))
self.waitTillIdle()
}