Hi,
I'm currently using a custom file type configuration where I enabled the `DIFF` lexer which provides the best highlighting experience for this particular file syntax:
``` [styling=Diff] comment=default
[settings] lexer_filetype=Diff ``` Unfortunately, there is a highly demanded editor feature that cannot be used in this context: **stripping trailing spaces**.
By inspecting the source code, it's quite obvious the limitation is imposed by the `DIFF` lexer:
``` void editor_strip_line_trailing_spaces(GeanyEditor *editor, gint line) { [...] /* Diff hunks should keep trailing spaces */ if (sci_get_lexer(editor->sci) == SCLEX_DIFF) return; [...] } ``` I'm not sure if this is a bug or just a simple workaround to prevent corruptions of the `.patch` files. I just want to use the `DIFF` syntax highlighting on files that do not have anything in common with the patch files, in particular by having the option to strip trailing spaces enabled permanently.
Does it make sense to improve the implementation by checking for `DIFF` file type instead of `DIFF` lexer?
Thank you!
Does it make sense to improve the implementation by checking for DIFF file type instead of DIFF lexer?
👍
As @codebrainz thumbed up, changing the detection logic to using the filetype sounds good.
Thanks for your quick feedback! Please see the PR, tested and working as expected..
Closed #2041 via #2043.
github-comments@lists.geany.org