diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2019-03-09 14:12:54 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-09 14:12:54 +0100 |
commit | 6eca56c6c5a994be77ad6fd28a3639d963cb7ffc (patch) | |
tree | 1f5d9c5c46cc490b12ced1e44bd1e1ca9ef31557 /src/nvim/ex_cmds2.c | |
parent | f719247118119cd6cd8158f3fead995175b92566 (diff) | |
parent | c1ee5e0694e00595bece82a05098cfa44bfe8fd4 (diff) | |
download | rneovim-6eca56c6c5a994be77ad6fd28a3639d963cb7ffc.tar.gz rneovim-6eca56c6c5a994be77ad6fd28a3639d963cb7ffc.tar.bz2 rneovim-6eca56c6c5a994be77ad6fd28a3639d963cb7ffc.zip |
Merge #9003 'vim-patch:8.0.1372'
Diffstat (limited to 'src/nvim/ex_cmds2.c')
-rw-r--r-- | src/nvim/ex_cmds2.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index 0ecc389699..4684a1b31d 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -1152,6 +1152,21 @@ static void script_dump_profile(FILE *fd) if (vim_fgets(IObuff, IOSIZE, sfd)) { break; } + // When a line has been truncated, append NL, taking care + // of multi-byte characters . + if (IObuff[IOSIZE - 2] != NUL && IObuff[IOSIZE - 2] != NL) { + int n = IOSIZE - 2; + + // Move to the first byte of this char. + // utf_head_off() doesn't work, because it checks + // for a truncated character. + while (n > 0 && (IObuff[n] & 0xc0) == 0x80) { + n--; + } + + IObuff[n] = NL; + IObuff[n + 1] = NUL; + } if (i < si->sn_prl_ga.ga_len && (pp = &PRL_ITEM(si, i))->snp_count > 0) { fprintf(fd, "%5d ", pp->snp_count); |