Skip to content

Commit

Permalink
expose function for setting cursor position
Browse files Browse the repository at this point in the history
  • Loading branch information
jelly committed Nov 1, 2017
1 parent 1ef7b9b commit 545d2a1
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/vte/vteterminal.h
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,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);


_VTE_PUBLIC
char *vte_terminal_hyperlink_check_event(VteTerminal *terminal,
Expand Down
24 changes: 24 additions & 0 deletions src/vtegtk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2287,6 +2287,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
Expand Down

0 comments on commit 545d2a1

Please sign in to comment.