[gnome-builder] editor-frame: Prevent search position label flickering during replace
- From: Matthew Leeds <mwleeds src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] editor-frame: Prevent search position label flickering during replace
- Date: Fri, 8 Jul 2016 02:38:06 +0000 (UTC)
commit 39a74ba23fa5f0003d474fd30aa8211b957fbd87
Author: Matthew Leeds <mleeds redhat com>
Date: Thu Jul 7 15:16:19 2016 -0400
editor-frame: Prevent search position label flickering during replace
In ide_editor_frame_actions_replace, when the replace is executed the
deletion and insertion in the buffer cause the search position label
(e.g. "1 of 29") to be updated, but at that time the occurrences-count
is unknown since that part of the buffer needs to be re-scanned, so the
label is set to NULL. Only once the scan finishes can the corect label
be set. So this commit prevents the search position label from being
updated when the cursor moves during the replacement, which prevents
ugly flickering for the user.
https://bugzilla.gnome.org/show_bug.cgi?id=768534
libide/editor/ide-editor-frame-actions.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/libide/editor/ide-editor-frame-actions.c b/libide/editor/ide-editor-frame-actions.c
index 2103ae8..9d3df89 100644
--- a/libide/editor/ide-editor-frame-actions.c
+++ b/libide/editor/ide-editor-frame-actions.c
@@ -299,8 +299,15 @@ ide_editor_frame_actions_replace (GSimpleAction *action,
if (occurrence_position > 0)
{
+ /* Temporarily disable updating the search position label to prevent flickering */
+ g_signal_handler_block (buffer, self->cursor_moved_handler);
+
gtk_source_search_context_replace2 (search_context, &start, &end, unescaped_replace_text, -1, &error);
+ /* Re-enable updating the search position label. The next-search-result action
+ * below will cause it to update. */
+ g_signal_handler_unblock (buffer, self->cursor_moved_handler);
+
if (error != NULL)
{
g_warning ("%s", error->message);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]