geany icon indicating copy to clipboard operation
geany copied to clipboard

Add option to only show line endings if they differ from file default

Open eht16 opened this issue 3 years ago • 14 comments

This adds a new option in the preferences dialog to show line ending characters only when they differ from what the majority of the line endings in the file use.

So it should be easier to spot accidentally misused line endings.

The idea is from @cousteaulecommandant and shamelessly implemented by me :D.

I guess we can improve the wording of the visible option name and its tooltip.

Screenshot: geany_show_eol_only_when_differ

Testfile: show_differing_eols.zip

eht16 avatar Sep 11 '22 12:09 eht16

Looks like a reasonable addition by inspection (can't build anything on this Windows tablet ;-).

The tooltip looks fine, but as noted the menu label looks a little long, its 5 longer than "Toggle all additional widgets" the current longest in the menu. Maybe simply "Show different line endings".

elextr avatar Sep 11 '22 13:09 elextr

Looks like a reasonable addition by inspection (can't build anything on this Windows tablet ;-).

:(

The tooltip looks fine, but as noted the menu label looks a little long, its 5 longer than "Toggle all additional widgets" the current longest in the menu. Maybe simply "Show different line endings".

I guess you are talking about the View menu? There is no menu item, only a checkbox in the preferences dialog: geany_show_eol_only_when_differ_pref

The idea is that users probably will not change that setting so often but rather decide once to show all line endings or only differing ones and therefore I did not add a new menu item to the View menu.

I just re-pushed to not accidentally remove trailing whitespaces in geany.txt.

eht16 avatar Sep 11 '22 14:09 eht16

Ok, that makes sense, the view menu shows/hides the endings selected in the prefs.

In that case we have lots of space, so maybe "Show only non-default line endings", its a pity the status bar shows the default line ending as "Mode:" presumably to save space, but it doesn't match anything else, oh well.

elextr avatar Sep 11 '22 14:09 elextr

In that case we have lots of space, so maybe "Show only non-default line endings",

Thanks, done.

its a pity the status bar shows the default line ending as "Mode:" presumably to save space, but it doesn't match anything else, oh well.

Maybe just "EOL" or "EOL mode"?

eht16 avatar Sep 11 '22 14:09 eht16

Maybe just "EOL" or "EOL mode"?

Just EOL should be good, after all its user editable anyway and gives something like "EOL: LF".

elextr avatar Sep 11 '22 14:09 elextr

I like this, done.

eht16 avatar Sep 11 '22 15:09 eht16

Thanks! I also prefer "non-default" or maybe "mismatching" ("non-matching"?) to "different".

I don't know if the option should be "only show mismatching" (which can be turned off from the menu when the user selects to hide EOL) or "always show mismatching" (with the menu option enabling also matching ones). (Then again, with this option available, "show every end of line" doesn't make much sense to have, and users will more likely want to choose between the other two, so your current proposal is probably the best.)

cousteaulecommandant avatar Sep 12 '22 08:09 cousteaulecommandant

I'm confused :). Do you suggest a change or rather to keep it as it is?

eht16 avatar Sep 13 '22 20:09 eht16

I think it's probably best as it is, but I was just pointing out the other possibility in case you thought it made more sense. (I do realize that might have caused unnecessary confusion)

cousteaulecommandant avatar Sep 13 '22 21:09 cousteaulecommandant

@cousteaulecommandant To be clear best as "non-default"?

elextr avatar Sep 13 '22 21:09 elextr

@cousteaulecommandant To be clear best as "non-default"?

I was talking about whether the behavior of the new option should be to always hide regular EOL even when "Show EOL" is selected, or to always show atypical EOL even when "Show EOL" is deselected. I think it's probably best as it is right now (always hide regular EOL).

Re: my previous comment about the wording, I suppose "non-default" or "differing" are both OK; it's just that I thought the original proposal said "different" instead of "differing", and thought that the phrase "Show different line endings" sounded very confusing.

cousteaulecommandant avatar Sep 13 '22 23:09 cousteaulecommandant

So, we leave the wording as is and can merge?

eht16 avatar Oct 16 '22 12:10 eht16

If you're asking me, I'd say go ahead with it 🙂

cousteaulecommandant avatar Oct 16 '22 19:10 cousteaulecommandant

Alright, thanks. If nobody objects, I'll merge this in a few days.

eht16 avatar Oct 17 '22 20:10 eht16

A minor issue: on a fresh Geany install (or a clean $HOME folder), this new option is still selectable by default, even if "Show line endings" is deselected. My first reaction when trying to enable this new behavior was to click the option directly, which did nothing (I was expecting it to automatically trigger the new behavior, but you need to select "Show line endings" as well). If I select and deselect "Show line endings", the new feature gets grayed out, which is more intuitive (now it's clear that I need to select the parent option to make this option available, and that this option will only do something when "Show line endings" is enabled). But for some reason, if I've never touched "Show line endings", the default is for "Show only non-default line endings" to be clickable.

(Alternatively, reword it as "Hide default line endings" to make clear that this option hides some line endings rather than showing them, but I think it's preferable and more intuitive to fix the gray-out behavior and leave the wording as is.)

cousteaulecommandant avatar Sep 26 '23 01:09 cousteaulecommandant

Its a little weird, the "show line endings" setting can be changed by the checkbox in the prefs dialog, or in the view menu. They both seem to use use the same internal setting, if its changed in one place the other matches it.

My instinct would be to leave the "Show only non-default line endings" always available. Otherwise if "show line endings" is turned off by the view menu then to change the non-default setting in the prefs the user has to enable line endings, set the setting, disable line endings :stuck_out_tongue:

The more radical suggestion would be to remove the "show line endings" in the preferences and just leave the "Show only non-default line endings".

Anyway since this PR has been merged this should be raised as a separate issue, its too late to include it here.

elextr avatar Sep 26 '23 02:09 elextr