[vte] widget: Add format arg to new API to get selected text



commit 93e3d17cbb45b636a298d27a9af223a4e405382e
Author: Christian Persch <chpe src gnome org>
Date:   Fri Jul 22 21:39:12 2022 +0200

    widget: Add format arg to new API to get selected text

 src/vte/vteterminal.h |  3 ++-
 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(),


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]