vim-patch:7.4.665, 671

Problem:    'linebreak' does not work properly with multi-byte characters.
Solution:   Compute the pointer offset with mb_head_off().  (Yasuhiro
            Matsumoto)

76feaf1bfe

Problem:    Warning for shadowing a variable.
Solution:   Rename off to mb_off. (Kazunobu Kuriyama)

4df702999d
This commit is contained in:
Shougo Matsushita 2015-12-16 05:09:28 +09:00
parent 1946f96a16
commit 4cc38e04c7
2 changed files with 5 additions and 6 deletions

View File

@ -3323,16 +3323,15 @@ win_line (
* Found last space before word: check for line break. * Found last space before word: check for line break.
*/ */
if (wp->w_p_lbr && vim_isbreak(c) && !vim_isbreak(*ptr)) { if (wp->w_p_lbr && vim_isbreak(c) && !vim_isbreak(*ptr)) {
char_u *p = ptr - ( int mb_off = has_mbyte ? (*mb_head_off)(line, ptr - 1) : 0;
has_mbyte ? mb_l : char_u *p = ptr - (mb_off + 1);
1);
// TODO: is passing p for start of the line OK? // TODO: is passing p for start of the line OK?
n_extra = win_lbr_chartabsize(wp, line, p, (colnr_T)vcol, NULL) - 1; n_extra = win_lbr_chartabsize(wp, line, p, (colnr_T)vcol, NULL) - 1;
if (c == TAB && n_extra + col > wp->w_width) { if (c == TAB && n_extra + col > wp->w_width) {
n_extra = (int)wp->w_buffer->b_p_ts n_extra = (int)wp->w_buffer->b_p_ts
- vcol % (int)wp->w_buffer->b_p_ts - 1; - vcol % (int)wp->w_buffer->b_p_ts - 1;
} }
c_extra = ' '; c_extra = mb_off > 0 ? MB_FILLER_CHAR : ' ';
if (ascii_iswhite(c)) { if (ascii_iswhite(c)) {
if (c == TAB) if (c == TAB)
/* See "Tab alignment" below. */ /* See "Tab alignment" below. */

View File

@ -322,13 +322,13 @@ static int included_patches[] = {
// 674 NA // 674 NA
673, 673,
// 672, // 672,
// 671, 671,
670, 670,
// 669 NA // 669 NA
668, 668,
667, 667,
// 666 NA // 666 NA
// 665, 665,
// 664 NA // 664 NA
// 663 NA // 663 NA
// 662, // 662,