@@ -17,6 +17,7 @@ local STATUSCOLUMN_WRAPPER_PATTERN = '^%%!v:lua%.require%("scrollbar%.renderer"%
1717--- @field applied_numberwidth integer
1818--- @field span integer
1919--- @field base_textoff integer
20+ --- @field position ScrollbarGutterPosition
2021--- @field limited boolean
2122--- @field failed boolean
2223
178179
179180--- @param source_win integer
180181--- @param span integer
182+ --- @param position ScrollbarGutterPosition
181183--- @return ScrollbarStatuscolumnReservation ?
182- local function ensure_statuscolumn (source_win , span )
184+ local function ensure_statuscolumn (source_win , span , position )
183185 restore_inherited_statuscolumn (source_win )
184186 if span <= 0 then
185187 release_statuscolumn (source_win )
@@ -194,6 +196,7 @@ local function ensure_statuscolumn(source_win, span)
194196 if
195197 current_statuscolumn ~= reservation .applied_statuscolumn
196198 or current_numberwidth ~= reservation .applied_numberwidth
199+ or reservation .position ~= position
197200 then
198201 release_statuscolumn (source_win )
199202 reservation = nil
@@ -224,6 +227,7 @@ local function ensure_statuscolumn(source_win, span)
224227 applied_numberwidth = original_numberwidth + span ,
225228 span = span ,
226229 base_textoff = vim .fn .getwininfo (source_win )[1 ].textoff ,
230+ position = position ,
227231 limited = false ,
228232 failed = false ,
229233 }
@@ -317,7 +321,8 @@ M._statuscolumn = function(owner_win)
317321 value = type (evaluated ) == " string" and evaluated or vim .fn .string (evaluated )
318322 end
319323 if drawn_win == owner_win then
320- value = value .. string.rep (" " , reservation .span )
324+ local gap = string.rep (" " , reservation .span )
325+ value = reservation .position == " outer" and gap .. value or value .. gap
321326 end
322327 return value
323328end
@@ -540,7 +545,10 @@ local function float_config(active_config, source_win, area, container_width, wi
540545 local placement = active_config .float .placement
541546 local north = placement .anchor == " NW" or placement .anchor == " NE"
542547 local west = placement .anchor == " NW" or placement .anchor == " SW"
543- local west_origin = reserves_statuscolumn (active_config ) and reservation_base_textoff (source_win ) or 0
548+ local west_origin = 0
549+ if reserves_statuscolumn (active_config ) and placement .gutter_position == " inner" then
550+ west_origin = reservation_base_textoff (source_win )
551+ end
544552 local vertical_anchor
545553 if placement .relative == " window" then
546554 vertical_anchor = north and 0 or area .height
@@ -1020,7 +1028,10 @@ local function render_source(source_win, selection, root_config)
10201028 if reserved then
10211029 local initial_width = existing_state and existing_state .width or active_config .layout .width
10221030 local initial_span = math.max (0 , initial_width + active_config .float .placement .col )
1023- if initial_span > 0 and ensure_statuscolumn (source_win , initial_span ) == nil then
1031+ if
1032+ initial_span > 0
1033+ and ensure_statuscolumn (source_win , initial_span , active_config .float .placement .gutter_position ) == nil
1034+ then
10241035 close_source (source_win )
10251036 return nil
10261037 end
@@ -1096,7 +1107,7 @@ local function render_source(source_win, selection, root_config)
10961107 if span == (current and current .span or 0 ) then
10971108 break
10981109 end
1099- if span > 0 and ensure_statuscolumn (source_win , span ) == nil then
1110+ if span > 0 and ensure_statuscolumn (source_win , span , active_config . float . placement . gutter_position ) == nil then
11001111 close_source (source_win )
11011112 return nil
11021113 end
@@ -1124,7 +1135,11 @@ local function render_source(source_win, selection, root_config)
11241135 if state ~= nil then
11251136 close_state (state )
11261137 if reserved then
1127- ensure_statuscolumn (source_win , math.max (0 , output .width + active_config .float .placement .col ))
1138+ ensure_statuscolumn (
1139+ source_win ,
1140+ math.max (0 , output .width + active_config .float .placement .col ),
1141+ active_config .float .placement .gutter_position
1142+ )
11281143 end
11291144 end
11301145 local active_float_config =
0 commit comments