diff options
| author | Kenichi Handa | 1998-02-20 01:40:47 +0000 |
|---|---|---|
| committer | Kenichi Handa | 1998-02-20 01:40:47 +0000 |
| commit | 0d09d1e645c05f91e7482f1e2ae7e6d8688855fe (patch) | |
| tree | 0ac484af7094b5492f0948dedf25ce61d0f7580e /src | |
| parent | f55a1d81284cb50289f2b96d2c8259fcc8e92c32 (diff) | |
| download | emacs-0d09d1e645c05f91e7482f1e2ae7e6d8688855fe.tar.gz emacs-0d09d1e645c05f91e7482f1e2ae7e6d8688855fe.zip | |
(try_window_id): Use DEC_POS only for multibyte buffer.
display_text_line): Handling of a wide-column character fixed.
Make the behaviour consistent with INC_POS.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xdisp.c | 103 |
1 files changed, 68 insertions, 35 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index 3f4f3099057..f088a1c462b 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -2520,7 +2520,7 @@ try_window_id (window) | |||
| 2520 | int selective = (INTEGERP (current_buffer->selective_display) | 2520 | int selective = (INTEGERP (current_buffer->selective_display) |
| 2521 | ? XINT (current_buffer->selective_display) | 2521 | ? XINT (current_buffer->selective_display) |
| 2522 | : !NILP (current_buffer->selective_display) ? -1 : 0); | 2522 | : !NILP (current_buffer->selective_display) ? -1 : 0); |
| 2523 | 2523 | int multibyte = !NILP (current_buffer->enable_multibyte_characters); | |
| 2524 | struct position val, bp, ep, xp, pp; | 2524 | struct position val, bp, ep, xp, pp; |
| 2525 | int scroll_amount = 0; | 2525 | int scroll_amount = 0; |
| 2526 | int delta; | 2526 | int delta; |
| @@ -2600,7 +2600,10 @@ try_window_id (window) | |||
| 2600 | val.tab_offset = bp.tab_offset + bp.prevhpos - width; | 2600 | val.tab_offset = bp.tab_offset + bp.prevhpos - width; |
| 2601 | did_motion = 1; | 2601 | did_motion = 1; |
| 2602 | pos--; | 2602 | pos--; |
| 2603 | DEC_POS (pos_byte); | 2603 | if (multibyte) |
| 2604 | DEC_POS (pos_byte); | ||
| 2605 | else | ||
| 2606 | pos_byte--; | ||
| 2604 | } | 2607 | } |
| 2605 | 2608 | ||
| 2606 | bp.vpos = vpos; | 2609 | bp.vpos = vpos; |
| @@ -2864,7 +2867,10 @@ try_window_id (window) | |||
| 2864 | val.hpos = xp.prevhpos - width + lmargin; | 2867 | val.hpos = xp.prevhpos - width + lmargin; |
| 2865 | val.tab_offset = xp.tab_offset + bp.prevhpos - width; | 2868 | val.tab_offset = xp.tab_offset + bp.prevhpos - width; |
| 2866 | pos--; | 2869 | pos--; |
| 2867 | DEC_POS (pos_byte); | 2870 | if (multibyte) |
| 2871 | DEC_POS (pos_byte); | ||
| 2872 | else | ||
| 2873 | pos_byte--; | ||
| 2868 | } | 2874 | } |
| 2869 | 2875 | ||
| 2870 | blank_end_of_window = 1; | 2876 | blank_end_of_window = 1; |
| @@ -3117,6 +3123,7 @@ display_text_line (w, start, start_byte, vpos, hpos, taboffset, ovstr_done) | |||
| 3117 | register GLYPH *leftmargin; | 3123 | register GLYPH *leftmargin; |
| 3118 | register GLYPH *p1prev; | 3124 | register GLYPH *p1prev; |
| 3119 | register GLYPH *p1start; | 3125 | register GLYPH *p1start; |
| 3126 | GLYPH *p1_wide_column_end = (GLYPH *) 0; | ||
| 3120 | int prevpos, prevpos_byte; | 3127 | int prevpos, prevpos_byte; |
| 3121 | int *charstart; | 3128 | int *charstart; |
| 3122 | FRAME_PTR f = XFRAME (w->frame); | 3129 | FRAME_PTR f = XFRAME (w->frame); |
| @@ -3270,11 +3277,12 @@ display_text_line (w, start, start_byte, vpos, hpos, taboffset, ovstr_done) | |||
| 3270 | if (left_edge->vpos > vpos | 3277 | if (left_edge->vpos > vpos |
| 3271 | || left_edge->hpos > 0) | 3278 | || left_edge->hpos > 0) |
| 3272 | { | 3279 | { |
| 3273 | pos = left_edge->bufpos; | 3280 | pos = left_edge->bufpos - 1; |
| 3274 | /* Since this should not be a valid multibyte character, we | 3281 | pos_byte = left_edge->bytepos; |
| 3275 | can decrease POS by 1. */ | 3282 | if (multibyte) |
| 3276 | pos--; | 3283 | DEC_POS (pos_byte); |
| 3277 | pos_byte = left_edge->bytepos - 1; | 3284 | else |
| 3285 | pos_byte--; | ||
| 3278 | hpos = left_edge->prevhpos; | 3286 | hpos = left_edge->prevhpos; |
| 3279 | } | 3287 | } |
| 3280 | else | 3288 | else |
| @@ -3326,6 +3334,8 @@ display_text_line (w, start, start_byte, vpos, hpos, taboffset, ovstr_done) | |||
| 3326 | 3334 | ||
| 3327 | while (p1 < endp) | 3335 | while (p1 < endp) |
| 3328 | { | 3336 | { |
| 3337 | int eat_following_binary_data; | ||
| 3338 | |||
| 3329 | if (pos >= pause) | 3339 | if (pos >= pause) |
| 3330 | { | 3340 | { |
| 3331 | int e_t_h; | 3341 | int e_t_h; |
| @@ -3531,6 +3541,7 @@ display_text_line (w, start, start_byte, vpos, hpos, taboffset, ovstr_done) | |||
| 3531 | break; | 3541 | break; |
| 3532 | 3542 | ||
| 3533 | p1prev = p1; | 3543 | p1prev = p1; |
| 3544 | p1_wide_column_end = (GLYPH *) 0; | ||
| 3534 | 3545 | ||
| 3535 | if (multibyte) | 3546 | if (multibyte) |
| 3536 | c = STRING_CHAR_AND_LENGTH (p, limit_byte - pos_byte, len), p += len; | 3547 | c = STRING_CHAR_AND_LENGTH (p, limit_byte - pos_byte, len), p += len; |
| @@ -3712,24 +3723,32 @@ display_text_line (w, start, start_byte, vpos, hpos, taboffset, ovstr_done) | |||
| 3712 | else if (len == 1) | 3723 | else if (len == 1) |
| 3713 | { | 3724 | { |
| 3714 | /* C is not a multibyte character. */ | 3725 | /* C is not a multibyte character. */ |
| 3715 | if (p1 >= leftmargin) | 3726 | eat_following_binary_data = multibyte && BASE_LEADING_CODE_P (c); |
| 3716 | *p1 = (fix_glyph | 3727 | |
| 3717 | (f, (dp && INTEGERP (DISP_ESCAPE_GLYPH (dp)) | 3728 | label_display_binary_data: |
| 3718 | && GLYPH_CHAR_VALID_P (XINT (DISP_ESCAPE_GLYPH (dp))) | 3729 | do { |
| 3719 | ? XINT (DISP_ESCAPE_GLYPH (dp)) : '\\'), | 3730 | if (p1 >= leftmargin && p1 < endp) |
| 3720 | current_face) | 3731 | *p1 = (fix_glyph |
| 3721 | | rev_dir_bit); | 3732 | (f, (dp && INTEGERP (DISP_ESCAPE_GLYPH (dp)) |
| 3722 | p1++; | 3733 | && GLYPH_CHAR_VALID_P (XINT (DISP_ESCAPE_GLYPH (dp))) |
| 3723 | if (p1 >= leftmargin && p1 < endp) | 3734 | ? XINT (DISP_ESCAPE_GLYPH (dp)) : '\\'), |
| 3724 | *p1 = MAKE_GLYPH (f, (c >> 6) + '0', current_face) | rev_dir_bit; | 3735 | current_face) |
| 3725 | p1++; | 3736 | | rev_dir_bit); |
| 3726 | if (p1 >= leftmargin && p1 < endp) | 3737 | p1++; |
| 3727 | *p1 = (MAKE_GLYPH (f, (7 & (c >> 3)) + '0', current_face) | 3738 | if (p1 >= leftmargin && p1 < endp) |
| 3728 | | rev_dir_bit); | 3739 | *p1 = MAKE_GLYPH (f, (c >> 6) + '0', current_face) | rev_dir_bit; |
| 3729 | p1++; | 3740 | p1++; |
| 3730 | if (p1 >= leftmargin && p1 < endp) | 3741 | if (p1 >= leftmargin && p1 < endp) |
| 3731 | *p1 = MAKE_GLYPH (f, (7 & c) + '0', current_face) | rev_dir_bit; | 3742 | *p1 = (MAKE_GLYPH (f, (7 & (c >> 3)) + '0', current_face) |
| 3732 | p1++; | 3743 | | rev_dir_bit); |
| 3744 | p1++; | ||
| 3745 | if (p1 >= leftmargin && p1 < endp) | ||
| 3746 | *p1 = MAKE_GLYPH (f, (7 & c) + '0', current_face) | rev_dir_bit; | ||
| 3747 | p1++; | ||
| 3748 | } while (eat_following_binary_data | ||
| 3749 | && (pos_byte + len) < limit_byte | ||
| 3750 | && ! CHAR_HEAD_P (*p) | ||
| 3751 | && ((c = *p++), len++)); | ||
| 3733 | } | 3752 | } |
| 3734 | else | 3753 | else |
| 3735 | { | 3754 | { |
| @@ -3746,6 +3765,17 @@ display_text_line (w, start, start_byte, vpos, hpos, taboffset, ovstr_done) | |||
| 3746 | *p1 = g, g |= GLYPH_MASK_PADDING; | 3765 | *p1 = g, g |= GLYPH_MASK_PADDING; |
| 3747 | p1++; | 3766 | p1++; |
| 3748 | } | 3767 | } |
| 3768 | |||
| 3769 | p1_wide_column_end = p1; | ||
| 3770 | /* Check if binary data follows it. */ | ||
| 3771 | if (pos_byte + len < limit_byte | ||
| 3772 | && ! CHAR_HEAD_P (*p)) | ||
| 3773 | { | ||
| 3774 | eat_following_binary_data = 1; | ||
| 3775 | c = *p++; | ||
| 3776 | len++; | ||
| 3777 | goto label_display_binary_data; | ||
| 3778 | } | ||
| 3749 | } | 3779 | } |
| 3750 | 3780 | ||
| 3751 | prevpos = pos; | 3781 | prevpos = pos; |
| @@ -3811,17 +3841,17 @@ display_text_line (w, start, start_byte, vpos, hpos, taboffset, ovstr_done) | |||
| 3811 | pos = prevpos; | 3841 | pos = prevpos; |
| 3812 | pos_byte = prevpos_byte; | 3842 | pos_byte = prevpos_byte; |
| 3813 | 3843 | ||
| 3814 | if (len == 1) | 3844 | if (p1_wide_column_end < endp) |
| 3815 | /* C is not a multi-byte character. We can break it and | 3845 | /* As ENDP is not in the middle of wide-column character, |
| 3816 | start from the middle column in the next line. So, | 3846 | we can break the line at ENDP and start from the middle |
| 3817 | adjust VAL.HPOS to skip the columns output on this | 3847 | column in the next line. So, adjust VAL.HPOS to skip |
| 3818 | line. */ | 3848 | the columns output on this line. */ |
| 3819 | val.hpos += p1prev - endp; | 3849 | val.hpos += p1prev - endp; |
| 3820 | else | 3850 | else |
| 3821 | { | 3851 | { |
| 3822 | /* C is a multibyte character. Since we can't broke it | 3852 | /* We displayed a wide-column character at around ENDP. |
| 3823 | in the middle, the whole character should be driven | 3853 | Since we can't broke it in the middle, the whole |
| 3824 | into the next line. */ | 3854 | character should be driven into the next line. */ |
| 3825 | /* As the result, the actual columns occupied by the | 3855 | /* As the result, the actual columns occupied by the |
| 3826 | text on this line is less than WIDTH. VAL.TAB_OFFSET | 3856 | text on this line is less than WIDTH. VAL.TAB_OFFSET |
| 3827 | must be adjusted. */ | 3857 | must be adjusted. */ |
| @@ -3897,7 +3927,10 @@ display_text_line (w, start, start_byte, vpos, hpos, taboffset, ovstr_done) | |||
| 3897 | *p1++ = fix_glyph (f, continuer, 0); | 3927 | *p1++ = fix_glyph (f, continuer, 0); |
| 3898 | val.vpos = 0; | 3928 | val.vpos = 0; |
| 3899 | lastpos--; | 3929 | lastpos--; |
| 3900 | DEC_POS (lastpos_byte); | 3930 | if (multibyte) |
| 3931 | DEC_POS (lastpos_byte); | ||
| 3932 | else | ||
| 3933 | lastpos_byte--; | ||
| 3901 | val.tab_offset = taboffset + width; | 3934 | val.tab_offset = taboffset + width; |
| 3902 | } | 3935 | } |
| 3903 | } | 3936 | } |