diff --git a/visidata/_input.py b/visidata/_input.py index 15dd7ba62..7602d5853 100644 --- a/visidata/_input.py +++ b/visidata/_input.py @@ -388,7 +388,7 @@ def _throw(v, i): for k, v in kwargs.items(): promptlen = clipdraw(sheet._scr, y-v.get('dy'), 0, v.get('prompt'), attr, w=sheet.windowWidth-1) #1947 - promptlen = clipdraw(sheet._scr, y-v.get('dy'), promptlen, v.get('value'), attr, w=sheet.windowWidth-1) + promptlen = clipdraw(sheet._scr, y-v.get('dy'), promptlen, v.get('value', ''), attr, w=sheet.windowWidth-1) try: input_kwargs = kwargs[cur_input_key] diff --git a/visidata/features/layout.py b/visidata/features/layout.py index f4407c1b0..a1bd64b38 100644 --- a/visidata/features/layout.py +++ b/visidata/features/layout.py @@ -30,13 +30,17 @@ def unhide_cols(vd, cols, rows): for c in cols: c.setWidth(abs(c.width or 0) or c.getMaxWidth(rows)) +@VisiData.api +def hide_col(vd, col): + if not col: vd.fail("no columns to hide") + col.hide() Sheet.addCommand('_', 'resize-col-max', 'cursorCol.toggleWidth(cursorCol.getMaxWidth(visibleRows))', 'toggle width of current column between full and default width') Sheet.addCommand('z_', 'resize-col-input', 'width = int(input("set width= ", value=cursorCol.width)); cursorCol.setWidth(width)', 'adjust width of current column to N') Sheet.addCommand('g_', 'resize-cols-max', 'for c in visibleCols: c.setWidth(c.getMaxWidth(visibleRows))', 'toggle widths of all visible columns between full and default width') 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') -Sheet.addCommand('-', 'hide-col', 'cursorCol.hide()', 'Hide current column') +Sheet.addCommand('-', 'hide-col', 'hide_col(cursorCol)', 'Hide current column') Sheet.addCommand('z-', 'resize-col-half', 'cursorCol.setWidth(cursorCol.width//2)', 'reduce width of current column by half') Sheet.addCommand('gv', 'unhide-cols', 'unhide_cols(columns, visibleRows)', 'Show all columns')