From 0fae62fabb863120faee3e622368be28bb177d90 Mon Sep 17 00:00:00 2001 From: midichef <67946319+midichef@users.noreply.github.com> Date: Fri, 29 Nov 2024 02:17:06 -0800 Subject: [PATCH] [sheets-] fix error adding col to sheet with no visible cols --- visidata/sheets.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/visidata/sheets.py b/visidata/sheets.py index 782f68bf5..daa9fe351 100644 --- a/visidata/sheets.py +++ b/visidata/sheets.py @@ -576,7 +576,10 @@ def addColumnAtCursor(self, *cols): index = 0 ccol = self.cursorCol if ccol and not ccol.keycol: - index = self.columns.index(ccol)+1 + try: + index = self.columns.index(ccol)+1 + except ValueError: # when all columns are hidden, the one column shown is not in self.columns + index = 0 self.addColumn(*cols, index=index) firstnewcol = [c for c in cols if not c.hidden][0]