[Github-comments] [geany/geany] Fix undo of line end type change (#527)

Colomban Wendling notifications at xxxxx
Sun Jun 19 11:08:03 UTC 2016


> +void ui_update_menu_eol(GeanyDocument *doc)
> +{
> +	gint eol = sci_get_eol_mode(doc->editor->sci);
> +	const gchar *widget_name;
> +
> +	switch (eol)
> +	{
> +		case SC_EOL_CR: widget_name = "cr"; break;
> +		case SC_EOL_LF: widget_name = "lf"; break;
> +		default: widget_name = "crlf"; break;
> +	}
> +	gtk_check_menu_item_set_active(
> +		GTK_CHECK_MENU_ITEM(ui_lookup_widget(main_widgets.window, widget_name)), TRUE);
> +
> +	ui_update_statusbar(doc, -1);
> +}

is splitting this out of `ui_document_show_hide()` worth it?  It's a mere optimization IIUC, but it requires the caller to play with `ignore_callback`, and it calls `ui_update_statusbar()` which wasn't done previously in `ui_document_show_hide()`, so many callers do both themselves.

So my question is, why not simply call `ui_document_show_hide()` from the undo stuff, and not care about it updating more than it needs to?

BTW, if we want to be able to nest calls playing with `ignore_callback`, we could make it an integer and `++` and `--` it instead of setting to absolute `TRUE`/`FALSE`.  Though ideally one day we get rid of that odd global.

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/527/files/6a2422af3226738247284ef8f1154a8e23bfca9f#r67615008
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20160619/d651a293/attachment.html>


More information about the Github-comments mailing list