! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
Some settings get intermittently reset, some fail to save at all
Status:
RESOLVED: FIXED
Product:
Mousepad
Component:
General

Comments

Description qptain Nemo 2015-11-09 16:56:47 CET
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.
Comment 1 Agustin Ferrari 2016-02-11 12:24:53 CET
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.
Comment 2 Andre Miranda editbugs 2016-02-12 22:25:27 CET
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
Comment 3 Andre Miranda editbugs 2016-07-21 04:47:47 CEST
*** Bug 12714 has been marked as a duplicate of this bug. ***
Comment 4 OmegaPhil 2016-09-04 16:18:10 CEST
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?
Comment 5 Andre Miranda editbugs 2017-10-16 14:56:51 CEST
*** Bug 13926 has been marked as a duplicate of this bug. ***
Comment 6 Matthew Brush editbugs 2017-10-22 21:50:00 CEST
*** Bug 13946 has been marked as a duplicate of this bug. ***
Comment 7 Tamaranch 2018-08-18 01:12:15 CEST
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.
Comment 8 Tamaranch 2018-08-18 11:52:50 CEST
(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…
Comment 9 Theo Linkspfeifer editbugs 2019-05-26 22:52:59 CEST
Created attachment 8585 
proposed patch
Comment 10 Git Bot editbugs 2019-05-27 00:23:34 CEST
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
Comment 11 Andre Miranda editbugs 2019-05-27 00:24:03 CEST
Works for me and I didn't notice any regression, thanks!
Comment 12 Matthew Brush editbugs 2019-05-28 01:00:08 CEST
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.

Bug #12298

Reported by:
qptain Nemo
Reported on: 2015-11-09
Last modified on: 2019-05-28
Duplicates (3):
  • 12714 Word wrap disables itself in Mousepad
  • 13926 mousepad: Resetting some of settings after the opening non-utf8 file
  • 13946 Opening an alternatively-encoded file disables Word Wrap

People

Assignee:
Matthew Brush
CC List:
8 users

Version

Target Milestone:
Mousepad 0.4.x

Attachments

Additional information