Skip to content

Commit

Permalink
feat(api): get_dropbar() accepts empty buffer number
Browse files Browse the repository at this point in the history
  • Loading branch information
bekaboo committed Jul 3, 2023
1 parent 24106ff commit 9a94a22
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1116,7 +1116,7 @@ each sources.
`dropbar.nvim` exposes a few functions in `lua/dropbar/api.lua` that can be
used to interact with the winbar or the drop-down menu:

- `get_dropbar(buf: integer, win: integer): dropbar_t?`
- `get_dropbar(buf: integer?, win: integer): dropbar_t?`
- Get the dropbar associated with the given buffer and window
- For more information about the `dropbar_t` type, see
[`dropbar_t`](#dropbar_t)
Expand Down
3 changes: 2 additions & 1 deletion doc/dropbar.txt
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,8 @@ api.get_dropbar({buf}, {win}) *dropbar-api-get_dropbar()*
|dropbar-developers-classes-dropbar_t|

Parameters: ~
{buf} (integer): The buffer number
{buf} (integer?): The buffer number, if nil the buffer associated
with the window {win} be used
{win} (integer): The window number

Returns: ~
Expand Down
3 changes: 2 additions & 1 deletion lua/dropbar/api.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
---Get the dropbar
---@param buf integer
---@param buf? integer
---@param win integer
---@return dropbar_t?
local function get_dropbar(buf, win)
buf = buf or vim.api.nvim_win_get_buf(win)
if rawget(_G.dropbar.bars, buf) then
return rawget(_G.dropbar.bars[buf], win)
end
Expand Down

0 comments on commit 9a94a22

Please sign in to comment.