diff options
author | Christian Persch <chpe@src.gnome.org> | 2022-07-22 21:39:12 +0200 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2022-07-22 21:39:12 +0200 |
commit | 93e3d17cbb45b636a298d27a9af223a4e405382e (patch) | |
tree | 4119bb5dc07cb80bad7a638152699bc701d0c110 | |
parent | 0a663194fc1d4c9f5c2f952f6ccfea8a8a4719f7 (diff) | |
download | vte-93e3d17cbb45b636a298d27a9af223a4e405382e.tar.gz |
widget: Add format arg to new API to get selected text
-rw-r--r-- | src/vte/vteterminal.h | 3 | ||||
-rw-r--r-- | src/vtegtk.cc | 12 |
2 files changed, 11 insertions, 4 deletions
diff --git a/src/vte/vteterminal.h b/src/vte/vteterminal.h index 6f8a7751..43d4f920 100644 --- a/src/vte/vteterminal.h +++ b/src/vte/vteterminal.h @@ -359,7 +359,8 @@ _VTE_PUBLIC gboolean vte_terminal_get_has_selection(VteTerminal *terminal) _VTE_CXX_NOEXCEPT _VTE_GNUC_NONNULL(1); _VTE_PUBLIC -char* vte_terminal_get_text_selected(VteTerminal* terminal) _VTE_CXX_NOEXCEPT _VTE_GNUC_NONNULL(1); +char* vte_terminal_get_text_selected(VteTerminal* terminal, + VteFormat format) _VTE_CXX_NOEXCEPT _VTE_GNUC_NONNULL(1); /* Set what happens when the user strikes backspace or delete. */ _VTE_PUBLIC diff --git a/src/vtegtk.cc b/src/vtegtk.cc index 034c023b..4eb92487 100644 --- a/src/vtegtk.cc +++ b/src/vtegtk.cc @@ -5579,19 +5579,25 @@ catch (...) /** * vte_terminal_get_text_selected: * @terminal: a #VteTerminal + * @format: the #VteFormat to use * - * Gets the currently selected text. + * Gets the currently selected text in the format specified by @format. + * Note that currently, only %VTE_FORMAT_TEXT is supported. * - * Returns: (transfer full) (nullable): a newly allocated string containing the selected text, or %NULL if there is no selection + * Returns: (transfer full) (nullable): a newly allocated string containing the selected text, or %NULL if there is no selection or the format is not supported * * Since: 0.70 */ char* -vte_terminal_get_text_selected(VteTerminal* terminal) noexcept +vte_terminal_get_text_selected(VteTerminal* terminal, + VteFormat format) noexcept try { g_return_val_if_fail(VTE_IS_TERMINAL(terminal), nullptr); + if (format != VTE_FORMAT_TEXT) + return nullptr; + auto const selection = IMPL(terminal)->m_selection_resolved; return vte_terminal_get_text_range(terminal, selection.start_row(), |