[gnome-builder/wip/libide-merge: 31/35] remove undo hack for now, its too brittle
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/libide-merge: 31/35] remove undo hack for now, its too brittle
- Date: Thu, 19 Mar 2015 08:57:09 +0000 (UTC)
commit 3c630da660eb64beb251e358bb4d1ddf4e94e668
Author: Christian Hergert <christian hergert me>
Date: Thu Mar 19 01:11:40 2015 -0700
remove undo hack for now, its too brittle
data/keybindings/vim.css | 33 ++-------------------------------
libide/ide-source-view-mode.c | 19 -------------------
libide/ide-source-view-mode.h | 1 -
libide/ide-source-view.c | 36 +-----------------------------------
4 files changed, 3 insertions(+), 86 deletions(-)
---
diff --git a/data/keybindings/vim.css b/data/keybindings/vim.css
index fd0c8fd..00a12bf 100644
--- a/data/keybindings/vim.css
+++ b/data/keybindings/vim.css
@@ -316,16 +316,12 @@
"clear-count" () };
/* undo - todo: how do we land cursor on right spot? */
- bind "u" { "end-user-action" ()
- "undo" ()
- "begin-user-action" ()
+ bind "u" { "undo" ()
"clear-count" ()
"clear-selection" ()};
/* redo */
- bind "<ctrl>r" { "end-user-action" ()
- "redo" ()
- "begin-user-action" ()
+ bind "<ctrl>r" { "redo" ()
"clear-count" ()
"clear-selection" () };
@@ -1259,7 +1255,6 @@
IdeSourceViewMode.default,
IdeSourceViewMode.vim-normal {
-IdeSourceViewMode-suppress-unbound: true;
- -IdeSourceViewMode-coalesce-undo: true;
-IdeSourceViewMode-block-cursor: true;
-IdeSourceViewMode-keep-mark-on-char: true;
@@ -1269,7 +1264,6 @@ IdeSourceViewMode.vim-normal {
IdeSourceViewMode.vim-normal-with-count {
-IdeSourceViewMode-suppress-unbound: true;
- -IdeSourceViewMode-coalesce-undo: true;
-IdeSourceViewMode-block-cursor: true;
gtk-key-bindings: builder-vim-source-view,
@@ -1279,7 +1273,6 @@ IdeSourceViewMode.vim-normal-with-count {
IdeSourceViewMode.vim-normal-bracket {
-IdeSourceViewMode-suppress-unbound: true;
- -IdeSourceViewMode-coalesce-undo: true;
-IdeSourceViewMode-block-cursor: true;
gtk-key-bindings: builder-vim-source-view,
@@ -1288,7 +1281,6 @@ IdeSourceViewMode.vim-normal-bracket {
IdeSourceViewMode.vim-normal-c {
-IdeSourceViewMode-suppress-unbound: true;
- -IdeSourceViewMode-coalesce-undo: true;
-IdeSourceViewMode-block-cursor: true;
gtk-key-bindings: builder-vim-source-view,
@@ -1297,7 +1289,6 @@ IdeSourceViewMode.vim-normal-c {
IdeSourceViewMode.vim-normal-c-i {
-IdeSourceViewMode-suppress-unbound: true;
- -IdeSourceViewMode-coalesce-undo: true;
-IdeSourceViewMode-block-cursor: true;
gtk-key-bindings: builder-vim-source-view,
@@ -1306,7 +1297,6 @@ IdeSourceViewMode.vim-normal-c-i {
IdeSourceViewMode.vim-normal-d {
-IdeSourceViewMode-suppress-unbound: true;
- -IdeSourceViewMode-coalesce-undo: true;
-IdeSourceViewMode-block-cursor: true;
gtk-key-bindings: builder-vim-source-view,
@@ -1315,7 +1305,6 @@ IdeSourceViewMode.vim-normal-d {
IdeSourceViewMode.vim-normal-d-g {
-IdeSourceViewMode-suppress-unbound: true;
- -IdeSourceViewMode-coalesce-undo: true;
-IdeSourceViewMode-block-cursor: true;
gtk-key-bindings: builder-vim-source-view,
@@ -1324,7 +1313,6 @@ IdeSourceViewMode.vim-normal-d-g {
IdeSourceViewMode.vim-normal-d-i {
-IdeSourceViewMode-suppress-unbound: true;
- -IdeSourceViewMode-coalesce-undo: true;
-IdeSourceViewMode-block-cursor: true;
gtk-key-bindings: builder-vim-source-view,
@@ -1333,7 +1321,6 @@ IdeSourceViewMode.vim-normal-d-i {
IdeSourceViewMode.vim-normal-g {
-IdeSourceViewMode-suppress-unbound: true;
- -IdeSourceViewMode-coalesce-undo: true;
-IdeSourceViewMode-block-cursor: true;
gtk-key-bindings: builder-vim-source-view,
@@ -1342,7 +1329,6 @@ IdeSourceViewMode.vim-normal-g {
IdeSourceViewMode.vim-normal-g-u {
-IdeSourceViewMode-suppress-unbound: true;
- -IdeSourceViewMode-coalesce-undo: true;
-IdeSourceViewMode-block-cursor: true;
gtk-key-bindings: builder-vim-source-view,
@@ -1351,7 +1337,6 @@ IdeSourceViewMode.vim-normal-g-u {
IdeSourceViewMode.vim-normal-q {
-IdeSourceViewMode-suppress-unbound: true;
- -IdeSourceViewMode-coalesce-undo: true;
-IdeSourceViewMode-block-cursor: true;
gtk-key-bindings: builder-vim-source-view,
@@ -1360,7 +1345,6 @@ IdeSourceViewMode.vim-normal-q {
IdeSourceViewMode.vim-normal-indent {
-IdeSourceViewMode-suppress-unbound: true;
- -IdeSourceViewMode-coalesce-undo: true;
-IdeSourceViewMode-block-cursor: true;
gtk-key-bindings: builder-vim-source-view,
@@ -1369,7 +1353,6 @@ IdeSourceViewMode.vim-normal-indent {
IdeSourceViewMode.vim-normal-ctrl-w {
-IdeSourceViewMode-suppress-unbound: true;
- -IdeSourceViewMode-coalesce-undo: true;
-IdeSourceViewMode-block-cursor: true;
gtk-key-bindings: builder-vim-source-view,
@@ -1378,7 +1361,6 @@ IdeSourceViewMode.vim-normal-ctrl-w {
IdeSourceViewMode.vim-normal-y {
-IdeSourceViewMode-suppress-unbound: true;
- -IdeSourceViewMode-coalesce-undo: true;
-IdeSourceViewMode-block-cursor: true;
gtk-key-bindings: builder-vim-source-view,
@@ -1387,7 +1369,6 @@ IdeSourceViewMode.vim-normal-y {
IdeSourceViewMode.vim-normal-z {
-IdeSourceViewMode-suppress-unbound: true;
- -IdeSourceViewMode-coalesce-undo: true;
-IdeSourceViewMode-block-cursor: true;
gtk-key-bindings: builder-vim-source-view,
@@ -1396,7 +1377,6 @@ IdeSourceViewMode.vim-normal-z {
IdeSourceViewMode.vim-insert {
-IdeSourceViewMode-suppress-unbound: false;
- -IdeSourceViewMode-coalesce-undo: true;
-IdeSourceViewMode-block-cursor: false;
gtk-key-bindings: builder-vim-source-view,
@@ -1405,7 +1385,6 @@ IdeSourceViewMode.vim-insert {
IdeSourceViewMode.vim-visual {
-IdeSourceViewMode-suppress-unbound: true;
- -IdeSourceViewMode-coalesce-undo: true;
-IdeSourceViewMode-block-cursor: true;
gtk-key-bindings: builder-vim-source-view,
@@ -1414,7 +1393,6 @@ IdeSourceViewMode.vim-visual {
IdeSourceViewMode.vim-visual-with-count {
-IdeSourceViewMode-suppress-unbound: true;
- -IdeSourceViewMode-coalesce-undo: true;
-IdeSourceViewMode-block-cursor: true;
-IdeSourceViewMode-default-mode: "vim-visual";
@@ -1425,7 +1403,6 @@ IdeSourceViewMode.vim-visual-with-count {
IdeSourceViewMode.vim-visual-g {
-IdeSourceViewMode-suppress-unbound: true;
- -IdeSourceViewMode-coalesce-undo: true;
-IdeSourceViewMode-block-cursor: true;
gtk-key-bindings: builder-vim-source-view,
@@ -1434,7 +1411,6 @@ IdeSourceViewMode.vim-visual-g {
IdeSourceViewMode.vim-visual-z {
-IdeSourceViewMode-suppress-unbound: true;
- -IdeSourceViewMode-coalesce-undo: true;
-IdeSourceViewMode-block-cursor: true;
gtk-key-bindings: builder-vim-source-view,
@@ -1443,7 +1419,6 @@ IdeSourceViewMode.vim-visual-z {
IdeSourceViewMode.vim-visual-line {
-IdeSourceViewMode-suppress-unbound: true;
- -IdeSourceViewMode-coalesce-undo: true;
-IdeSourceViewMode-block-cursor: true;
gtk-key-bindings: builder-vim-source-view,
@@ -1452,7 +1427,6 @@ IdeSourceViewMode.vim-visual-line {
IdeSourceViewMode.vim-visual-line-with-count {
-IdeSourceViewMode-suppress-unbound: true;
- -IdeSourceViewMode-coalesce-undo: true;
-IdeSourceViewMode-block-cursor: true;
-IdeSourceViewMode-default-mode: "vim-visual-line";
@@ -1463,7 +1437,6 @@ IdeSourceViewMode.vim-visual-line-with-count {
IdeSourceViewMode.vim-visual-line-g {
-IdeSourceViewMode-suppress-unbound: true;
- -IdeSourceViewMode-coalesce-undo: true;
-IdeSourceViewMode-block-cursor: true;
gtk-key-bindings: builder-vim-source-view,
@@ -1472,7 +1445,6 @@ IdeSourceViewMode.vim-visual-line-g {
IdeSourceViewMode.vim-visual-line-z {
-IdeSourceViewMode-suppress-unbound: true;
- -IdeSourceViewMode-coalesce-undo: true;
-IdeSourceViewMode-block-cursor: true;
gtk-key-bindings: builder-vim-source-view,
@@ -1481,7 +1453,6 @@ IdeSourceViewMode.vim-visual-line-z {
IdeSourceViewMode.vim-visual-block {
-IdeSourceViewMode-suppress-unbound: true;
- -IdeSourceViewMode-coalesce-undo: true;
-IdeSourceViewMode-block-cursor: true;
gtk-key-bindings: builder-vim-source-view, builder-vim-source-view-visual-block;
diff --git a/libide/ide-source-view-mode.c b/libide/ide-source-view-mode.c
index c73bfb5..fd14d68 100644
--- a/libide/ide-source-view-mode.c
+++ b/libide/ide-source-view-mode.c
@@ -111,16 +111,6 @@ ide_source_view_mode_get_repeat_insert_with_count (IdeSourceViewMode *self)
}
gboolean
-ide_source_view_mode_get_coalesce_undo (IdeSourceViewMode *self)
-{
- /*
- * try to coalesce all the undo from the mode into a single
- * undo. not perfect, but we try hard. useful for emulating vim.
- */
- return get_boolean_param (self, "coalesce-undo");
-}
-
-gboolean
ide_source_view_mode_get_suppress_unbound (IdeSourceViewMode *self)
{
/*
@@ -264,14 +254,6 @@ ide_source_view_mode_class_init (IdeSourceViewModeClass *klass)
g_object_class_install_property (object_class, PROP_NAME, gParamSpecs [PROP_NAME]);
gtk_widget_class_install_style_property (GTK_WIDGET_CLASS (klass),
- g_param_spec_boolean ("coalesce-undo",
- "Coalesce Undo",
- "Coalesce Undo Items",
- FALSE,
- (G_PARAM_READABLE |
- G_PARAM_STATIC_STRINGS)));
-
- gtk_widget_class_install_style_property (GTK_WIDGET_CLASS (klass),
g_param_spec_boolean ("suppress-unbound",
"Supress Unbound",
"Suppress Unbound Keypresses",
@@ -462,7 +444,6 @@ _ide_source_view_mode_new (GtkWidget *view,
priv->type = type;
priv->default_mode = get_string_param (mode, "default-mode");
- IDE_TRACE_MSG ("coalesce_undo = %d", ide_source_view_mode_get_coalesce_undo (mode));
IDE_TRACE_MSG ("supress_unbound = %d", ide_source_view_mode_get_suppress_unbound (mode));
IDE_TRACE_MSG ("block_cursor = %d", ide_source_view_mode_get_block_cursor (mode));
diff --git a/libide/ide-source-view-mode.h b/libide/ide-source-view-mode.h
index 396d308..65ff978 100644
--- a/libide/ide-source-view-mode.h
+++ b/libide/ide-source-view-mode.h
@@ -50,7 +50,6 @@ struct _IdeSourceViewModeClass
gboolean ide_source_view_mode_get_repeat_insert_with_count (IdeSourceViewMode *self);
gboolean ide_source_view_mode_get_block_cursor (IdeSourceViewMode *self);
gboolean ide_source_view_mode_get_suppress_unbound (IdeSourceViewMode *self);
-gboolean ide_source_view_mode_get_coalesce_undo (IdeSourceViewMode *self);
const gchar *ide_source_view_mode_get_name (IdeSourceViewMode *self);
const gchar *ide_source_view_mode_get_default_mode (IdeSourceViewMode *self);
gboolean ide_source_view_mode_get_keep_mark_on_char (IdeSourceViewMode *self);
diff --git a/libide/ide-source-view.c b/libide/ide-source-view.c
index fae328c..11a3bab 100644
--- a/libide/ide-source-view.c
+++ b/libide/ide-source-view.c
@@ -1402,9 +1402,6 @@ ide_source_view_connect_buffer (IdeSourceView *self,
ide_source_view_reload_word_completion (self);
ide_source_view_real_set_mode (self, NULL, IDE_SOURCE_VIEW_MODE_TYPE_PERMANENT);
- if (priv->mode && ide_source_view_mode_get_coalesce_undo (priv->mode))
- g_signal_emit_by_name (self, "begin-user-action");
-
insert = gtk_text_buffer_get_insert (GTK_TEXT_BUFFER (buffer));
gtk_text_view_scroll_to_mark (GTK_TEXT_VIEW (self), insert, 0.0, TRUE, 1.0, 0.5);
}
@@ -1429,9 +1426,6 @@ ide_source_view_disconnect_buffer (IdeSourceView *self,
ide_clear_signal_handler (buffer, &priv->buffer_notify_style_scheme_handler);
ide_clear_signal_handler (buffer, &priv->buffer_loaded_handler);
- if (priv->mode && ide_source_view_mode_get_coalesce_undo (priv->mode))
- g_signal_emit_by_name (self, "end-user-action");
-
g_clear_object (&priv->search_context);
ide_source_view_set_indenter (self, NULL);
@@ -1912,11 +1906,7 @@ ide_source_view_do_mode (IdeSourceView *self,
{
/* only remove mode if it is still active */
if (priv->mode == mode)
- {
- if (ide_source_view_mode_get_coalesce_undo (mode))
- g_signal_emit_by_name (self, "end-user-action");
- g_clear_object (&priv->mode);
- }
+ g_clear_object (&priv->mode);
}
g_object_unref (mode);
@@ -2993,8 +2983,6 @@ ide_source_view_real_set_mode (IdeSourceView *self,
suggested_default = g_strdup (str);
g_clear_object (&priv->mode);
- if (ide_source_view_mode_get_coalesce_undo (old_mode))
- g_signal_emit_by_name (self, "end-user-action");
g_object_unref (old_mode);
}
@@ -3010,9 +2998,6 @@ ide_source_view_real_set_mode (IdeSourceView *self,
priv->mode = _ide_source_view_mode_new (GTK_WIDGET (self), mode, type);
- if (ide_source_view_mode_get_coalesce_undo (priv->mode))
- g_signal_emit_by_name (self, "begin-user-action");
-
overwrite = ide_source_view_mode_get_block_cursor (priv->mode);
if (overwrite != gtk_text_view_get_overwrite (GTK_TEXT_VIEW (self)))
gtk_text_view_set_overwrite (GTK_TEXT_VIEW (self), overwrite);
@@ -3567,32 +3552,13 @@ ide_source_view_constructed (GObject *object)
static void
ide_source_view_real_undo (GtkSourceView *source_view)
{
- IdeSourceView *self = (IdeSourceView *)source_view;
- IdeSourceViewPrivate *priv = ide_source_view_get_instance_private (self);
- gboolean needs_unlock = FALSE;
-
- if (priv->mode && ide_source_view_mode_get_coalesce_undo (priv->mode))
- needs_unlock = TRUE;
-
- if (needs_unlock)
- g_signal_emit_by_name (self, "end-user-action");
GTK_SOURCE_VIEW_CLASS (ide_source_view_parent_class)->undo (source_view);
- if (needs_unlock)
- g_signal_emit_by_name (self, "begin-user-action");
}
static void
ide_source_view_real_redo (GtkSourceView *source_view)
{
- IdeSourceView *self = (IdeSourceView *)source_view;
- IdeSourceViewPrivate *priv = ide_source_view_get_instance_private (self);
- gboolean needs_unlock = !!priv->mode;
-
- if (needs_unlock)
- g_signal_emit_by_name (self, "end-user-action");
GTK_SOURCE_VIEW_CLASS (ide_source_view_parent_class)->redo (source_view);
- if (needs_unlock)
- g_signal_emit_by_name (self, "begin-user-action");
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]