From edfec192e046ea31828529917d8a81ac76de3572 Mon Sep 17 00:00:00 2001 From: midichef <67946319+midichef@users.noreply.github.com> Date: Thu, 24 Aug 2023 16:35:03 -0700 Subject: [PATCH 1/2] [clipboard-] prevent error when deleting row on empty sheet --- visidata/clipboard.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/visidata/clipboard.py b/visidata/clipboard.py index c85b17b67..c94d7dbfe 100644 --- a/visidata/clipboard.py +++ b/visidata/clipboard.py @@ -113,6 +113,8 @@ def pasteFromClipboard(vd, cols, rows): @Sheet.api def delete_row(sheet, rowidx): + if len(sheet.rows) == 0: + vd.fail("no row to delete") if not sheet.defer: oldrow = sheet.rows.pop(rowidx) vd.addUndo(sheet.rows.insert, rowidx, oldrow) From 715041b8e1d208842ab1ba47cee142b4d9f92861 Mon Sep 17 00:00:00 2001 From: midichef <67946319+midichef@users.noreply.github.com> Date: Sat, 26 Aug 2023 14:29:40 -0700 Subject: [PATCH 2/2] handle rows that are empty or None Co-authored-by: AJ Kerrigan --- visidata/clipboard.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/visidata/clipboard.py b/visidata/clipboard.py index c94d7dbfe..649eb0c9d 100644 --- a/visidata/clipboard.py +++ b/visidata/clipboard.py @@ -113,7 +113,7 @@ def pasteFromClipboard(vd, cols, rows): @Sheet.api def delete_row(sheet, rowidx): - if len(sheet.rows) == 0: + if not sheet.rows: vd.fail("no row to delete") if not sheet.defer: oldrow = sheet.rows.pop(rowidx)