diff options
| author | Sander Bosma <sanderbosma@gmail.com> | 2017-02-19 20:59:11 +0100 | 
|---|---|---|
| committer | Sander Bosma <sanderbosma@gmail.com> | 2017-02-20 20:06:38 +0100 | 
| commit | ddd8f7d333645169d94bdf8a0ec551a40620a19e (patch) | |
| tree | 94725a662842e55a82a22291f6fc4be94d337d4a /src | |
| parent | 8e194c53c78cea7a93caeabfd5b4a72be3a40933 (diff) | |
| download | rneovim-ddd8f7d333645169d94bdf8a0ec551a40620a19e.tar.gz rneovim-ddd8f7d333645169d94bdf8a0ec551a40620a19e.tar.bz2 rneovim-ddd8f7d333645169d94bdf8a0ec551a40620a19e.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/nvim/message.c | 37 | 
1 files changed, 11 insertions, 26 deletions
| diff --git a/src/nvim/message.c b/src/nvim/message.c index 5427ae7793..699f4b87b9 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -269,33 +269,18 @@ void trunc_string(char_u *s, char_u *buf, int room, int buflen)        }    } -  /* Last part: End of the string. */ -  i = e; -  if (enc_dbcs != 0) { -    /* For DBCS going backwards in a string is slow, but -     * computing the cell width isn't too slow: go forward -     * until the rest fits. */ -    n = vim_strsize(s + i); -    while (len + n > room) { -      n -= ptr2cells(s + i); -      i += (*mb_ptr2len)(s + i); -    } -  } else if (enc_utf8) { -    /* For UTF-8 we can go backwards easily. */ -    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; +  // Last part: End of the string. +  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;      } -  } else { -    for (i = (int)STRLEN(s); len + (n = ptr2cells(s + i - 1)) <= room; --i) -      len += n; +    len += n; +    i = half;    }    if (i <= e + 3) { | 
