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

a0931a90ee

Co-authored-by: John Marriott <basilisk@internode.on.net>
This commit is contained in:
zeertzjq
2026-05-21 09:35:27 +08:00
committed by GitHub
parent 74cc0364f1
commit a952575c3b
5 changed files with 22 additions and 19 deletions

View File

@@ -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);