@@ -678,6 +678,9 @@ const save = "\x1b7";
678
678
const restore = "\x1b 8" ;
679
679
const finish_sync = "\x1b [?2026l" ;
680
680
681
+ const progress_remove = "\x1b ]9;4;0\x07 " ;
682
+ const progress_pulsing = "\x1b ]9;4;3\x07 " ;
683
+
681
684
const TreeSymbol = enum {
682
685
/// ├─
683
686
tee ,
@@ -760,7 +763,7 @@ fn clearWrittenWithEscapeCodes() anyerror!void {
760
763
if (noop_impl or ! global_progress .need_clear ) return ;
761
764
762
765
global_progress .need_clear = false ;
763
- try write (clear );
766
+ try write (clear ++ progress_remove );
764
767
}
765
768
766
769
/// U+25BA or ►
@@ -1203,6 +1206,20 @@ fn computeRedraw(serialized_buffer: *Serialized.Buffer) struct { []u8, usize } {
1203
1206
i , const nl_n = computeNode (buf , i , 0 , serialized , children , root_node_index );
1204
1207
1205
1208
if (global_progress .terminal_mode == .ansi_escape_codes ) {
1209
+ {
1210
+ // Set progress state https://conemu.github.io/en/AnsiEscapeCodes.html#ConEmu_specific_OSC
1211
+ const storage = & serialized .storage [@intFromEnum (root_node_index )];
1212
+ const estimated_total = storage .estimated_total_count ;
1213
+ const completed_items = storage .completed_count ;
1214
+ if (estimated_total == 0 ) {
1215
+ buf [i .. ][0.. progress_pulsing .len ].* = progress_pulsing .* ;
1216
+ i += progress_pulsing .len ;
1217
+ } else {
1218
+ const percent = completed_items * 100 / estimated_total ;
1219
+ i += (std .fmt .bufPrint (buf [i .. ], "\x1b ]9;4;1;{d}\x07 " , .{percent }) catch &.{}).len ;
1220
+ }
1221
+ }
1222
+
1206
1223
if (nl_n > 0 ) {
1207
1224
buf [i ] = '\r ' ;
1208
1225
i += 1 ;
0 commit comments