diff --git a/cursor.go b/cursor.go index 41da0154ba..61986e58ae 100644 --- a/cursor.go +++ b/cursor.go @@ -3,13 +3,7 @@ package tea import "image" // CursorPositionMsg is a message that represents the terminal cursor position. -type CursorPositionMsg struct { - // Row is the row number. - Row int - - // Column is the column number. - Column int -} +type CursorPositionMsg image.Point // CursorStyle is a style that represents the terminal cursor. type CursorStyle int diff --git a/key_test.go b/key_test.go index aa6670bef8..d7ba77c537 100644 --- a/key_test.go +++ b/key_test.go @@ -64,7 +64,7 @@ func buildBaseSeqTests() []seqTest { // position report having the same sequence. See [parseCsi] for more // information. if f3CurPosRegexp.MatchString(seq) { - st.msgs = []Msg{k, CursorPositionMsg{Row: 1, Column: int(key.Mod) + 1}} + st.msgs = []Msg{k, CursorPositionMsg{Y: 0, X: int(key.Mod)}} } td = append(td, st) } diff --git a/parse.go b/parse.go index 17f81c92bd..6f8c8d1ac4 100644 --- a/parse.go +++ b/parse.go @@ -256,7 +256,7 @@ func parseCsi(b []byte) (int, Msg) { // This report may return a third parameter representing the page // number, but we don't really need it. if paramsLen >= 2 && csi.Param(0) != -1 && csi.Param(1) != -1 { - return i, CursorPositionMsg{Row: csi.Param(0), Column: csi.Param(1)} + return i, CursorPositionMsg{Y: csi.Param(0) - 1, X: csi.Param(1) - 1} } case 'm' | '<'< R (which is modified F3) when the cursor is at the