<p>Hi,</p>
<p>I'm currently using a custom file type configuration where I enabled the <code>DIFF</code> lexer which provides the best highlighting experience for this particular file syntax:</p>
<pre><code>[styling=Diff]
comment=default

[settings]
lexer_filetype=Diff
</code></pre>
<p>Unfortunately, there is a highly demanded editor feature that cannot be used in this context: <strong>stripping trailing spaces</strong>.</p>
<p>By inspecting the source code, it's quite obvious the limitation is imposed by the <code>DIFF</code> lexer:</p>
<pre><code>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;
       [...]
}
</code></pre>
<p>I'm not sure if this is a bug or just a simple workaround to prevent corruptions of the <code>.patch</code> files.<br>
I just want to use the <code>DIFF</code> 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.</p>
<p>Does it make sense to improve the implementation by checking for <code>DIFF</code> file type instead of <code>DIFF</code> lexer?</p>
<p>Thank you!</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/geany/geany/issues/2041">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABDrJzhIqJ4zwPjZXssGCJItPZb896aIks5vBazUgaJpZM4Z3BTH">mute the thread</a>.<img src="https://github.com/notifications/beacon/ABDrJ9FtSwcYpkisdqq5AIRsRQ0h9uqmks5vBazUgaJpZM4Z3BTH.gif" height="1" width="1" alt="" /></p>
<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/geany/geany","title":"geany/geany","subtitle":"GitHub repository","main_image_url":"https://github.githubassets.com/images/email/message_cards/header.png","avatar_image_url":"https://github.githubassets.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/geany/geany"}},"updates":{"snippets":[{"icon":"DESCRIPTION","message":"Unable to strip trailing spaces for custom file types using Diff lexer (#2041)"}],"action":{"name":"View Issue","url":"https://github.com/geany/geany/issues/2041"}}}</script>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/geany/geany/issues/2041",
"url": "https://github.com/geany/geany/issues/2041",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>