Mercurial > emacs
comparison src/dispnew.c @ 17015:fe0b3661b584
(direct_output_forward_char): #if-0-out redundant
check against truncated text at end of line.
Add giving-up for buffers with reverse direction.
(remake_frame_glyphs): Use FRAME_MESSAGE_BUF_SIZE()
instead of FRAME_WIDTH, as the message may include multi-byte
character and the length may be longer than width.
(width_run_cache_on_off): Disable width-run-cache when
multi-byte characters are enabled.
(skip_invisible): Don't put the boundary in the middle of
multibyte characters.
(direct_output_forward_char): Bug fix. Add
XFASTINT (w->left) for losing cursor check.
Include charset.h.
(update_line): Handle wide-column characters.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Thu, 20 Feb 1997 06:35:00 +0000 |
parents | b2c51d6de440 |
children | 5023bea28298 |
comparison
equal
deleted
inserted
replaced
17014:828cf55629fc | 17015:fe0b3661b584 |
---|---|
32 #include "termhooks.h" | 32 #include "termhooks.h" |
33 /* cm.h must come after dispextern.h on Windows. */ | 33 /* cm.h must come after dispextern.h on Windows. */ |
34 #include "dispextern.h" | 34 #include "dispextern.h" |
35 #include "cm.h" | 35 #include "cm.h" |
36 #include "buffer.h" | 36 #include "buffer.h" |
37 #include "charset.h" | |
37 #include "frame.h" | 38 #include "frame.h" |
38 #include "window.h" | 39 #include "window.h" |
39 #include "commands.h" | 40 #include "commands.h" |
40 #include "disptab.h" | 41 #include "disptab.h" |
41 #include "indent.h" | 42 #include "indent.h" |
42 #include "intervals.h" | 43 #include "intervals.h" |
43 #include "blockinput.h" | 44 #include "blockinput.h" |
44 | 45 |
45 #include "systty.h" | 46 /* I don't know why DEC Alpha OSF1 fail to compile this file if we |
47 include the following file. */ | |
48 /* #include "systty.h" */ | |
46 #include "syssignal.h" | 49 #include "syssignal.h" |
47 | 50 |
48 #ifdef HAVE_X_WINDOWS | 51 #ifdef HAVE_X_WINDOWS |
49 #include "xterm.h" | 52 #include "xterm.h" |
50 #endif /* HAVE_X_WINDOWS */ | 53 #endif /* HAVE_X_WINDOWS */ |
344 echo_area_glyphs may be pointing here. */ | 347 echo_area_glyphs may be pointing here. */ |
345 char *old_message_buf = FRAME_MESSAGE_BUF (frame); | 348 char *old_message_buf = FRAME_MESSAGE_BUF (frame); |
346 | 349 |
347 FRAME_MESSAGE_BUF (frame) | 350 FRAME_MESSAGE_BUF (frame) |
348 = (char *) xrealloc (FRAME_MESSAGE_BUF (frame), | 351 = (char *) xrealloc (FRAME_MESSAGE_BUF (frame), |
349 FRAME_WIDTH (frame) + 1); | 352 FRAME_MESSAGE_BUF_SIZE (frame) + 1); |
350 | 353 |
351 if (echo_area_glyphs == old_message_buf) | 354 if (echo_area_glyphs == old_message_buf) |
352 echo_area_glyphs = FRAME_MESSAGE_BUF (frame); | 355 echo_area_glyphs = FRAME_MESSAGE_BUF (frame); |
353 if (previous_echo_glyphs == old_message_buf) | 356 if (previous_echo_glyphs == old_message_buf) |
354 previous_echo_glyphs = FRAME_MESSAGE_BUF (frame); | 357 previous_echo_glyphs = FRAME_MESSAGE_BUF (frame); |
355 } | 358 } |
356 else | 359 else |
357 FRAME_MESSAGE_BUF (frame) | 360 FRAME_MESSAGE_BUF (frame) |
358 = (char *) xmalloc (FRAME_WIDTH (frame) + 1); | 361 = (char *) xmalloc (FRAME_MESSAGE_BUF_SIZE (frame) + 1); |
359 | 362 |
360 FRAME_CURRENT_GLYPHS (frame) = make_frame_glyphs (frame, 0); | 363 FRAME_CURRENT_GLYPHS (frame) = make_frame_glyphs (frame, 0); |
361 FRAME_DESIRED_GLYPHS (frame) = make_frame_glyphs (frame, 0); | 364 FRAME_DESIRED_GLYPHS (frame) = make_frame_glyphs (frame, 0); |
362 FRAME_TEMP_GLYPHS (frame) = make_frame_glyphs (frame, 1); | 365 FRAME_TEMP_GLYPHS (frame) = make_frame_glyphs (frame, 1); |
363 if (FRAME_WINDOW_P (frame) || frame == selected_frame) | 366 if (FRAME_WINDOW_P (frame) || frame == selected_frame) |
1112 int n; | 1115 int n; |
1113 { | 1116 { |
1114 register FRAME_PTR frame = selected_frame; | 1117 register FRAME_PTR frame = selected_frame; |
1115 register struct window *w = XWINDOW (selected_window); | 1118 register struct window *w = XWINDOW (selected_window); |
1116 Lisp_Object position; | 1119 Lisp_Object position; |
1120 /* This check is redundant. It's checked at "losing cursor" below. */ | |
1121 #if 0 | |
1117 int hpos = FRAME_CURSOR_X (frame); | 1122 int hpos = FRAME_CURSOR_X (frame); |
1118 | 1123 |
1119 /* Give up if in truncated text at end of line. */ | 1124 /* Give up if in truncated text at end of line. */ |
1120 if (hpos >= WINDOW_LEFT_MARGIN (w) + window_internal_width (w) - 1) | 1125 if (hpos >= WINDOW_LEFT_MARGIN (w) + window_internal_width (w) - 1) |
1126 return 0; | |
1127 #endif /* 0 */ | |
1128 | |
1129 /* Give up if the buffer's direction is reversed (i.e. right-to-left). */ | |
1130 if (!NILP (XBUFFER(w->buffer)->direction_reversed)) | |
1121 return 0; | 1131 return 0; |
1122 | 1132 |
1123 /* Avoid losing if cursor is in invisible text off left margin | 1133 /* Avoid losing if cursor is in invisible text off left margin |
1124 or about to go off either side of window. */ | 1134 or about to go off either side of window. */ |
1125 if ((FRAME_CURSOR_X (frame) == WINDOW_LEFT_MARGIN (w) | 1135 if ((FRAME_CURSOR_X (frame) == WINDOW_LEFT_MARGIN (w) |
1126 && (XINT (w->hscroll) || n < 0)) | 1136 && (XINT (w->hscroll) || n < 0)) |
1127 || (n > 0 | 1137 || (n > 0 |
1128 && (FRAME_CURSOR_X (frame) + 1 >= window_internal_width (w) - 1)) | 1138 && (FRAME_CURSOR_X (frame) + 1 |
1139 >= XFASTINT (w->left) + window_internal_width (w) - 1)) | |
1140 /* BUG FIX: Added "XFASTINT (w->left)". Without this, | |
1141 direct_output_forward_char() always fails on "the right" | |
1142 window. */ | |
1129 || cursor_in_echo_area) | 1143 || cursor_in_echo_area) |
1130 return 0; | 1144 return 0; |
1131 | 1145 |
1132 /* Can't use direct output if highlighting a region. */ | 1146 /* Can't use direct output if highlighting a region. */ |
1133 if (!NILP (Vtransient_mark_mode) && !NILP (current_buffer->mark_active)) | 1147 if (!NILP (Vtransient_mark_mode) && !NILP (current_buffer->mark_active)) |
1545 { | 1559 { |
1546 register GLYPH *obody, *nbody, *op1, *op2, *np1, *temp; | 1560 register GLYPH *obody, *nbody, *op1, *op2, *np1, *temp; |
1547 int *temp1; | 1561 int *temp1; |
1548 int tem; | 1562 int tem; |
1549 int osp, nsp, begmatch, endmatch, olen, nlen; | 1563 int osp, nsp, begmatch, endmatch, olen, nlen; |
1550 int save; | 1564 GLYPH save; |
1551 register struct frame_glyphs *current_frame | 1565 register struct frame_glyphs *current_frame |
1552 = FRAME_CURRENT_GLYPHS (frame); | 1566 = FRAME_CURRENT_GLYPHS (frame); |
1553 register struct frame_glyphs *desired_frame | 1567 register struct frame_glyphs *desired_frame |
1554 = FRAME_DESIRED_GLYPHS (frame); | 1568 = FRAME_DESIRED_GLYPHS (frame); |
1555 | 1569 |
1661 for (i = 0; i < nlen; i++) | 1675 for (i = 0; i < nlen; i++) |
1662 { | 1676 { |
1663 if (i >= olen || nbody[i] != obody[i]) /* A non-matching char. */ | 1677 if (i >= olen || nbody[i] != obody[i]) /* A non-matching char. */ |
1664 { | 1678 { |
1665 cursor_to (vpos, i); | 1679 cursor_to (vpos, i); |
1666 for (j = 1; (i + j < nlen && | 1680 for (j = 1; |
1667 (i + j >= olen || nbody[i+j] != obody[i+j])); | 1681 (i + j < nlen |
1682 && (i + j >= olen || nbody[i + j] != obody[i + j] | |
1683 || (nbody[i + j] & GLYPH_MASK_PADDING))); | |
1668 j++); | 1684 j++); |
1669 | 1685 |
1670 /* Output this run of non-matching chars. */ | 1686 /* Output this run of non-matching chars. */ |
1671 write_glyphs (nbody + i, j); | 1687 write_glyphs (nbody + i, j); |
1672 i += j - 1; | 1688 i += j - 1; |
1849 #endif /* OBSOLETE */ | 1865 #endif /* OBSOLETE */ |
1850 | 1866 |
1851 } | 1867 } |
1852 else if (nlen > olen) | 1868 else if (nlen > olen) |
1853 { | 1869 { |
1854 write_glyphs (nbody + nsp + begmatch, olen - tem); | 1870 /* Here, we used to have the following simple code: |
1855 insert_glyphs (nbody + nsp + begmatch + olen - tem, nlen - olen); | 1871 ---------------------------------------- |
1872 write_glyphs (nbody + nsp + begmatch, olen - tem); | |
1873 insert_glyphs (nbody + nsp + begmatch + olen - tem, nlen - olen); | |
1874 ---------------------------------------- | |
1875 but it doesn't work if nbody[nsp + begmatch + olen - tem] | |
1876 is a padding glyph. */ | |
1877 int out = olen - tem; /* Columns to be overwritten originally. */ | |
1878 int del; | |
1879 | |
1880 /* Calculate columns we can actually overwrite. */ | |
1881 while (nbody[nsp + begmatch + out] & GLYPH_MASK_PADDING) out--; | |
1882 write_glyphs (nbody + nsp + begmatch, out); | |
1883 /* If we left columns to be overwritten. we must delete them. */ | |
1884 del = olen - tem - out; | |
1885 if (del > 0) delete_glyphs (del); | |
1886 /* At last, we insert columns not yet written out. */ | |
1887 insert_glyphs (nbody + nsp + begmatch + out, nlen - olen + del); | |
1856 olen = nlen; | 1888 olen = nlen; |
1857 } | 1889 } |
1858 else if (olen > nlen) | 1890 else if (olen > nlen) |
1859 { | 1891 { |
1860 write_glyphs (nbody + nsp + begmatch, nlen - tem); | 1892 write_glyphs (nbody + nsp + begmatch, nlen - tem); |