commit 0167f78dcae4e53f12d27ff1d1c0c3f41af85c20
parent 282ec08e5e7d69983d323830f7a669378fe3c25a
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Sun, 20 Nov 2022 11:25:45 +0100
feedback: warn when the cursor sits on a Byte Order Mark (BOM)
The ceck is only done at the start of a line, because in other places
the BOM will be glued to the preceding character.
This partially addresses https://bugs.debian.org/964901.
Reported-by: Nils König <oneric@oneric.de>
Diffstat:
1 file changed, 10 insertions(+), 0 deletions(-)
diff --git a/src/nano.c b/src/nano.c
@@ -2683,6 +2683,16 @@ int main(int argc, char **argv)
as_an_at = TRUE;
+#if defined(ENABLE_UTF8) && !defined(NANO_TINY)
+#define byte(n) (unsigned char)openfile->current->data[n]
+ /* Tell the user when the cursor sits on a BOM. */
+ if (openfile->current_x == 0 && byte(0) == 0xEF && byte(1) == 0xBB &&
+ byte(2) == 0xBF && using_utf8()) {
+ statusline(NOTICE, _("Byte Order Mark"));
+ set_blankdelay_to_one();
+ }
+#endif
+
if ((refresh_needed && LINES > 1) || (LINES == 1 && lastmessage <= HUSH))
edit_refresh();
else