message.c: fix dead assignment by removing dead code

`enc_dbcs` and `enc_utf8` are deprecated (globals.h), so the second branch is
always taken.
This commit is contained in:
Sander Bosma
2017-02-19 20:59:11 +01:00
parent 8e194c53c7
commit ddd8f7d333

View File

@@ -269,33 +269,18 @@ void trunc_string(char_u *s, char_u *buf, int room, int buflen)
} }
} }
/* Last part: End of the string. */ // Last part: End of the string.
i = e; half = i = (int)STRLEN(s);
if (enc_dbcs != 0) { for (;;) {
/* For DBCS going backwards in a string is slow, but do {
* computing the cell width isn't too slow: go forward half = half - (*mb_head_off)(s, s + half - 1) - 1;
* until the rest fits. */ } while (utf_iscomposing(utf_ptr2char(s + half)) && half > 0);
n = vim_strsize(s + i); n = ptr2cells(s + half);
while (len + n > room) { if (len + n > room) {
n -= ptr2cells(s + i); break;
i += (*mb_ptr2len)(s + i);
} }
} else if (enc_utf8) { len += n;
/* For UTF-8 we can go backwards easily. */ i = half;
half = i = (int)STRLEN(s);
for (;; ) {
do
half = half - (*mb_head_off)(s, s + half - 1) - 1;
while (utf_iscomposing(utf_ptr2char(s + half)) && half > 0);
n = ptr2cells(s + half);
if (len + n > room)
break;
len += n;
i = half;
}
} else {
for (i = (int)STRLEN(s); len + (n = ptr2cells(s + i - 1)) <= room; --i)
len += n;
} }
if (i <= e + 3) { if (i <= e + 3) {