[Github-comments] [geany/geany] Unable to strip trailing spaces for custom file types using Diff lexer (#2041)

Cristian Ciocaltea notifications at xxxxx
Wed Jan 9 08:48:20 UTC 2019


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20190109/58738f89/attachment-0001.html>


More information about the Github-comments mailing list