@@ -123,12 +123,6 @@ function M.open_float(name, element, position, settings)
123123 float_windows [name ]:jump_to ()
124124 return float_windows [name ]
125125 end
126- if settings .position == " center" then
127- local screen_w = vim .opt .columns :get ()
128- local screen_h = vim .opt .lines :get () - vim .opt .cmdheight :get ()
129- position .line = (screen_h - settings .height ) / 2
130- position .col = (screen_w - settings .width ) / 2
131- end
132126 local buf = element .buffer ()
133127 local float_win = require (" dapui.windows.float" ).open_float ({
134128 height = settings .height or 1 ,
@@ -156,10 +150,17 @@ function M.open_float(name, element, position, settings)
156150 end
157151 end
158152
153+ if settings .position == " center" then
154+ local screen_w = vim .opt .columns :get ()
155+ local screen_h = vim .opt .lines :get () - vim .opt .cmdheight :get ()
156+ position .line = (screen_h - height ) / 2
157+ position .col = (screen_w - width ) / 2
158+ end
159+
159160 if width <= 0 or height <= 0 then
160161 return
161162 end
162- float_win :resize (width , height )
163+ float_win :resize (width , height , position )
163164 end
164165
165166 nio .api .nvim_buf_attach (buf , true , {
0 commit comments