فهرست منبع

docs: documentation and version number update

Updated documentation related to the new release as well as bumped the version number.
jlanzarotta 10 ماه پیش
والد
کامیت
efcf16b31c
2فایلهای تغییر یافته به همراه57 افزوده شده و 46 حذف شده
  1. 18 3
      doc/bufexplorer.txt
  2. 39 43
      plugin/bufexplorer.vim

+ 18 - 3
doc/bufexplorer.txt

@@ -1,7 +1,7 @@
-*bufexplorer.txt*              Buffer Explorer       Last Change: 05 Nov 2024
+*bufexplorer.txt*              Buffer Explorer       Last Change: 16 Feb 2025
 
 Buffer Explorer                                *buffer-explorer* *bufexplorer*
-                                Version 7.4.28
+                                Version 7.5.0
 
 Plugin for easily exploring (or browsing) Vim|:buffers|.
 
@@ -26,7 +26,7 @@ To install:
   - Download the bufexplorer.zip from one of the following places:
     https://github.com/jlanzarotta/bufexplorer
     http://www.vim.org/scripts/script.php?script_id=42
-    or use a package manager like Vundle.
+    or use a package manager like vim-plug, Vundle, etc..
   - Extract the zip archive into your runtime directory.
     The archive contains plugin/bufexplorer.vim, and doc/bufexplorer.txt.
   - Start Vim or goto an existing instance of Vim.
@@ -269,6 +269,21 @@ The default is 1.
 ===============================================================================
 CHANGE LOG                                              *bufexplorer-changelog*
 
+7.5.0    February 16, 2025
+     What's Changed
+     - Major patch implemented by Dr. Michael Henry.
+       https://github.com/jlanzarotta/bufexplorer/pull/118
+       Significant rework and restructuring of the s:SelectBuffer() method to
+       demonstrate behaviors described in Github issue #117.
+       https://github.com/jlanzarotta/bufexplorer/issues/117
+       This patch includes fixes which also resolves:
+       - Github issue #81. Previous buffer duplicated in split after openning
+         new buffer in tab.
+         https://github.com/jlanzarotta/bufexplorer/issues/81
+       - Github issue #65. bv plus t does weird things.
+         https://github.com/jlanzarotta/bufexplorer/issues/65
+       - Github issue #52. Find Active Window not working as expected.
+         https://github.com/jlanzarotta/bufexplorer/issues/52
 7.4.28   November 5, 2024
        - Thanks to GitHub user jsvia, for the addition of the new
          bufExplorerShowTerminal feature.  Please refer to the documentation

+ 39 - 43
plugin/bufexplorer.vim

@@ -1,5 +1,5 @@
 "============================================================================
-"    Copyright: Copyright (c) 2001-2024, Jeff Lanzarotta
+"    Copyright: Copyright (c) 2001-2025, Jeff Lanzarotta
 "               All rights reserved.
 "
 "               Redistribution and use in source and binary forms, with or
@@ -36,7 +36,7 @@
 " Name Of File: bufexplorer.vim
 "  Description: Buffer Explorer Vim Plugin
 "   Maintainer: Jeff Lanzarotta (my name at gmail dot com)
-" Last Changed: Tuesday, 13 August 2024
+" Last Changed: Sunday, 16 February 2025
 "      Version: See g:bufexplorer_version for version number.
 "        Usage: This file should reside in the plugin directory and be
 "               automatically sourced.
@@ -74,7 +74,7 @@ endif
 "1}}}
 
 " Version number
-let g:bufexplorer_version = "7.4.28"
+let g:bufexplorer_version = "7.5.0"
 
 " Plugin Code {{{1
 " Check for Vim version {{{2
@@ -90,6 +90,7 @@ if v:version < 700
     endif
     finish
 endif
+
 " Check to see if the version of Vim has the correct patch applied, if not, do
 " not used <nowait>.
 if v:version > 703 || v:version == 703 && has('patch1261') && has('patch1264')
@@ -185,10 +186,9 @@ function! s:CatalogBuffers()
 endfunction
 
 " AssociatedTab {{{2
-" Return the number of the tab associated with the specified buffer.
-" If the buffer is associated with more than one tab, the first one
-" found is returned. If the buffer is not associated with any tabs,
-" -1 is returned.
+" Return the number of the tab associated with the specified buffer. If the
+" buffer is associated with more than one tab, the first one found is
+" returned. If the buffer is not associated with any tabs, -1 is returned.
 function! s:AssociatedTab(bufnr)
     for tab in range(1, tabpagenr('$'))
         let list = gettabvar(tab, 'bufexp_buf_list', [])
@@ -202,8 +202,8 @@ function! s:AssociatedTab(bufnr)
 endfunction
 
 " RemoveBufFromOtherTabs {{{2
-" Remove the specified buffer from the buffer lists of all tabs
-" except the current tab.
+" Remove the specified buffer from the buffer lists of all tabs except the
+" current tab.
 function! s:RemoveBufFromOtherTabs(bufnr)
     for tab in range(1, tabpagenr('$'))
         if tab == tabpagenr()
@@ -222,8 +222,8 @@ function! s:RemoveBufFromOtherTabs(bufnr)
 endfunction
 
 " AddBufToCurrentTab {{{2
-" Add the specified buffer to the list of buffers associated
-" with the current tab
+" Add the specified buffer to the list of buffers associated with the current
+" tab.
 function! s:AddBufToCurrentTab(bufnr)
     if index(t:bufexp_buf_list, a:bufnr) == -1
         call add(t:bufexp_buf_list, a:bufnr)
@@ -231,12 +231,10 @@ function! s:AddBufToCurrentTab(bufnr)
 endfunction
 
 " IsInCurrentTab {{{2
-" Returns whether the specified buffer is associated
-" with the current tab
+" Returns whether the specified buffer is associated with the current tab.
 function! s:IsInCurrentTab(bufnr)
-    " It shouldn't happen that the list of buffers is
-    " not defined but if it does, play it safe and
-    " include the buffer
+    " It shouldn't happen that the list of buffers is not defined but if it
+    " does, play it safe and include the buffer.
     if !exists('t:bufexp_buf_list')
         return 1
     endif
@@ -245,27 +243,25 @@ function! s:IsInCurrentTab(bufnr)
 endfunction
 
 " UpdateTabBufData {{{2
-" Update the tab buffer data for the specified buffer
+" Update the tab buffer data for the specified buffer.
 "
-" The current tab's list is updated. If a buffer is only
-" allowed to be associated with one tab, it is removed
-" from the lists of any other tabs with which it may have
-" been associated.
+" The current tab's list is updated. If a buffer is only allowed to be
+" associated with one tab, it is removed  from the lists of any other tabs
+" with which it may have been associated.
 "
-" The associations between tabs and buffers are maintained
-" in separate lists for each tab, which are stored in tab-
-" specific variables 't:bufexp_buf_list'.
+" The associations between tabs and buffers are maintained in separate lists
+" for each tab, which are stored in tab-specific variables
+" 't:bufexp_buf_list'.
 function! s:UpdateTabBufData(bufnr)
-    " The first time we add a tab, Vim uses the current buffer
-    " as its starting page even though we are about to edit a
-    " new page, and another BufEnter for the new page is triggered
-    " later. Use this first BufEnter to initialize the list of
-    " buffers, but don't add the buffer number to the list if
-    " it is already associated with another tab
+    " The first time we add a tab, Vim uses the current buffer as its starting
+    " page even though we are about to edit a new page, and another BufEnter
+    " for the new page is triggered later. Use this first BufEnter to
+    " initialize the list of buffers, but don't add the buffer number to the
+    " list if it is already associated with another tab.
     "
-    " Unfortunately, this doesn't work right when the first
-    " buffer opened in the tab should be associated with it,
-    " such as when 'tab split +buffer N' is used
+    " Unfortunately, this doesn't work right when the first buffer opened in
+    " the tab should be associated with it, such as when 'tab split +buffer N'
+    " is used.
     if !exists("t:bufexp_buf_list")
         let t:bufexp_buf_list = []
 
@@ -686,8 +682,8 @@ function! s:GetBufferInfo(bufnr)
     redir END
 
     if a:bufnr > 0
-        " Since we are only interested in this specified buffer
-        " remove the other buffers listed
+        " Since we are only interested in this specified buffer remove the
+        " other buffers listed.
         let bufoutput = substitute(bufoutput."\n", '^.*\n\(\s*'.a:bufnr.'\>.\{-}\)\n.*', '\1', '')
     endif
 
@@ -712,7 +708,7 @@ function! s:GetBufferInfo(bufnr)
             let name = "[No Name]"
         endif
 
-        " Filter out term:// buffers if g:bufExplorerShowTerminal is 0
+        " Filter out term:// buffers if g:bufExplorerShowTerminal is 0.
         if !g:bufExplorerShowTerminal && name =~ '^term://'
             continue
         endif
@@ -758,7 +754,7 @@ function! s:BuildBufferList()
             continue
         endif
 
-        " Skip "No Name" buffers if we are not to show them.
+        " Skip 'No Name' buffers if we are not to show them.
         if g:bufExplorerShowNoName == 0 && buf.hasNoName
             continue
         endif
@@ -855,7 +851,7 @@ function! s:SelectBuffer(...)
             execute g:bufExplorerChgWin."wincmd w"
             execute "keepjumps keepalt silent b!" _bufNbr
 
-            " Are we supposed to open the selected buffer in a tab?
+        " Are we supposed to open the selected buffer in a tab?
         elseif (a:0 == 1) && (a:1 == "tab")
             call s:Close()
 
@@ -869,7 +865,7 @@ function! s:SelectBuffer(...)
 
             " Workaround for the issue mentioned in UpdateTabBufData.
             call s:UpdateTabBufData(_bufNbr)
-            " Are we supposed to open the selected buffer in a split?
+        " Are we supposed to open the selected buffer in a split?
         elseif (a:0 == 2) && (a:1 == "split")
             call s:Close()
             if (a:2 == "vl")
@@ -937,7 +933,7 @@ function! s:RemoveBuffer(mode)
     let _bufNbr = str2nr(getline('.'))
 
     if getbufvar(_bufNbr, '&modified') == 1
-        " Calling confirm() requires Vim built with dialog option
+        " Calling confirm() requires Vim built with dialog option.
         if !has("dialog_con") && !has("dialog_gui")
             call s:Error("Sorry, no write since last change for buffer "._bufNbr.", unable to delete")
             return
@@ -993,15 +989,15 @@ function! s:DeleteBuffer(buf, mode)
 endfunction
 
 " ListedAndCurrentTab {{{2
-" Returns whether the specified buffer is both listed and associated
-" with the current tab
+" Returns whether the specified buffer is both listed and associated with the
+" current tab.
 function! s:ListedAndCurrentTab(buf)
     return buflisted(a:buf) && s:IsInCurrentTab(a:buf)
 endfunction
 
 " Close {{{2
 function! s:Close()
-    " Get only the listed buffers associated with the current tab
+    " Get only the listed buffers associated with the current tab.
     let listed = filter(copy(s:MRUList), "s:ListedAndCurrentTab(v:val)")
     if len(listed) == 0
         let listed = filter(range(1, bufnr('$')), "s:ListedAndCurrentTab(v:val)")