APPROVE COMMIT
NOTE: This patch has been committed
# HG changeset patch
# User Aidan Kehoe <kehoea(a)parhasard.net>
# Date 1542663039 0
# Mon Nov 19 21:30:39 2018 +0000
# Node ID 4c2cb2cb183703a273531eb04539d4e834d23cea
# Parent cdcb155f48fcc473d273e80d1408e26a0bf54582
Be more careful about DEC_BYTEBPOS(), redisplay.c, thank you Raymond Toy!
src/ChangeLog addition:
2018-11-19 Aidan Kehoe <kehoea(a)parhasard.net>
* redisplay.c (create_text_block):
Don't DEC_BYTEBPOS() with a bytebpos less than 1 in this function,
thank you for the bug report, Raymond Toy!
diff -r cdcb155f48fc -r 4c2cb2cb1837 src/ChangeLog
--- a/src/ChangeLog Thu Nov 01 20:34:54 2018 -0600
+++ b/src/ChangeLog Mon Nov 19 21:30:39 2018 +0000
@@ -1,3 +1,9 @@
+2018-11-19 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * redisplay.c (create_text_block):
+ Don't DEC_BYTEBPOS() with a bytebpos less than 1 in this function,
+ thank you for the bug report, Raymond Toy!
+
2018-11-01 Jerry James <james(a)xemacs.org>
* tls.c (init_tls): Fix build with recent openssl versions.
diff -r cdcb155f48fc -r 4c2cb2cb1837 src/redisplay.c
--- a/src/redisplay.c Thu Nov 01 20:34:54 2018 -0600
+++ b/src/redisplay.c Mon Nov 19 21:30:39 2018 +0000
@@ -2982,27 +2982,38 @@
dl->cursor_elt = data.cursor_x;
/* #### lossage lossage lossage! Fix this shit! */
- {
- Bytebpos end_bytebpos = data.byte_charpos;
-
- if (data.byte_charpos > BYTE_BUF_ZV (b))
- {
- dl->end_charpos = BUF_ZV (b);
- end_bytebpos = BYTE_BUF_ZV (b);
- }
- else
- {
- dl->end_charpos = bytebpos_to_charbpos (b, data.byte_charpos) - 1;
- DEC_BYTEBPOS (b, end_bytebpos);
- }
- if (truncate_win)
- data.dl->num_chars = column_at_point (b, end_bytebpos, 0);
- else
- /* This doesn't correctly take into account tabs and control
- characters but if the window isn't being truncated then this
- value isn't going to end up being used anyhow. */
- data.dl->num_chars = dl->end_charpos - dl->charpos;
- }
+ if (data.byte_charpos > BYTE_BUF_ZV (b))
+ {
+ dl->end_charpos = BUF_ZV (b);
+ if (truncate_win)
+ {
+ data.dl->num_chars = column_at_point (b, BYTE_BUF_ZV (b), 0);
+ }
+ else
+ {
+ /* This doesn't correctly take into account tabs and control
+ characters but if the window isn't being truncated then this
+ value isn't going to end up being used anyhow. */
+ data.dl->num_chars = dl->end_charpos - dl->charpos;
+ }
+ }
+ else
+ {
+ dl->end_charpos = bytebpos_to_charbpos (b, data.byte_charpos) - 1;
+ if (truncate_win)
+ {
+ data.dl->num_chars = column_at_point (b, data.byte_charpos > 1 ?
+ prev_bytebpos
+ (b, data.byte_charpos) : 1, 0);
+ }
+ else
+ {
+ /* This doesn't correctly take into account tabs and control
+ characters but if the window isn't being truncated then this
+ value isn't going to end up being used anyhow. */
+ data.dl->num_chars = dl->end_charpos - dl->charpos;
+ }
+ }
/* #### handle horizontally scrolled line with text none of which
was actually laid out. */
--
‘As I sat looking up at the Guinness ad, I could never figure out /
How your man stayed up on the surfboard after forty pints of stout’
(C. Moore)