]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0232: fileinfo not shown after :bd of last listed buffer v9.2.0232
authorHirohito Higashi <h.east.727@gmail.com>
Sun, 22 Mar 2026 21:41:42 +0000 (21:41 +0000)
committerChristian Brabandt <cb@256bit.org>
Sun, 22 Mar 2026 21:41:42 +0000 (21:41 +0000)
Problem:  fileinfo not shown after :bd of last listed buffer
          (memeplex)
Solution: Set need_fileinfo to true in empty_curbuf()
          (Hirohito Higashi)

When deleting the last listed buffer with :bd, the new empty buffer's
file info (e.g. "[No Name]" --No lines in buffer--) was not displayed.
do_ecmd() only calls fileinfo() for existing buffers (oldbuf), not for
newly created empty buffers.

Set need_fileinfo in empty_curbuf() so the file info is displayed after
redraw.

fixes:  #548
closes: #19802

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Hirohito Higashi <h.east.727@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/buffer.c
src/testdir/test_messages.vim
src/version.c

index fa01197854201e9cf941babcfb20c9334867ffef..26e3ec969d22affadde8e181b9abc2f0e489b691 100644 (file)
@@ -1323,6 +1323,9 @@ empty_curbuf(
        close_buffer(NULL, buf, action, FALSE, FALSE);
     if (!close_others)
        need_fileinfo = FALSE;
+    else if (retval == OK && !shortmess(SHM_FILEINFO))
+       // do_ecmd() does not display file info for a new empty buffer.
+       need_fileinfo = TRUE;
     return retval;
 }
 
index 0942fe2b80b0255f647bbd0731a4febd870ba007..5fa84e9542d3c16bddfbe80f669d7a9da3d41fa1 100644 (file)
@@ -811,4 +811,28 @@ func Test_long_formatprg_no_hit_enter()
   call StopVimInTerminal(buf)
 endfunc
 
+" Test that fileinfo is shown after deleting the last listed buffer with :bd
+func Test_fileinfo_after_last_bd()
+  CheckRunVimInTerminal
+
+  let content =<< trim END
+    set shortmess-=F
+    edit xxx
+    edit yyy
+  END
+
+  call writefile(content, 'Xtest_fileinfo_last_bd', 'D')
+  let buf = RunVimInTerminal('-S Xtest_fileinfo_last_bd', #{rows: 10})
+  call WaitForAssert({-> assert_match('^"yyy" \[New\]', term_getline(buf, 10))})
+
+  call term_sendkeys(buf, ":bd\<CR>")
+  call WaitForAssert({-> assert_match('^"xxx" \[New\]', term_getline(buf, 10))})
+
+  call term_sendkeys(buf, ":bd\<CR>")
+  call WaitForAssert({-> assert_match('^\"\[No Name\]\" --No lines in buffer--', term_getline(buf, 10))})
+
+  " clean up
+  call StopVimInTerminal(buf)
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab
index b7344e387191daa85bc06a9f86f182c039cbdaa7..a542cb79d6844bf743c7b57a737c98a64d54267b 100644 (file)
@@ -734,6 +734,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    232,
 /**/
     231,
 /**/