Skip to content

Commit

Permalink
Merge pull request #2503 from midichef/inputmultiple_redo
Browse files Browse the repository at this point in the history
[input-] keep inputMultiple() input during redo
  • Loading branch information
anjakefala authored Sep 25, 2024
2 parents c1c5523 + 8cb1b60 commit e337610
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions visidata/_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,17 +415,22 @@ def inputMultiple(vd, updater=lambda val: None, record=True, **kwargs):

previnput = vd.getCommandInput()
if previnput is not None:
ret = None
if isinstance(previnput, str):
if previnput.startswith('{'):
return json.loads(previnput)
ret = json.loads(previnput)
else:
ret = {k:v.get('value', '') for k,v in kwargs.items()}
primekey = list(ret.keys())[0]
ret[primekey] = previnput
return ret

if isinstance(previnput, dict):
return previnput
ret = previnput

if ret:
if record and vd.cmdlog:
vd.setLastArgs(ret)
return ret

assert False, type(previnput)

Expand Down

0 comments on commit e337610

Please sign in to comment.