@@ -695,4 +695,45 @@ describe("virt_text", function()
695
695
{ " e" , { " @ibl.whitespace.char.3" , " @ibl.scope.underline.2" } },
696
696
})
697
697
end )
698
+
699
+ it (" renders lead and multi lead spaces correctly" , function ()
700
+ local config = conf .set_config ()
701
+ highlights .setup ()
702
+ local char_map = {
703
+ [TAB_START ] = " a" ,
704
+ [TAB_START_SINGLE ] = " b" ,
705
+ [TAB_FILL ] = " c" ,
706
+ [TAB_END ] = " d" ,
707
+ [SPACE ] = { " e" , " f" , " g" },
708
+ [INDENT ] = " h" ,
709
+ }
710
+ local whitespace_tbl = { INDENT , SPACE , SPACE , SPACE , INDENT , SPACE , SPACE , SPACE }
711
+ local scope_active = false
712
+ local scope_index = - 1
713
+ local scope_start = false
714
+ local scope_end = false
715
+ local scope_col_start_single = 0
716
+
717
+ local virt_text = vt .get (
718
+ config ,
719
+ char_map ,
720
+ whitespace_tbl ,
721
+ scope_active ,
722
+ scope_index ,
723
+ scope_start ,
724
+ scope_end ,
725
+ scope_col_start_single
726
+ )
727
+
728
+ assert .are .same (virt_text , {
729
+ { " h" , { " @ibl.whitespace.char.1" , " @ibl.indent.char.1" } },
730
+ { " f" , { " @ibl.whitespace.char.1" } },
731
+ { " g" , { " @ibl.whitespace.char.1" } },
732
+ { " e" , { " @ibl.whitespace.char.1" } },
733
+ { " h" , { " @ibl.whitespace.char.1" , " @ibl.indent.char.1" } },
734
+ { " g" , { " @ibl.whitespace.char.1" } },
735
+ { " e" , { " @ibl.whitespace.char.1" } },
736
+ { " f" , { " @ibl.whitespace.char.1" } },
737
+ })
738
+ end )
698
739
end )
0 commit comments