Skip to content

Commit

Permalink
[sheets-] fix error adding col to sheet with no visible cols
Browse files Browse the repository at this point in the history
  • Loading branch information
midichef authored and anjakefala committed Dec 2, 2024
1 parent c72f696 commit 0fae62f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion visidata/sheets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 0fae62f

Please sign in to comment.