Skip to content

Commit

Permalink
ref: local mlocal Groups
Browse files Browse the repository at this point in the history
Also creates a clear naming distinction between `group_clumps` and
`groups`.
  • Loading branch information
Iron-E committed Apr 10, 2023
1 parent cdfa74f commit 49897ea
Show file tree
Hide file tree
Showing 11 changed files with 323 additions and 326 deletions.
6 changes: 3 additions & 3 deletions autoload/bufferline.vim
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ endfunc
"========================

function! bufferline#update(...)
call luaeval("require'barbar.render'.update(_A)", get(a:, 1, v:null))
call luaeval("require'barbar.ui.render'.update(_A)", get(a:, 1, v:null))
endfu

function! bufferline#update_async(...)
call timer_start(get(a:, 2, 1), {-> luaeval("require'barbar.render'.update(_A)", get(a:, 1, v:null))})
call timer_start(get(a:, 2, 1), {-> luaeval("require'barbar.ui.render'.update(_A)", get(a:, 1, v:null))})
endfu

function! bufferline#render(update_names) abort
Expand Down Expand Up @@ -43,7 +43,7 @@ function! bufferline#order_by_window_number()
endfunc

function! bufferline#close(abuf)
call luaeval("require'barbar.render'.close_buffer_animated(_A)", a:abuf)
call luaeval("require'barbar.ui.render'.close_buffer_animated(_A)", a:abuf)
endfunc

function! bufferline#close_direct(abuf)
Expand Down
2 changes: 1 addition & 1 deletion lua/barbar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ local api = require'barbar.api'
local bbye = require'barbar.bbye'
local events = require'barbar.events'
local notify = require'barbar.utils'.notify
local render = require'barbar.render'
local render = require'barbar.ui.render'
local state = require'barbar.state'
local utils = require'barbar.utils'

Expand Down
4 changes: 2 additions & 2 deletions lua/barbar/api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ local bbye = require'barbar.bbye'
local Buffer = require'barbar.buffer'
local config = require'barbar.config'
local JumpMode = require'barbar.jump_mode'
local Layout = require'barbar.layout'
local render = require'barbar.render'
local Layout = require'barbar.ui.layout'
local render = require'barbar.ui.render'
local state = require'barbar.state'
local utils = require'barbar.utils'

Expand Down
4 changes: 2 additions & 2 deletions lua/barbar/events.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ local bbye = require'barbar.bbye'
local config = require'barbar.config'
local highlight = require'barbar.highlight'
local JumpMode = require'barbar.jump_mode'
local render = require'barbar.render'
local render = require'barbar.ui.render'
local state = require'barbar.state'
local utils = require'barbar.utils'

Expand All @@ -48,7 +48,7 @@ function events.augroups(clear)
end

return create_augroup('barbar_misc', {clear = clear}),
create_augroup('barbar_render', {clear = clear})
create_augroup('barbar.ui.render', {clear = clear})
end

--- What to do when clicking a buffer close button
Expand Down
207 changes: 0 additions & 207 deletions lua/barbar/groups.lua

This file was deleted.

20 changes: 10 additions & 10 deletions lua/barbar/layout.lua → lua/barbar/ui/layout.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@ local SLASH_LEN = #'/'
--- The length of one space (`#' '`)
local SPACE_LEN = #' '

--- @class barbar.layout.data
--- @class barbar.ui.layout.data
--- @field total_width integer the total width of the tabline, equals to &columns
--- @field left barbar.layout.data.side left offset data
--- @field right barbar.layout.data.side right offset data
--- @field buffers barbar.layout.data.buffers buffer data
--- @field tabpages barbar.layout.data.tabpages tabpage data
--- @field left barbar.ui.layout.data.side left offset data
--- @field right barbar.ui.layout.data.side right offset data
--- @field buffers barbar.ui.layout.data.buffers buffer data
--- @field tabpages barbar.ui.layout.data.tabpages tabpage data

--- @class barbar.layout.data.side
--- @class barbar.ui.layout.data.side
--- @field width integer the amount of space allocated

--- @class barbar.layout.data.buffers
--- @class barbar.ui.layout.data.buffers
--- @field width integer the amount of space allocated to the buffers
--- @field pinned_width integer the amount of space used by pinned buffers
--- @field unpinned_width integer the amount of space used by pinned buffers
Expand All @@ -46,16 +46,16 @@ local SPACE_LEN = #' '
--- @field base_widths integer[] the minimum amount of space taken up by each buffer
--- @field scroll_max integer the maximum position which can be scrolled to

--- @class barbar.layout.data.tabpages
--- @class barbar.ui.layout.data.tabpages
--- @field width integer the amount of space allocated to the tabpage indicator


--- @class barbar.Layout
--- @class barbar.ui.layout
--- @field buffers integer[] different from `state.buffers` in that the `hide` option is respected. Only updated when calling `calculate_buffers_width`.
local Layout = { buffers = {} }

--- Calculate the current layout of the bufferline.
--- @return barbar.layout.data
--- @return barbar.ui.layout.data
function Layout.calculate()

local total_width = get_option('columns')
Expand Down
Loading

0 comments on commit 49897ea

Please sign in to comment.