diff --git a/addons/godot_xterm/native/src/terminal.cpp b/addons/godot_xterm/native/src/terminal.cpp index 512e18c..bc5294d 100644 --- a/addons/godot_xterm/native/src/terminal.cpp +++ b/addons/godot_xterm/native/src/terminal.cpp @@ -52,6 +52,7 @@ void Terminal::_bind_methods() // Methods. ClassDB::bind_method(D_METHOD("write", "data"), &Terminal::write); + ClassDB::bind_method(D_METHOD("get_cursor_pos"), &Terminal::get_cursor_pos); } Terminal::Terminal() @@ -104,6 +105,10 @@ 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)); +} + void Terminal::set_max_scrollback(const int p_max_scrollback) { max_scrollback = std::max(0, p_max_scrollback); diff --git a/addons/godot_xterm/native/src/terminal.h b/addons/godot_xterm/native/src/terminal.h index 70aa2b7..ad09827 100644 --- a/addons/godot_xterm/native/src/terminal.h +++ b/addons/godot_xterm/native/src/terminal.h @@ -48,6 +48,8 @@ namespace godot void set_rows(const int p_rows); int get_rows() const; + Vector2 get_cursor_pos() const; + void set_max_scrollback(const int p_max_scrollback); int get_max_scrollback() const;