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](https://user-images.githubusercontent.com/617017/189527774-a9072f31-0a82-4f7...)
Testfile: [show_differing_eols.zip](https://github.com/geany/geany/files/9542533/show_differing_eols.zip)
You can view, comment on, or merge this pull request online at:
https://github.com/geany/geany/pull/3287
-- Commit Summary --
* Add option to only show line endings if they differ from file default
-- File Changes --
M data/geany.glade (52) M doc/geany.txt (40) M src/editor.c (1) M src/editor.h (1) M src/keyfile.c (2) M src/plugindata.h (2) M src/prefs.c (19) M src/sciwrappers.c (25) M src/sciwrappers.h (1)
-- Patch Links --
https://github.com/geany/geany/pull/3287.patch https://github.com/geany/geany/pull/3287.diff
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".
@eht16 pushed 1 commit.
5a86cd41846b7a8ab30bc7ba41541cc994f5e29c Add option to only show line endings if they differ from file default
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](https://user-images.githubusercontent.com/617017/189531595-1f584ba0-7ac4-404...)
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.
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.
@eht16 pushed 1 commit.
7737990e0a5f3ae3aeb2aeecb283138049be8b40 Improve wording on new pref name
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"?
Maybe just "EOL" or "EOL mode"?
Just EOL should be good, after all its user editable anyway and gives something like "EOL: LF".
@eht16 pushed 2 commits.
39e129bf382324cf27caa8d07dea10071f13e4da Add option to only show line endings if they differ from file default b6de99ddb652bd70c87facf9fa6029486450691c Change default label for end of line characters to "EOL" in statusbar
I like this, done.
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.)
I'm confused :). Do you suggest a change or rather to keep it as it is?
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 To be clear best as "non-default"?
@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.
So, we leave the wording as is and can merge?
If you're asking me, I'd say go ahead with it 🙂
Alright, thanks. If nobody objects, I'll merge this in a few days.
Merged #3287 into master.
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.)
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.
github-comments@lists.geany.org