From a952575c3bb8e23cccaaeb91bc5cc0cb908cb02c Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 21 May 2026 09:35:27 +0800 Subject: vim-patch:9.2.0506: home_replace() function can be improved (#39925) Problem: home_replace() function can be improved Solution: Refactor home_replace() to return the length of the string (John Marriott). In addition: - in function set_b0_fname() move ulen into the block where it is used. - In function findswapname() rework logic around displaying "swap file already exists" dialogue so that literal message text is set once. closes: vim/vim#20249 https://github.com/vim/vim/commit/a0931a90eeee6692556f330b5ba1fb413f9ea85d Co-authored-by: John Marriott --- src/nvim/buffer.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/nvim/buffer.c') diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index 5ef7cda17a..09993d03de 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -3317,9 +3317,8 @@ void fileinfo(int fullname, int shorthelp, bool dont_truncate) IOSIZE - bufferlen, "%s", name); } else { name = (!fullname && curbuf->b_fname != NULL) ? curbuf->b_fname : curbuf->b_ffname; - home_replace(shorthelp ? curbuf : NULL, name, buffer + bufferlen, - IOSIZE - bufferlen, true); - bufferlen += strlen(buffer + bufferlen); + bufferlen += home_replace(shorthelp ? curbuf : NULL, name, + buffer + bufferlen, IOSIZE - bufferlen, true); } bool dontwrite = bt_dontwrite(curbuf); -- cgit