expose function for setting cursor position From: Jelle van der Waa --- src/vte/vteterminal.h | 5 +++++ src/vtegtk.cc | 24 ++++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/src/vte/vteterminal.h b/src/vte/vteterminal.h index 7925d1a9..b53a582a 100644 --- a/src/vte/vteterminal.h +++ b/src/vte/vteterminal.h @@ -347,6 +347,11 @@ _VTE_PUBLIC void vte_terminal_get_cursor_position(VteTerminal *terminal, glong *column, glong *row) _VTE_GNUC_NONNULL(1); +_VTE_PUBLIC +void vte_terminal_set_cursor_position(VteTerminal *terminal, + glong column, + glong row) _VTE_GNUC_NONNULL(1); + /* Add a matching expression, returning the tag the widget assigns to that * expression. */ diff --git a/src/vtegtk.cc b/src/vtegtk.cc index 20de9b35..b0039481 100644 --- a/src/vtegtk.cc +++ b/src/vtegtk.cc @@ -2160,6 +2160,30 @@ vte_terminal_get_cursor_position(VteTerminal *terminal, } } +/** + * vte_terminal_set_cursor_position + * @terminal: a #VteTerminal + * @column: the new cursor column + * @row: the new cursor row + * + * Set the location of the cursor. + */ +void +vte_terminal_set_cursor_position(VteTerminal *terminal, + long column, long row) +{ + g_return_if_fail(VTE_IS_TERMINAL(terminal)); + + auto impl = IMPL(terminal); + impl->invalidate_cursor_once(FALSE); + impl->m_screen->cursor.col = column; + impl->m_screen->cursor.row = row; + impl->invalidate_cursor_once(FALSE); + impl->check_cursor_blink(); + impl->queue_cursor_moved(); + +} + /** * vte_terminal_pty_new_sync: * @terminal: a #VteTerminal