Mousepad keeps intermittently forgetting my preferences for visible line numbers and word wrapping at times that are unpredictable to me. Also trying to set the option for Home/End keys behavior has no effect: closing and reopening the preferences window shows it as "disabled". The latter manifests both in gtk2 and gtk3 builds. The former was hard to confirm for the gtk3 build since I don't know what triggers it. If it helps, I often keep more than 10 files open and keep opening new files while Mousepad is already running, sometimes dragging tabs from new windows into the already existing window and sometimes not.
I have the same problem since I installed the version 0.4.0 (GTK2) and as seems to me a very annoying bug, I made a script to monitor the "word-wrap" and "show-line-numbers" values in the program settings to know that this is due (do not know if there are other settings deactivated mysteriously). After a few days I discovered that these values are altered when opening any file that triggers the "The document was not UTF-8 valid" error (as a text file with Latin1 encoding or a binary). Another thing that I discovered is that when the program is running and you try to open a file that triggers this error from the console, the line numbers and word wrap disappear in the previous instance, but still appear as enabled in the preferences window of the same. I do not know if there are other ways in which this bug is triggered, so below leave the script that I made for anyone interested in testing: #!/bin/bash # Check the dconf output before using this or when adding options in $values values=$(echo -e "word-wrap=true\nshow-line-numbers=true") while [ 1 -eq 1 ]; do if [ "$values" != "$(dconf dump / | grep -E '(word-wrap|show-line-numbers)=true')" ] then aplay /path/to/some/soundfile.wav fi sleep 2; done The ideal would be save it to a file and make it run every time starts the graphical environment. If I discover something else I will post here.
Thanks Agustin, this is a nice way to reproduce this annoying bug. So far I could trace the problem down to mousepad-window around line 1496: gtk_recent_manager_lookup_item (window->recent_manager, uri, NULL); It throws: Gtk-CRITICAL **: gtk_recent_manager_lookup_item: assertion 'GTK_IS_RECENT_MANAGER (manager)' failed Even if I comment this line, the initialization and exhibition of the encoding dialog also resets the preferences. You can also monitor the preferences using the dconf Editor under: org.xfce.mousepad.preferences.view
*** Bug 12714 has been marked as a duplicate of this bug. ***
Created attachment 6823 Do not overwrite view settings when attempting to open invalidly-encoded file This one was actually pretty simple - creation of the dialog complaining about the invalidly-encoded file actually hardcodes the configuration of the text view's line numbers and wordwrap, which then triggers an invalid save overwriting the user configuration (see mousepad-encoding-dialog.c:mousepad_encoding_dialog_init at the bottom). This is a good example of why automagic saving of settings is bad. The patch attached just comments the lines out, the real solution is more of a design question - now this problem is known, should these things be configured at all? Should there be a global 'do not save' flag to prevent invalid saving of settings, etc etc?
*** Bug 13926 has been marked as a duplicate of this bug. ***
*** Bug 13946 has been marked as a duplicate of this bug. ***
Another variant of this bug: when I run Mousepad as root, it resets all Mousepad settings for the non-root user, and only for him. However, when line numbers and wordwrap are reset after opening a file in the wrong format, both root and non-root users are affected.
(In reply to karmy from comment #7) > Another variant of this bug: when I run Mousepad as root, it resets all > Mousepad settings for the non-root user, and only for him. However, when > line numbers and wordwrap are reset after opening a file in the wrong > format, both root and non-root users are affected. EDIT: I have installed Mousepad 0.4.1 from source, and this bug has disappeared, both for 0.4.0 and 0.4.1 versions…
Created attachment 8585 proposed patch
Theo Linkspfeifer referenced this bugreport in commit 9214a626a1aba77def27188ac8974e1b1eeec47f Do not overwrite view settings when opening encoding dialog (Bug #12298) https://git.xfce.org/apps/mousepad/commit?id=9214a626a1aba77def27188ac8974e1b1eeec47f
Works for me and I didn't notice any regression, thanks!
I think the patch has a stray line changed which shouldn't be, it changes `mousepad_view_set_word_wrap` to `gtk_text_view_set_wrap_mode` which does the same thing, except instead of changing the mousepad property, it changes the GtkTextView property directly. IMO, it should either call the Mousepad wrapper, or if there's a reason not to use it, then it should be removed and calls to it should be changed to use the GtkTextView property. I suspect that line in the patch was just a left-over from troubleshooting/debugging and never got changed back.