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 307757 - Allow retrieving the last undo/redo action in string format
Allow retrieving the last undo/redo action in string format
Product: gtksourceview
Classification: Platform
Component: General
git master
Other All
: Normal enhancement
: ---
Assigned To: GTK Sourceview maintainers
GTK Sourceview maintainers
Depends on: 326622
Reported: 2005-06-15 12:09 UTC by Raphael Slinckx
Modified: 2020-11-13 23:32 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement

gtksourceview-action.patch (19.48 KB, patch)
2005-06-15 12:15 UTC, Raphael Slinckx
none Details | Review
gedit-undo.patch (6.82 KB, patch)
2005-06-15 12:18 UTC, Raphael Slinckx
none Details | Review
gtksourceview-action.patch (19.85 KB, patch)
2005-06-15 16:10 UTC, Raphael Slinckx
none Details | Review
gedit-undo.patch (4.87 KB, patch)
2005-06-15 16:11 UTC, Raphael Slinckx
none Details | Review

Description Raphael Slinckx 2005-06-15 12:09:09 UTC
This allows one to retreive the action that will be performed by a undo/redo as
a string.

For example "deletion of 'xxx'" or "typing of line feed"

For the moment three special cases are handled: the line feed, the space, and
the tab, more can be added if necessary.
Comment 1 Raphael Slinckx 2005-06-15 12:15:16 UTC
Created attachment 47799 [details] [review]

First version of the patch:
* implement two new functions:
gchar * gtk_source_undo_manager_get_undo_action (GtkSourceUndoManager *um);
gchar * gtk_source_undo_manager_get_redo_action (GtkSourceUndoManager *um);

returning the string of the action that would be performed for an undo/redo

* update the test widget to use an undo/redo label that is dynamically updated
 (it contains a leak, for the UndoRedoData but is it important ?)

* Change the way signals are emitted, this is the most controversial change,
but i don't think it should be a problem since the semantic of the function is
preserved, the only difference is that it is emitted more often.

Instead of emitting a "can-undo" and "can-redo" signal only when they switch
state, I emit them everytime an new undo action is available, this is to allow
programs to update their labels "live" with undo actions. The other solution
would be to have new signals, but i don't think it is necessary.
Comment 2 Raphael Slinckx 2005-06-15 12:18:03 UTC
Created attachment 47800 [details] [review]

First version of the patch.

Implements the new undo action feature in gedit (new_mdi branch).

The toolbars keep their label short, but the menu items show the action.

An arbitrary limit of 25 is used to truncate the action, this has naty side
effects. Maybe the gtksourcebuffer should return a struct containing the string
alone and the type of the action (delete/insert), so we can truncate only the
text, not the action..
Comment 3 Raphael Slinckx 2005-06-15 16:10:58 UTC
Created attachment 47820 [details] [review]

New version.

Truncate the text inside the action in gtksourceview, not in gedit.
Try to be smart about spaces and things
Comment 4 Raphael Slinckx 2005-06-15 16:11:58 UTC
Created attachment 47821 [details] [review]

New version:
Remove troncature from gedit since it's done in gtksourceview
Clea format

I forgot to add popup menu undo item also shows the action in new gtksourceview
Comment 5 Carnë Draug 2011-06-01 00:45:24 UTC

If this was ever implemented, it doesn't appear on the menu or the text of the toolbar buttons anymore. Is this going to be implemented? Or has since then been removed on purpose? If so, this bug should probably be closed.
Comment 6 Christian Hergert 2020-11-13 23:32:32 UTC
We are in deep freeze for the 3.x series, and 4.x isn't getting new API at this point. For GTK 4 (GtkSourceView 5), the undo management has been pushed into GTK directly so it is no longer something we can expose here.