From dc97c56b178e587e6ed7d86e094e47f0f81e2525 Mon Sep 17 00:00:00 2001 From: Leroy Hopson Date: Sun, 18 Feb 2024 13:52:48 +1300 Subject: [PATCH] Use type Vector2i for get_cursor_pos() Cursor position is always integer. --- addons/godot_xterm/native/src/terminal.cpp | 4 ++-- addons/godot_xterm/native/src/terminal.h | 2 +- test/test_terminal.gd | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/godot_xterm/native/src/terminal.cpp b/addons/godot_xterm/native/src/terminal.cpp index c72d1b6..74d9ca6 100644 --- a/addons/godot_xterm/native/src/terminal.cpp +++ b/addons/godot_xterm/native/src/terminal.cpp @@ -133,8 +133,8 @@ int Terminal::get_rows() const return rows; } -Vector2 Terminal::get_cursor_pos() const { - return Vector2(tsm_screen_get_cursor_x(screen), tsm_screen_get_cursor_y(screen)); +Vector2i Terminal::get_cursor_pos() const { + return Vector2i(tsm_screen_get_cursor_x(screen), tsm_screen_get_cursor_y(screen)); } void Terminal::set_max_scrollback(const int p_max_scrollback) diff --git a/addons/godot_xterm/native/src/terminal.h b/addons/godot_xterm/native/src/terminal.h index 607f025..5eede9b 100644 --- a/addons/godot_xterm/native/src/terminal.h +++ b/addons/godot_xterm/native/src/terminal.h @@ -56,7 +56,7 @@ namespace godot void set_rows(const int p_rows); int get_rows() const; - Vector2 get_cursor_pos() const; + Vector2i get_cursor_pos() const; void set_max_scrollback(const int p_max_scrollback); int get_max_scrollback() const; diff --git a/test/test_terminal.gd b/test/test_terminal.gd index 2990f8f..49c59ad 100644 --- a/test/test_terminal.gd +++ b/test/test_terminal.gd @@ -1,4 +1,4 @@ -class_name TerminalTest extends GutTest +class_name TerminalTest extends "res://addons/gut/test.gd" var terminal: Terminal @@ -27,7 +27,7 @@ class TestCursorPos: extends TerminalTest func test_get_cursor_pos_initial(): - assert_eq(terminal.get_cursor_pos(), Vector2.ZERO) + assert_eq(terminal.get_cursor_pos(), Vector2i.ZERO) func test_get_cursor_pos_x(): terminal.write("_")