Skip to content

Commit d5c082f

Browse files
committed
[resize-] fix resize-col-half for new columns with no rows #2795
1 parent de933c9 commit d5c082f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

visidata/features/layout.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def hide_uniform_cols(sheet):
5757
Sheet.addCommand('gz_', 'resize-cols-input', 'width = int(input("set width= ", value=cursorCol.width)); Fanout(visibleCols).setWidth(width)', 'adjust widths of all visible columns to N')
5858

5959
Sheet.addCommand('-', 'hide-col', 'hide_col(cursorCol)', 'hide the current column')
60-
Sheet.addCommand('z-', 'resize-col-half', 'cursorCol.setWidth(cursorCol.width//2)', 'reduce width of current column by half')
60+
Sheet.addCommand('z-', 'resize-col-half', 'width = cursorCol.width if cursorCol.width is not None else options.default_width; cursorCol.setWidth(width//2)', 'reduce width of current column by half')
6161
Sheet.addCommand('g-', 'hide-uniform-cols', 'sheet.hide_uniform_cols()', 'hide any column that has multiple rows but only one distinct value')
6262

6363
Sheet.addCommand('gv', 'unhide-cols', 'unhide_cols(columns, visibleRows)', 'unhide all hidden columns on current sheet')

0 commit comments

Comments
 (0)