[geany/geany] 3205ee: Reduce unnecessary redraws when typing

Evandro Borracini git-noreply at geany.org
Tue Nov 27 17:05:51 UTC 2012


Branch:      refs/heads/master
Author:      Evandro Borracini <evandro.borracini at gmail.com>
Committer:   Nick Treleaven <nick.treleaven at btinternet.com>
Date:        Tue, 27 Nov 2012 17:05:51 UTC
Commit:      3205eeaa714222114fd82063fe51f9656d3e635d
             https://github.com/geany/geany/commit/3205eeaa714222114fd82063fe51f9656d3e635d

Log Message:
-----------
Reduce unnecessary redraws when typing


Modified Paths:
--------------
    src/document.c

Modified: src/document.c
10 files changed, 8 insertions(+), 2 deletions(-)
===================================================================
@@ -2506,6 +2506,7 @@ void document_undo_clear(GeanyDocument *doc)
 }
 
 
+/* note: this is called on SCN_MODIFIED notifications */
 void document_undo_add(GeanyDocument *doc, guint type, gpointer data)
 {
 	undo_action *action;
@@ -2518,7 +2519,10 @@ void document_undo_add(GeanyDocument *doc, guint type, gpointer data)
 
 	g_trash_stack_push(&doc->priv->undo_actions, action);
 
-	document_set_text_changed(doc, TRUE);
+	/* avoid unnecessary redraws */
+	if (type != UNDO_SCINTILLA || !doc->changed)
+		document_set_text_changed(doc, TRUE);
+
 	ui_update_popup_reundo_items(doc);
 }
 
@@ -2682,7 +2686,9 @@ static void document_redo_add(GeanyDocument *doc, guint type, gpointer data)
 
 	g_trash_stack_push(&doc->priv->redo_actions, action);
 
-	document_set_text_changed(doc, TRUE);
+	if (type != UNDO_SCINTILLA || !doc->changed)
+		document_set_text_changed(doc, TRUE);
+
 	ui_update_popup_reundo_items(doc);
 }
 



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: TBD).


More information about the Commits mailing list