Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[clipboard-] speed up setcol-clipboard and make it async #2372

Merged
merged 2 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions visidata/clipboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ def setColClipboard(sheet):
if not vd.memory.clipcells:
vd.warning("nothing to paste from clipcells")
return
for r, v in zip(sheet.onlySelectedRows, itertools.cycle(vd.memory.clipcells or [None])):
sheet.cursorCol.setValuesTyped([r], v)
sheet.cursorCol.setValuesTyped(sheet.onlySelectedRows, *vd.memory.clipcells)

@Sheet.api
def syscopyCells(sheet, cols, rows, filetype=None):
Expand Down
1 change: 1 addition & 0 deletions visidata/column.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,7 @@ def setValues(self, rows, *values):
self.recalc()
return vd.status('set %d cells to %d values' % (len(rows), len(values)))

@asyncthread
def setValuesTyped(self, rows, *values):
'Set values on this column for *rows* to *values*, coerced to column type, recycling values as needed to fill *rows*. Abort on type exception.'
vd.addUndoSetValues([self], rows)
Expand Down