[Geany-Devel] Making Geany faster (reducing latency to typed text)
Evandro Borracini
evandro.borracini at gmail.com
Sat Nov 24 21:12:45 UTC 2012
Sorry, I forgot to include the patch.
Thanks,
Evandro
diff -Naurp geany-0.20/src/document.c geany-0.20_fast/src/document.c
--- geany-0.20/src/document.c 2012-11-23 20:22:22.564735000 -0800
+++ geany-0.20_fast/src/document.c 2012-11-24 12:47:50.110927000 -0800
@@ -2676,7 +2676,10 @@ void document_undo_add(GeanyDocument *do
g_trash_stack_push(&doc->priv->undo_actions, action);
- document_set_text_changed(doc, TRUE);
+ if (doc->changed != TRUE) {
+ document_set_text_changed(doc, TRUE);
+ }
+
ui_update_popup_reundo_items(doc);
}
@@ -2840,7 +2843,10 @@ static void document_redo_add(GeanyDocum
g_trash_stack_push(&doc->priv->redo_actions, action);
- document_set_text_changed(doc, TRUE);
+ if (doc->changed != TRUE) {
+ document_set_text_changed(doc, TRUE);
+ }
+
ui_update_popup_reundo_items(doc);
}
2012/11/24 Evandro Borracini <evandro.borracini at gmail.com>
> Hi,
>
> Thanks everyone for the comments and suggestions. Based on them, I
> reverted back to the original code and just added an "if (doc->changed !=
> TRUE)" before calling document_set_text_changed(doc, TRUE) in
> document_undo/redo_add().
>
> That prevents calling document_set_text_changed() again if doc->changed is
> already TRUE.
>
> It worked fine and I don't see the latency anymore. :-)
>
> Please find the complete patch below. Document_set_text_changed() function
> is not changed.
>
> Please comment on that.
>
>
> Thanks again and regards,
>
> Evandro
>
>
>
> 2012/11/24 Nick Treleaven <nick.treleaven at btinternet.com>
>
>> On 24/11/2012 14:04, Colomban Wendling wrote:
>>
>>> A solution might be to only do the updates if (doc->changed != changed).
>>> I didn't look at the interactions with the rest of Geany (nor test it
>>> actually), but looking at this I guess that changing it to:
>>>
>>
>> I played with this a little. It won't work easily because
>> document_set_text_changed is sometimes called to force a UI update,
>> possibly even when the current doc hasn't changed. The API docs describe
>> this behavior also.
>>
>> ______________________________**_________________
>> Devel mailing list
>> Devel at lists.geany.org
>> https://lists.geany.org/cgi-**bin/mailman/listinfo/devel<https://lists.geany.org/cgi-bin/mailman/listinfo/devel>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.geany.org/pipermail/devel/attachments/20121124/66f3c1a8/attachment-0001.html>
More information about the Devel
mailing list