A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/neovim/neovim/commit/be15ac06badbea6b11390ad7d9c2ddd4aea73480 below:

support multibyte fillchar · neovim/neovim@be15ac0 · GitHub

@@ -3418,7 +3418,7 @@ typedef enum {

3418 3418

///

3419 3419

/// @return The final width of the statusline

3420 3420

int build_stl_str_hl(win_T *wp, char_u *out, size_t outlen, char_u *fmt, int use_sandbox,

3421 -

char_u fillchar, int maxwidth, stl_hlrec_t **hltab, StlClickRecord **tabtab)

3421 +

int fillchar, int maxwidth, stl_hlrec_t **hltab, StlClickRecord **tabtab)

3422 3422

{

3423 3423

static size_t stl_items_len = 20; // Initial value, grows as needed.

3424 3424

static stl_item_t *stl_items = NULL;

@@ -3461,9 +3461,6 @@ int build_stl_str_hl(win_T *wp, char_u *out, size_t outlen, char_u *fmt, int use

3461 3461 3462 3462

if (fillchar == 0) {

3463 3463

fillchar = ' ';

3464 -

} else if (utf_char2len(fillchar) > 1) {

3465 -

// Can't handle a multi-byte fill character yet.

3466 -

fillchar = '-';

3467 3464

}

3468 3465 3469 3466

// The cursor in windows other than the current one isn't always

@@ -3661,7 +3658,7 @@ int build_stl_str_hl(win_T *wp, char_u *out, size_t outlen, char_u *fmt, int use

3661 3658

out_p = out_p - n + 1;

3662 3659

// Fill up space left over by half a double-wide char.

3663 3660

while (++group_len < stl_items[stl_groupitems[groupdepth]].minwid) {

3664 -

*out_p++ = fillchar;

3661 +

MB_CHAR2BYTES(fillchar, out_p);

3665 3662

}

3666 3663

// }

3667 3664

@@ -3684,14 +3681,14 @@ int build_stl_str_hl(win_T *wp, char_u *out, size_t outlen, char_u *fmt, int use

3684 3681

if (min_group_width < 0) {

3685 3682

min_group_width = 0 - min_group_width;

3686 3683

while (group_len++ < min_group_width && out_p < out_end_p) {

3687 -

*out_p++ = fillchar;

3684 +

MB_CHAR2BYTES(fillchar, out_p);

3688 3685

}

3689 3686

// If the group is right-aligned, shift everything to the right and

3690 3687

// prepend with filler characters.

3691 3688

} else {

3692 3689

// { Move the group to the right

3693 -

memmove(t + min_group_width - group_len, t, (size_t)(out_p - t));

3694 -

group_len = min_group_width - group_len;

3690 +

group_len = (min_group_width - group_len) * utf_char2len(fillchar);

3691 +

memmove(t + group_len, t, (size_t)(out_p - t));

3695 3692

if (out_p + group_len >= (out_end_p + 1)) {

3696 3693

group_len = (long)(out_end_p - out_p);

3697 3694

}

@@ -3705,7 +3702,7 @@ int build_stl_str_hl(win_T *wp, char_u *out, size_t outlen, char_u *fmt, int use

3705 3702 3706 3703

// Prepend the fill characters

3707 3704

for (; group_len > 0; group_len--) {

3708 -

*t++ = fillchar;

3705 +

MB_CHAR2BYTES(fillchar, t);

3709 3706

}

3710 3707

}

3711 3708

}

@@ -4237,7 +4234,7 @@ int build_stl_str_hl(win_T *wp, char_u *out, size_t outlen, char_u *fmt, int use

4237 4234

if (l + 1 == minwid && fillchar == '-' && ascii_isdigit(*t)) {

4238 4235

*out_p++ = ' ';

4239 4236

} else {

4240 -

*out_p++ = fillchar;

4237 +

MB_CHAR2BYTES(fillchar, out_p);

4241 4238

}

4242 4239

}

4243 4240

minwid = 0;

@@ -4248,20 +4245,21 @@ int build_stl_str_hl(win_T *wp, char_u *out, size_t outlen, char_u *fmt, int use

4248 4245

}

4249 4246 4250 4247

// { Copy the string text into the output buffer

4251 -

while (*t && out_p < out_end_p) {

4252 -

*out_p++ = *t++;

4248 +

for (; *t && out_p < out_end_p; t++) {

4253 4249

// Change a space by fillchar, unless fillchar is '-' and a

4254 4250

// digit follows.

4255 -

if (fillable && out_p[-1] == ' '

4256 -

&& (!ascii_isdigit(*t) || fillchar != '-')) {

4257 -

out_p[-1] = fillchar;

4251 +

if (fillable && *t == ' '

4252 +

&& (!ascii_isdigit(*(t + 1)) || fillchar != '-')) {

4253 +

MB_CHAR2BYTES(fillchar, out_p);

4254 +

} else {

4255 +

*out_p++ = *t;

4258 4256

}

4259 4257

}

4260 4258

// }

4261 4259 4262 4260

// For left-aligned items, fill any remaining space with the fillchar

4263 4261

for (; l < minwid && out_p < out_end_p; l++) {

4264 -

*out_p++ = fillchar;

4262 +

MB_CHAR2BYTES(fillchar, out_p);

4265 4263

}

4266 4264 4267 4265

// Otherwise if the item is a number, copy that to the output buffer.

@@ -4454,7 +4452,7 @@ int build_stl_str_hl(win_T *wp, char_u *out, size_t outlen, char_u *fmt, int use

4454 4452 4455 4453

// Fill up for half a double-wide character.

4456 4454

while (++width < maxwidth) {

4457 -

*trunc_p++ = fillchar;

4455 +

MB_CHAR2BYTES(fillchar, trunc_p);

4458 4456

*trunc_p = NUL;

4459 4457

}

4460 4458

// }

@@ -4505,13 +4503,13 @@ int build_stl_str_hl(win_T *wp, char_u *out, size_t outlen, char_u *fmt, int use

4505 4503

standard_spaces * (num_separators - 1);

4506 4504 4507 4505

for (int i = 0; i < num_separators; i++) {

4508 -

int dislocation = (i == (num_separators - 1))

4509 -

? final_spaces : standard_spaces;

4506 +

int dislocation = (i == (num_separators - 1)) ? final_spaces : standard_spaces;

4507 +

dislocation *= utf_char2len(fillchar);

4510 4508

char_u *start = stl_items[stl_separator_locations[i]].start;

4511 4509

char_u *seploc = start + dislocation;

4512 4510

STRMOVE(seploc, start);

4513 -

for (char_u *s = start; s < seploc; s++) {

4514 -

*s = fillchar;

4511 +

for (char_u *s = start; s < seploc; ) {

4512 +

MB_CHAR2BYTES(fillchar, s);

4515 4513

}

4516 4514 4517 4515

for (int item_idx = stl_separator_locations[i] + 1;


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4