@@ -6,6 +6,22 @@ local utils = require("helpview.utils");
66vimdoc .ns = vim .api .nvim_create_namespace (" helpview/vimdoc" );
77vimdoc .lnum_offsets = {};
88
9+ local function has_decorations (config )
10+ if (config .corner_left ~= nil and config .corner_left ~= " " ) then
11+ return true ;
12+ elseif (config .padding_left ~= nil and config .padding_left ~= " " ) then
13+ return true ;
14+ elseif (config .icon ~= nil and config .icon ~= " " ) then
15+ return true ;
16+ elseif (config .padding_right ~= nil and config .padding_right ~= " " ) then
17+ return true ;
18+ elseif (config .corner_right ~= nil and config .corner_right ~= " " ) then
19+ return true ;
20+ else
21+ return false ;
22+ end
23+ end
24+
925vimdoc .__fix_indent = function (buffer , item , offset )
1026 --- +
1127
@@ -121,7 +137,9 @@ vimdoc.argument = function (buffer, item)
121137 config .corner_right or " "
122138 });
123139
124- vimdoc .__fix_indent (buffer , item , vim .fn .strdisplaywidth (ext ) - 2 );
140+ if has_decorations (config ) then
141+ vimdoc .__fix_indent (buffer , item , vim .fn .strdisplaywidth (ext ) - 2 );
142+ end
125143
126144 if not config .hl then
127145 return ;
@@ -441,7 +459,9 @@ vimdoc.hl = function (buffer, item)
441459 hl_mode = " combine"
442460 });
443461
444- vimdoc .__fix_indent (buffer , item , vim .fn .strdisplaywidth (ext ));
462+ if has_decorations (config ) then
463+ vimdoc .__fix_indent (buffer , item , vim .fn .strdisplaywidth (ext ));
464+ end
445465
446466 vim .api .nvim_buf_set_extmark (buffer , vimdoc .ns , range .row_start , range .col_start , {
447467 undo_restore = false , invalidate = true ,
@@ -634,7 +654,9 @@ vimdoc.keycode = function (buffer, item)
634654 config .corner_right or " "
635655 });
636656
637- vimdoc .__fix_indent (buffer , item , vim .fn .strdisplaywidth (ext ));
657+ if has_decorations (config ) then
658+ vimdoc .__fix_indent (buffer , item , vim .fn .strdisplaywidth (ext ));
659+ end
638660
639661 if not config .hl then
640662 return ;
@@ -843,7 +865,9 @@ vimdoc.optionlink = function (buffer, item)
843865 config .corner_right or " "
844866 });
845867
846- vimdoc .__fix_indent (buffer , item , vim .fn .strdisplaywidth (ext ));
868+ if has_decorations (config ) then
869+ vimdoc .__fix_indent (buffer , item , vim .fn .strdisplaywidth (ext ));
870+ end
847871
848872 if not config .hl then
849873 return ;
@@ -918,7 +942,9 @@ vimdoc.tag = function (buffer, item)
918942 config .corner_right or " "
919943 });
920944
921- vimdoc .__fix_indent (buffer , item , vim .fn .strdisplaywidth (ext ) - 2 );
945+ if has_decorations (config ) then
946+ vimdoc .__fix_indent (buffer , item , vim .fn .strdisplaywidth (ext ) - 2 );
947+ end
922948
923949 if not config .hl then
924950 return ;
@@ -993,7 +1019,9 @@ vimdoc.taglink = function (buffer, item)
9931019 config .corner_right or " "
9941020 });
9951021
996- vimdoc .__fix_indent (buffer , item , vim .fn .strdisplaywidth (ext ) - 2 );
1022+ if has_decorations (config ) then
1023+ vimdoc .__fix_indent (buffer , item , vim .fn .strdisplaywidth (ext ) - 2 );
1024+ end
9971025
9981026 if not config .hl then
9991027 return ;
0 commit comments