aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-03-17 18:23:04 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2017-03-17 18:23:04 -0700
commit59df78a7806764586e084eafd0842f43a741037a (patch)
treee40c375a5191a36e24bf5e4408e2edba440ab012
parent34faa14e34c3eb2dfe3fd2cad02826f12f00ec5b (diff)
downloaduemacs-59df78a7806764586e084eafd0842f43a741037a.tar.gz
Turn NBSP into regular SP on input
Particularly pasting from a web browser, I get a lot of 'space' + 'non-breaking space' noise, and keeping the &nbsp as an actual unicode character ends up being a major pain. Note: this is only done on input. If the file contains the unicode character U+00A0, we'll keep it that way. But you can't enter it from the keyboard (or cut-and-paste, which ends up looking like keyboard input). Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--posix.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/posix.c b/posix.c
index 97edd9f..74ba7b9 100644
--- a/posix.c
+++ b/posix.c
@@ -213,6 +213,9 @@ int ttgetc(void)
}
bytes = utf8_to_unicode(buffer, 0, pending, &c);
+ /* Hackety hack! Turn no-break space into regular space */
+ if (c == 0xa0)
+ c = ' ';
done:
pending -= bytes;
memmove(buffer, buffer+bytes, pending);