[gnome-builder] libide: allow replaying a macro multiple times
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] libide: allow replaying a macro multiple times
- Date: Tue, 24 Mar 2015 00:13:50 +0000 (UTC)
commit 02aad8f7deff242d2640a1692ff59e0e690503df
Author: Christian Hergert <christian hergert me>
Date: Thu Mar 12 01:42:13 2015 -0700
libide: allow replaying a macro multiple times
data/keybindings/vim.css | 2 +-
libide/ide-source-view.c | 16 ++++++++++++----
libide/ide-source-view.h | 3 ++-
3 files changed, 15 insertions(+), 6 deletions(-)
---
diff --git a/data/keybindings/vim.css b/data/keybindings/vim.css
index ba3b2b6..6a677a5 100644
--- a/data/keybindings/vim.css
+++ b/data/keybindings/vim.css
@@ -120,7 +120,7 @@
"set-mode" ("vim-normal-with-count", transient) };
/* replay the last recording */
- bind "period" { "replay-macro" () };
+ bind "period" { "replay-macro" (1) };
/* insert at cursor */
bind "i" { "begin-macro" ()
diff --git a/libide/ide-source-view.c b/libide/ide-source-view.c
index 9d31f8d..c41b1d9 100644
--- a/libide/ide-source-view.c
+++ b/libide/ide-source-view.c
@@ -3307,10 +3307,13 @@ ide_source_view_real_end_macro (IdeSourceView *self)
}
static void
-ide_source_view_real_replay_macro (IdeSourceView *self)
+ide_source_view_real_replay_macro (IdeSourceView *self,
+ gboolean use_count)
{
IdeSourceViewPrivate *priv = ide_source_view_get_instance_private (self);
IdeSourceViewCapture *capture;
+ guint count = 1;
+ gsize i;
g_assert (IDE_IS_SOURCE_VIEW (self));
@@ -3326,9 +3329,13 @@ ide_source_view_real_replay_macro (IdeSourceView *self)
return;
}
+ if (use_count)
+ count = MAX (1, priv->count);
+
priv->in_replay_macro = TRUE;
capture = priv->capture, priv->capture = NULL;
- ide_source_view_capture_replay (capture);
+ for (i = 0; i < count; i++)
+ ide_source_view_capture_replay (capture);
g_clear_object (&priv->capture);
priv->capture = capture, capture = NULL;
priv->in_replay_macro = FALSE;
@@ -3940,9 +3947,10 @@ ide_source_view_class_init (IdeSourceViewClass *klass)
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
G_STRUCT_OFFSET (IdeSourceViewClass, replay_macro),
NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
+ g_cclosure_marshal_VOID__BOOLEAN,
G_TYPE_NONE,
- 0);
+ 1,
+ G_TYPE_BOOLEAN);
gSignals [RESTORE_INSERT_MARK] =
g_signal_new ("restore-insert-mark",
diff --git a/libide/ide-source-view.h b/libide/ide-source-view.h
index 13da534..1fd8f41 100644
--- a/libide/ide-source-view.h
+++ b/libide/ide-source-view.h
@@ -244,7 +244,8 @@ struct _IdeSourceViewClass
IdeSourceSnippet *snippet,
IdeSourceSnippetContext *context,
const GtkTextIter *location);
- void (*replay_macro) (IdeSourceView *self);
+ void (*replay_macro) (IdeSourceView *self,
+ gboolean use_count);
void (*restore_insert_mark) (IdeSourceView *self);
void (*save_insert_mark) (IdeSourceView *self);
void (*selection_theatric) (IdeSourceView *self,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]