[gnome-builder] vim: implement toggle undo/redo with `U'
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] vim: implement toggle undo/redo with `U'
- Date: Mon, 22 Dec 2014 23:53:30 +0000 (UTC)
commit 1dcc9fb32e228f79fefdfe2df1d7b18a27498779
Author: Christian Hergert <christian hergert me>
Date: Mon Dec 22 15:52:51 2014 -0800
vim: implement toggle undo/redo with `U'
There are probably some semantics I'm missing here. But this gets the
basics working.
src/vim/gb-source-vim.c | 26 ++++++++++++++++++++++++++
1 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/src/vim/gb-source-vim.c b/src/vim/gb-source-vim.c
index f24e105..a2f4aa6 100644
--- a/src/vim/gb-source-vim.c
+++ b/src/vim/gb-source-vim.c
@@ -4576,6 +4576,28 @@ gb_source_vim_cmd_substitute (GbSourceVim *vim,
}
static void
+gb_source_vim_cmd_undo_redo (GbSourceVim *vim,
+ guint count,
+ gchar modifier)
+{
+ GtkTextBuffer *buffer;
+ GtkTextIter iter;
+ GtkTextIter selection;
+ gboolean has_selection;
+
+ g_assert (GB_IS_SOURCE_VIM (vim));
+
+ buffer = gtk_text_view_get_buffer (vim->priv->text_view);
+ if (!GTK_SOURCE_IS_BUFFER (buffer))
+ return;
+
+ if (gtk_source_buffer_can_redo (GTK_SOURCE_BUFFER (buffer)))
+ gb_source_vim_redo (vim);
+ else
+ gb_source_vim_undo (vim);
+}
+
+static void
gb_source_vim_cmd_undo (GbSourceVim *vim,
guint count,
gchar modifier)
@@ -5139,6 +5161,10 @@ gb_source_vim_class_init (GbSourceVimClass *klass)
GB_SOURCE_VIM_COMMAND_FLAG_NONE,
GB_SOURCE_VIM_COMMAND_CHANGE,
gb_source_vim_cmd_undo);
+ gb_source_vim_class_register_command (klass, 'U',
+ GB_SOURCE_VIM_COMMAND_FLAG_NONE,
+ GB_SOURCE_VIM_COMMAND_CHANGE,
+ gb_source_vim_cmd_undo_redo);
gb_source_vim_class_register_command (klass, 'V',
GB_SOURCE_VIM_COMMAND_FLAG_NONE,
GB_SOURCE_VIM_COMMAND_NOOP,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]