After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 617607 - Add API for accessing selected text
Add API for accessing selected text
Status: RESOLVED OBSOLETE
Product: vte
Classification: Core
Component: general
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: VTE Maintainers
VTE Maintainers
: 723007 (view as bug list)
Depends on:
Blocks: 617608
 
 
Reported: 2010-05-04 05:49 UTC by Behdad Esfahbod
Modified: 2021-06-10 14:23 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
expose the get_selection function (2.24 KB, patch)
2012-07-30 17:13 UTC, Daniel Micay
none Details | Review

Description Behdad Esfahbod 2010-05-04 05:49:34 UTC
Surprisingly not there.
Comment 1 Daniel Micay 2012-07-30 17:13:34 UTC
Created attachment 219918 [details] [review]
expose the get_selection function
Comment 2 Daniel Micay 2012-07-30 17:14:14 UTC
It's actually possible to get the current selection with the AtkText API, but it would be nice if this was exposed directly.

This is what can be done right now:

    AtkText *text = ATK_TEXT(vte_terminal_accessible_new(vte);
    char *selection = atk_text_get_selection(text, 0, NULL, NULL);
    g_free(selection);

Attached above is a patch to just expose the _vte_terminal_get_selection function directly with documentation to keep things simple.
Comment 3 Christian Persch 2014-04-12 15:48:54 UTC
*** Bug 723007 has been marked as a duplicate of this bug. ***
Comment 4 Christian Persch 2015-12-26 13:08:24 UTC
Was there a specific use case you had in mind for this? I'd rather not add this just to be 'API complete' :-)
Comment 5 Daniel Micay 2015-12-27 11:06:52 UTC
Adding keybindings for opening patterns matched by the search functionality. It wouldn't be usable for that if the search functionality moved away from using text selection as a cursor but that's convenient. There are probably other use cases but I haven't wanted it for anything else myself.
Comment 6 Behdad Esfahbod 2015-12-27 21:51:18 UTC
I can *imagine* a lot of usecases, like, one to look up your selection in Google Search or Wikipedia and offer a link, etc...
Comment 7 GNOME Infrastructure Team 2021-06-10 14:23:42 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/vte/-/issues/1801.