From 41b21dfbd47e768d803b59d1507935ad1602d77c Mon Sep 17 00:00:00 2001 From: Jelle van der Waa Date: Sat, 13 Feb 2016 22:01:59 +0100 Subject: [PATCH 1/5] expose functions for pausing unpausing output diff --git a/src/vte/vteterminal.h b/src/vte/vteterminal.h index 18ac0714..d6404220 100644 --- a/src/vte/vteterminal.h +++ b/src/vte/vteterminal.h @@ -175,6 +175,12 @@ void vte_terminal_feed_child_binary(VteTerminal *terminal, const guint8 *data, gsize length) _VTE_GNUC_NONNULL(1); +_VTE_PUBLIC +void vte_terminal_connect_pty_read(VteTerminal *terminal); + +_VTE_PUBLIC +void vte_terminal_disconnect_pty_read(VteTerminal *terminal); + /* Copy currently-selected text to the clipboard, or from the clipboard to * the terminal. */ _VTE_PUBLIC diff --git a/src/vtegtk.cc b/src/vtegtk.cc index c18a178a..6ba8c61c 100644 --- a/src/vtegtk.cc +++ b/src/vtegtk.cc @@ -2917,6 +2917,32 @@ vte_terminal_feed_child(VteTerminal *terminal, IMPL(terminal)->feed_child(text, length); } +/** + * vte_terminal_connect_pty_read: + * @terminal: a #VteTerminal + * + * Unpause output + */ +void +vte_terminal_connect_pty_read(VteTerminal *terminal) +{ + g_return_if_fail(VTE_IS_TERMINAL(terminal)); + IMPL(terminal)->connect_pty_read(); +} + +/** + * vte_terminal_disconnect_pty_read: + * @terminal: a #VteTerminal + * + * Pause output + */ +void +vte_terminal_disconnect_pty_read(VteTerminal *terminal) +{ + g_return_if_fail(VTE_IS_TERMINAL(terminal)); + IMPL(terminal)->disconnect_pty_read(); +} + /** * vte_terminal_feed_child_binary: * @terminal: a #VteTerminal -- 2.25.0 From 05c0f85efe721595464b6b9d794e2663f0f5f10f Mon Sep 17 00:00:00 2001 From: Jelle van der Waa Date: Sat, 13 Feb 2016 22:18:01 +0100 Subject: [PATCH 2/5] expose function for setting cursor position diff --git a/src/vte/vteterminal.h b/src/vte/vteterminal.h index d6404220..af291ba8 100644 --- a/src/vte/vteterminal.h +++ b/src/vte/vteterminal.h @@ -386,6 +386,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, diff --git a/src/vtegtk.cc b/src/vtegtk.cc index 6ba8c61c..66bf05bd 100644 --- a/src/vtegtk.cc +++ b/src/vtegtk.cc @@ -2552,6 +2552,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 -- 2.25.0 From 87f3350ca7af430d30a9680fb91dec73a3314c97 Mon Sep 17 00:00:00 2001 From: Jelle van der Waa Date: Sat, 13 Feb 2016 22:25:19 +0100 Subject: [PATCH 3/5] add function for setting the text selections diff --git a/src/vte/vteterminal.h b/src/vte/vteterminal.h index af291ba8..1827f140 100644 --- a/src/vte/vteterminal.h +++ b/src/vte/vteterminal.h @@ -196,6 +196,10 @@ _VTE_PUBLIC void vte_terminal_select_all(VteTerminal *terminal) _VTE_GNUC_NONNULL(1); _VTE_PUBLIC void vte_terminal_unselect_all(VteTerminal *terminal) _VTE_GNUC_NONNULL(1); +_VTE_PUBLIC +void vte_terminal_select_text(VteTerminal *terminal, long start_col, long start_row, + long end_col, long end_row) _VTE_GNUC_NONNULL(1); + /* By-word selection */ _VTE_PUBLIC diff --git a/src/vtegtk.cc b/src/vtegtk.cc index 66bf05bd..1a190933 100644 --- a/src/vtegtk.cc +++ b/src/vtegtk.cc @@ -2525,6 +2525,26 @@ vte_terminal_unselect_all(VteTerminal *terminal) IMPL(terminal)->deselect_all(); } +/** + * vte_terminal_select_text: + * @terminal: a #VteTerminal + * @start_col: the starting column for the selection + * @start_row: the starting row for the selection + * @end_col: the end column for the selection + * @end_row: the end row for the selection + * + * Sets the current selection region. + */ +void +vte_terminal_select_text(VteTerminal *terminal, + long start_col, long start_row, + long end_col, long end_row) +{ + g_return_if_fail (VTE_IS_TERMINAL (terminal)); + + IMPL(terminal)->select_text(start_col, start_row, end_col, end_row); +} + /** * vte_terminal_get_cursor_position: * @terminal: a #VteTerminal -- 2.25.0 From 7e2a93bdf8cfecd7f2f143f7c02ca5e3e3a3849a Mon Sep 17 00:00:00 2001 From: Jelle van der Waa Date: Sat, 13 Feb 2016 22:38:21 +0100 Subject: [PATCH 4/5] add functions to get/set block selection mode diff --git a/src/vte/vteterminal.h b/src/vte/vteterminal.h index 1827f140..c027dd92 100644 --- a/src/vte/vteterminal.h +++ b/src/vte/vteterminal.h @@ -197,6 +197,11 @@ void vte_terminal_select_all(VteTerminal *terminal) _VTE_GNUC_NONNULL(1); _VTE_PUBLIC void vte_terminal_unselect_all(VteTerminal *terminal) _VTE_GNUC_NONNULL(1); _VTE_PUBLIC +gboolean vte_terminal_get_selection_block_mode(VteTerminal *terminal) _VTE_GNUC_NONNULL(1); +_VTE_PUBLIC +void vte_terminal_set_selection_block_mode(VteTerminal *terminal, + gboolean block_mode) _VTE_GNUC_NONNULL(1); +_VTE_PUBLIC void vte_terminal_select_text(VteTerminal *terminal, long start_col, long start_row, long end_col, long end_row) _VTE_GNUC_NONNULL(1); diff --git a/src/vtegtk.cc b/src/vtegtk.cc index 1a190933..b684492d 100644 --- a/src/vtegtk.cc +++ b/src/vtegtk.cc @@ -2524,6 +2524,31 @@ vte_terminal_unselect_all(VteTerminal *terminal) IMPL(terminal)->deselect_all(); } +/** + * vte_terminal_get_selection_block_mode: + * @terminal: a #VteTerminal + * + * Checks whether or not block selection is enabled. + * + * Returns: %TRUE if block selection is enabled, %FALSE if not + */ + +gboolean vte_terminal_get_selection_block_mode(VteTerminal *terminal) { + g_return_val_if_fail(VTE_IS_TERMINAL(terminal), FALSE); + return IMPL(terminal)->m_selection_block_mode; +} +/** + * vte_terminal_set_selection_block_mode: + * @terminal: a #VteTerminal + * @block_mode: whether block selection is enabled + * + * Sets whether or not block selection is enabled. + */ +void +vte_terminal_set_selection_block_mode(VteTerminal *terminal, gboolean block_mode) { + g_return_if_fail (VTE_IS_TERMINAL (terminal)); + IMPL(terminal)->m_selection_block_mode = block_mode; +} /** * vte_terminal_select_text: -- 2.25.0 From 5f46868476bad435e76e2624ff0a3a85efc53198 Mon Sep 17 00:00:00 2001 From: Jelle van der Waa Date: Sat, 13 Feb 2016 22:47:44 +0100 Subject: [PATCH 5/5] expose function for getting the selected text diff --git a/src/vte/vteterminal.h b/src/vte/vteterminal.h index c027dd92..adf96da6 100644 --- a/src/vte/vteterminal.h +++ b/src/vte/vteterminal.h @@ -204,7 +204,9 @@ void vte_terminal_set_selection_block_mode(VteTerminal *terminal, _VTE_PUBLIC void vte_terminal_select_text(VteTerminal *terminal, long start_col, long start_row, long end_col, long end_row) _VTE_GNUC_NONNULL(1); - +_VTE_PUBLIC +char * +vte_terminal_get_selection(VteTerminal *terminal) _VTE_GNUC_NONNULL(1); /* By-word selection */ _VTE_PUBLIC diff --git a/src/vtegtk.cc b/src/vtegtk.cc index b684492d..e405841c 100644 --- a/src/vtegtk.cc +++ b/src/vtegtk.cc @@ -2570,6 +2570,13 @@ vte_terminal_select_text(VteTerminal *terminal, IMPL(terminal)->select_text(start_col, start_row, end_col, end_row); } +char * +vte_terminal_get_selection(VteTerminal *terminal) +{ + g_return_val_if_fail(VTE_IS_TERMINAL(terminal), NULL); + return g_strdup (IMPL(terminal)->m_selection[VTE_SELECTION_PRIMARY]->str); +} + /** * vte_terminal_get_cursor_position: * @terminal: a #VteTerminal -- 2.25.0