@@ -6,6 +6,7 @@ local ViewConfig = require("lazy.view.config")
6
6
--- @field file ? string
7
7
--- @field margin ? { top ?: number , right ?: number , bottom ?: number , left ?: number }
8
8
--- @field win_opts LazyViewWinOpts
9
+ --- @field size ? { width : number , height : number }
9
10
local defaults = {
10
11
win_opts = {},
11
12
}
32
33
--- @param opts ? LazyViewOptions
33
34
function M :init (opts )
34
35
self .opts = vim .tbl_deep_extend (" force" , defaults , opts or {})
36
+ self .opts .size = vim .tbl_extend (" keep" , self .opts .size or {}, Config .options .ui .size )
35
37
self :mount ()
36
38
self :on_key (ViewConfig .keys .close , self .close )
37
39
self :on ({ " BufDelete" , " BufLeave" , " BufHidden" }, self .close , { once = true })
@@ -42,8 +44,8 @@ function M:layout()
42
44
local function size (max , value )
43
45
return value > 1 and math.min (value , max ) or math.floor (max * value )
44
46
end
45
- self .opts .win_opts .width = size (vim .o .columns , Config . options . ui .size .width )
46
- self .opts .win_opts .height = size (vim .o .lines , Config . options . ui .size .height )
47
+ self .opts .win_opts .width = size (vim .o .columns , self . opts .size .width )
48
+ self .opts .win_opts .height = size (vim .o .lines , self . opts .size .height )
47
49
self .opts .win_opts .row = math.floor ((vim .o .lines - self .opts .win_opts .height ) / 2 )
48
50
self .opts .win_opts .col = math.floor ((vim .o .columns - self .opts .win_opts .width ) / 2 )
49
51
0 commit comments