Mercurial > vim
comparison src/drawline.c @ 33349:e385bda5e345 v9.0.1938
patch 9.0.1938: multispace wrong when scrolling horizontally
Commit: https://github.com/vim/vim/commit/abc808112ee5df58a9f612f2bb5a65389c2c14e1
Author: zeertzjq <zeertzjq@outlook.com>
Date: Sun Sep 24 23:32:18 2023 +0200
patch 9.0.1938: multispace wrong when scrolling horizontally
Problem: multispace wrong when scrolling horizontally
Solution: Update position in "multispace" or "leadmultispace" also in
skipped chars. Reorder conditions to be more consistent.
closes: #13145
closes: #13147
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 24 Sep 2023 23:45:04 +0200 |
parents | a2dfcbbfc301 |
children | 886e7c8f7614 |
comparison
equal
deleted
inserted
replaced
33348:ec6ad1fcb7ee | 33349:e385bda5e345 |
---|---|
1682 head = 0; | 1682 head = 0; |
1683 charsize = win_lbr_chartabsize(&cts, &head); | 1683 charsize = win_lbr_chartabsize(&cts, &head); |
1684 cts.cts_vcol += charsize; | 1684 cts.cts_vcol += charsize; |
1685 prev_ptr = cts.cts_ptr; | 1685 prev_ptr = cts.cts_ptr; |
1686 MB_PTR_ADV(cts.cts_ptr); | 1686 MB_PTR_ADV(cts.cts_ptr); |
1687 if (wp->w_p_list) | |
1688 { | |
1689 in_multispace = *prev_ptr == ' ' && (*cts.cts_ptr == ' ' | |
1690 || (prev_ptr > line && prev_ptr[-1] == ' ')); | |
1691 if (!in_multispace) | |
1692 multispace_pos = 0; | |
1693 else if (cts.cts_ptr >= line + leadcol | |
1694 && wp->w_lcs_chars.multispace != NULL) | |
1695 { | |
1696 ++multispace_pos; | |
1697 if (wp->w_lcs_chars.multispace[multispace_pos] == NUL) | |
1698 multispace_pos = 0; | |
1699 } | |
1700 else if (cts.cts_ptr < line + leadcol | |
1701 && wp->w_lcs_chars.leadmultispace != NULL) | |
1702 { | |
1703 ++multispace_pos; | |
1704 if (wp->w_lcs_chars.leadmultispace[multispace_pos] == NUL) | |
1705 multispace_pos = 0; | |
1706 } | |
1707 } | |
1687 } | 1708 } |
1688 wlv.vcol = cts.cts_vcol; | 1709 wlv.vcol = cts.cts_vcol; |
1689 ptr = cts.cts_ptr; | 1710 ptr = cts.cts_ptr; |
1690 clear_chartabsize_arg(&cts); | 1711 clear_chartabsize_arg(&cts); |
1691 | 1712 |
2587 else | 2608 else |
2588 { | 2609 { |
2589 #ifdef FEAT_LINEBREAK | 2610 #ifdef FEAT_LINEBREAK |
2590 int c0; | 2611 int c0; |
2591 #endif | 2612 #endif |
2592 #ifdef FEAT_SPELL | |
2593 char_u *prev_ptr = ptr; | 2613 char_u *prev_ptr = ptr; |
2594 #endif | |
2595 | 2614 |
2596 // Get a character from the line itself. | 2615 // Get a character from the line itself. |
2597 c = *ptr; | 2616 c = *ptr; |
2598 #ifdef FEAT_LINEBREAK | 2617 #ifdef FEAT_LINEBREAK |
2599 c0 = *ptr; | 2618 c0 = *ptr; |
2939 if (!wp->w_p_list) | 2958 if (!wp->w_p_list) |
2940 c = ' '; | 2959 c = ' '; |
2941 } | 2960 } |
2942 } | 2961 } |
2943 #endif | 2962 #endif |
2944 in_multispace = c == ' ' | 2963 if (wp->w_p_list) |
2945 && ((ptr > line + 1 && ptr[-2] == ' ') || *ptr == ' '); | 2964 { |
2946 if (!in_multispace) | 2965 in_multispace = c == ' ' && (*ptr == ' ' |
2947 multispace_pos = 0; | 2966 || (prev_ptr > line && prev_ptr[-1] == ' ')); |
2967 if (!in_multispace) | |
2968 multispace_pos = 0; | |
2969 } | |
2948 | 2970 |
2949 // 'list': Change char 160 to 'nbsp' and space to 'space' | 2971 // 'list': Change char 160 to 'nbsp' and space to 'space' |
2950 // setting in 'listchars'. But not when the character is | 2972 // setting in 'listchars'. But not when the character is |
2951 // followed by a composing character (use mb_l to check that). | 2973 // followed by a composing character (use mb_l to check that). |
2952 if (wp->w_p_list | 2974 if (wp->w_p_list |