diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2018-06-13 11:11:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-13 11:11:12 +0200 |
commit | 463da8480685dbd53335b4e3f0a6d37cacbacac4 (patch) | |
tree | 8d98f9e625737b89f3336f6cd4fab0c0dc825e0c /src/nvim/mbyte.c | |
parent | f4ba20d1c0b6c45b2c50d3cb23ce0d0b365d3dde (diff) | |
parent | 050f3975f6b44da6316de189929625e1c382a6c8 (diff) | |
download | rneovim-463da8480685dbd53335b4e3f0a6d37cacbacac4.tar.gz rneovim-463da8480685dbd53335b4e3f0a6d37cacbacac4.tar.bz2 rneovim-463da8480685dbd53335b4e3f0a6d37cacbacac4.zip |
Merge pull request #7992 from bfredl/mbscreen
Represent Screen state as UTF-8
Diffstat (limited to 'src/nvim/mbyte.c')
-rw-r--r-- | src/nvim/mbyte.c | 25 |
1 files changed, 2 insertions, 23 deletions
diff --git a/src/nvim/mbyte.c b/src/nvim/mbyte.c index 05e326104b..472c1ee9f6 100644 --- a/src/nvim/mbyte.c +++ b/src/nvim/mbyte.c @@ -560,7 +560,7 @@ size_t mb_string2cells(const char_u *str) /// We make sure that the offset used is less than "max_off". int utf_off2cells(unsigned off, unsigned max_off) { - return (off + 1 < max_off && ScreenLines[off + 1] == 0) ? 2 : 1; + return (off + 1 < max_off && ScreenLines[off + 1][0] == 0) ? 2 : 1; } /// Convert a UTF-8 byte sequence to a wide character @@ -790,27 +790,6 @@ int utfc_ptr2char_len(const char_u *p, int *pcc, int maxlen) #undef ISCOMPOSING } -/* - * Convert the character at screen position "off" to a sequence of bytes. - * Includes the composing characters. - * "buf" must at least have the length MB_MAXBYTES + 1. - * Only to be used when ScreenLinesUC[off] != 0. - * Returns the produced number of bytes. - */ -int utfc_char2bytes(int off, char_u *buf) -{ - int len; - int i; - - len = utf_char2bytes(ScreenLinesUC[off], buf); - for (i = 0; i < Screen_mco; ++i) { - if (ScreenLinesC[i][off] == 0) - break; - len += utf_char2bytes(ScreenLinesC[i][off], buf + len); - } - return len; -} - /// Get the length of a UTF-8 byte sequence representing a single codepoint /// /// @param[in] p UTF-8 string. @@ -1853,7 +1832,7 @@ int mb_fix_col(int col, int row) col = check_col(col); row = check_row(row); if (ScreenLines != NULL && col > 0 - && ScreenLines[LineOffset[row] + col] == 0) { + && ScreenLines[LineOffset[row] + col][0] == 0) { return col - 1; } return col; |