Skip to content

Commit

Permalink
Reduce unnecessary redraws when typing
Browse files Browse the repository at this point in the history
  • Loading branch information
Evandro Borracini authored and ntrel committed Nov 27, 2012
1 parent a102206 commit 3205eea
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/document.c
Expand Up @@ -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;
Expand All @@ -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);
}

Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit 3205eea

Please sign in to comment.