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!

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/issues/2041

Reply via email to