Skip to content

Commit 8cde857

Browse files
committed
[macro] record all commands; add status indicator #2435
add even commands nonloggable commands to the current macro when recording.
1 parent 2515b9b commit 8cde857

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

visidata/cmdlog.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
vd.option('replay_wait', 0.0, 'time to wait between replayed commands, in seconds', sheettype=None)
88
vd.theme_option('disp_replay_play', '▶', 'status indicator for active replay')
9+
vd.theme_option('disp_replay_record', '⏺', 'status indicator for macro record')
910
vd.theme_option('color_status_replay', 'green', 'color of replay status indicator')
1011

1112
# prefixes which should not be logged
@@ -384,8 +385,12 @@ def setLastArgs(vd, args):
384385

385386
@VisiData.property
386387
def replayStatus(vd):
388+
if vd.macroMode:
389+
return f'|[:error] {len(vd.macroMode)} {vd.options.disp_replay_record} [:]'
390+
387391
if vd._nextCommands:
388-
return f' | [:status_replay] {len(vd._nextCommands)} {vd.options.disp_replay_play}[:]'
392+
return f'|[:status_replay] {len(vd._nextCommands)} {vd.options.disp_replay_play} [:]'
393+
389394
return ''
390395

391396

visidata/macros.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,11 @@ def saveMacro(self, rows, ks):
102102
def afterExecSheet(cmdlog, sheet, escaped, err):
103103
if not vd.macroMode: return
104104
if not vd.activeCommand: return
105-
if vd.isLoggableCommand(vd.activeCommand):
106-
cmd = copy(vd.activeCommand)
107-
cmd.sheet = ''
108-
vd.macroMode.addRow(cmd)
105+
if vd.activeCommand.longname == 'macro-record': return
106+
107+
cmd = copy(vd.activeCommand)
108+
cmd.sheet = ''
109+
vd.macroMode.addRow(cmd)
109110

110111

111112
@CommandLogJsonl.api

0 commit comments

Comments
 (0)