@@ -60,10 +60,12 @@ void ffPercentAppendBar(FFstrbuf* buffer, double percent, FFPercentageModuleConf
6060
6161 const FFOptionsDisplay * options = & instance .config .display ;
6262
63+ const bool borderAsValue = options -> barBorderLeftElapsed .length && options -> barBorderRightElapsed .length ;
64+
6365 uint32_t blocksPercent = (uint32_t ) (percent / 100.0 * options -> barWidth + 0.5 );
6466 assert (blocksPercent <= options -> barWidth );
6567
66- if (options -> barBorderLeft .length )
68+ if (! borderAsValue && options -> barBorderLeft .length )
6769 {
6870 if (!options -> pipe )
6971 ffStrbufAppendS (buffer , "\e[" FF_COLOR_FG_LIGHT_WHITE "m" );
@@ -76,7 +78,11 @@ void ffPercentAppendBar(FFstrbuf* buffer, double percent, FFPercentageModuleConf
7678 ffStrbufAppendS (buffer , "\e[" FF_COLOR_FG_LIGHT_BLACK "m" );
7779
7880 for (uint32_t i = 0 ; i < options -> barWidth ; ++ i )
79- ffStrbufAppend (buffer , & options -> barCharElapsed );
81+ ffStrbufAppend (buffer , borderAsValue && i == 0
82+ ? & options -> barBorderLeft
83+ : borderAsValue && i == options -> barWidth - 1
84+ ? & options -> barBorderRight
85+ : & options -> barCharTotal );
8086 }
8187 else
8288 {
@@ -120,19 +126,27 @@ void ffPercentAppendBar(FFstrbuf* buffer, double percent, FFPercentageModuleConf
120126 ffStrbufAppendF (buffer , "\e[%sm" , (green <= yellow ? colorGreen : colorRed ));
121127 }
122128 }
123- ffStrbufAppend (buffer , & options -> barCharElapsed );
129+ ffStrbufAppend (buffer , borderAsValue && i == 0
130+ ? & options -> barBorderLeftElapsed
131+ : borderAsValue && i == options -> barWidth - 1
132+ ? & options -> barBorderRightElapsed
133+ : & options -> barCharElapsed );
124134 }
125135
126136 if (blocksPercent < options -> barWidth )
127137 {
128138 if (!options -> pipe )
129139 ffStrbufAppendS (buffer , "\e[" FF_COLOR_FG_LIGHT_WHITE "m" );
130140 for (uint32_t i = blocksPercent ; i < options -> barWidth ; ++ i )
131- ffStrbufAppend (buffer , & options -> barCharTotal );
141+ ffStrbufAppend (buffer , borderAsValue && i == 0
142+ ? & options -> barBorderLeft
143+ : borderAsValue && i == options -> barWidth - 1
144+ ? & options -> barBorderRight
145+ : & options -> barCharTotal );
132146 }
133147 }
134148
135- if (options -> barBorderRight .length )
149+ if (! borderAsValue && options -> barBorderRight .length )
136150 {
137151 if (!options -> pipe )
138152 ffStrbufAppendS (buffer , "\e[" FF_COLOR_FG_LIGHT_WHITE "m" );
0 commit comments