@@ -426,31 +426,29 @@ local prepare_node = function(item, state)
426426 local should_pad = false
427427
428428 for _ , component in ipairs (renderer ) do
429- if component .enabled == false then
430- goto continue
431- end
432- local component_data , component_wanted_width =
433- M .render_component (component , item , state , remaining_cols - (should_pad and 1 or 0 ))
434- local actual_width = 0
435- if component_data then
436- for _ , data in ipairs (component_data ) do
437- if data .text then
438- local padding = " "
439- if should_pad and # data .text and data .text :sub (1 , 1 ) ~= " " and not data .no_padding then
440- padding = " "
441- end
442- data .text = padding .. data .text
443- should_pad = data .text :sub (# data .text ) ~= " " and not data .no_next_padding
429+ if component .enabled then
430+ local component_data , component_wanted_width =
431+ M .render_component (component , item , state , remaining_cols - (should_pad and 1 or 0 ))
432+ local actual_width = 0
433+ if component_data then
434+ for _ , data in ipairs (component_data ) do
435+ if data .text then
436+ local padding = " "
437+ if should_pad and # data .text and data .text :sub (1 , 1 ) ~= " " and not data .no_padding then
438+ padding = " "
439+ end
440+ data .text = padding .. data .text
441+ should_pad = data .text :sub (# data .text ) ~= " " and not data .no_next_padding
444442
445- actual_width = actual_width + vim .api .nvim_strwidth (data .text )
446- line :append (data .text , data .highlight )
447- remaining_cols = remaining_cols - vim .fn .strchars (data .text )
443+ actual_width = actual_width + vim .api .nvim_strwidth (data .text )
444+ line :append (data .text , data .highlight )
445+ remaining_cols = remaining_cols - vim .fn .strchars (data .text )
446+ end
448447 end
449448 end
449+ component_wanted_width = component_wanted_width or actual_width
450+ wanted_width = wanted_width + component_wanted_width
450451 end
451- component_wanted_width = component_wanted_width or actual_width
452- wanted_width = wanted_width + component_wanted_width
453- :: continue::
454452 end
455453
456454 line .wanted_width = wanted_width
0 commit comments