Mercurial > vim
comparison src/eval.c @ 3277:55cebc7e5de0 v7.3.407
updated for version 7.3.407
Problem: ":12verbose call F()" may duplicate text while trying to truncate.
(Thinca)
Solution: Only truncate when there is not enough room. Also check the byte
length of the buffer.
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Fri, 20 Jan 2012 20:44:43 +0100 |
parents | 320cc46d0eb0 |
children | aaee60933022 |
comparison
equal
deleted
inserted
replaced
3276:98958001bcfb | 3277:55cebc7e5de0 |
---|---|
22161 else | 22161 else |
22162 { | 22162 { |
22163 s = tv2string(&argvars[i], &tofree, numbuf2, 0); | 22163 s = tv2string(&argvars[i], &tofree, numbuf2, 0); |
22164 if (s != NULL) | 22164 if (s != NULL) |
22165 { | 22165 { |
22166 trunc_string(s, buf, MSG_BUF_CLEN); | 22166 if (vim_strsize(s) > MSG_BUF_CLEN) |
22167 msg_puts(buf); | 22167 { |
22168 trunc_string(s, buf, MSG_BUF_CLEN, MSG_BUF_LEN); | |
22169 s = buf; | |
22170 } | |
22171 msg_puts(s); | |
22168 vim_free(tofree); | 22172 vim_free(tofree); |
22169 } | 22173 } |
22170 } | 22174 } |
22171 } | 22175 } |
22172 msg_puts((char_u *)")"); | 22176 msg_puts((char_u *)")"); |
22250 * have some idea how it starts and ends. smsg() would always | 22254 * have some idea how it starts and ends. smsg() would always |
22251 * truncate it at the end. */ | 22255 * truncate it at the end. */ |
22252 s = tv2string(fc->rettv, &tofree, numbuf2, 0); | 22256 s = tv2string(fc->rettv, &tofree, numbuf2, 0); |
22253 if (s != NULL) | 22257 if (s != NULL) |
22254 { | 22258 { |
22255 trunc_string(s, buf, MSG_BUF_CLEN); | 22259 if (vim_strsize(s) > MSG_BUF_CLEN) |
22256 smsg((char_u *)_("%s returning %s"), sourcing_name, buf); | 22260 { |
22261 trunc_string(s, buf, MSG_BUF_CLEN, MSG_BUF_LEN); | |
22262 s = buf; | |
22263 } | |
22264 smsg((char_u *)_("%s returning %s"), sourcing_name, s); | |
22257 vim_free(tofree); | 22265 vim_free(tofree); |
22258 } | 22266 } |
22259 } | 22267 } |
22260 msg_puts((char_u *)"\n"); /* don't overwrite this either */ | 22268 msg_puts((char_u *)"\n"); /* don't overwrite this either */ |
22261 | 22269 |