diff --git a/visidata/help.py b/visidata/help.py index 469c635ce..2c8e1a46c 100644 --- a/visidata/help.py +++ b/visidata/help.py @@ -8,7 +8,7 @@ @BaseSheet.api def hint_basichelp(sheet): - return 0, '`Alt+[:underline]H[/]` to open the [:underline]H[/]elp menu' + return 0, 'Alt+H to open the [:underline]H[/]elp menu' @VisiData.api diff --git a/visidata/hint.py b/visidata/hint.py index e1efcf18b..b276f0a1b 100644 --- a/visidata/hint.py +++ b/visidata/hint.py @@ -26,8 +26,8 @@ def getHint(sheet, *args, **kwargs) -> str: n = 1 v = r + results.append((n, v)) if v not in sheet.prevHints: - results.append((n, v)) sheet.prevHints[v] += 1 except Exception as e: vd.debug(f'{f.__name__}: {e}') @@ -35,5 +35,6 @@ def getHint(sheet, *args, **kwargs) -> str: if results: return sorted(results, reverse=True)[0][1] + return '' vd.addCommand('', 'help-hint', 'status(getHint() or pressMenu("Help"))', 'get context-dependent hint on what to do next') diff --git a/visidata/menu.py b/visidata/menu.py index 544be4ccd..8e2b6d51f 100644 --- a/visidata/menu.py +++ b/visidata/menu.py @@ -1,5 +1,6 @@ import string import textwrap +import time import curses from typing import List, Union @@ -17,11 +18,21 @@ vd.theme_option('disp_menu_more', '»', 'command submenu indicator') vd.theme_option('disp_menu_push', '⎘', 'indicator if command pushes sheet onto sheet stack') vd.theme_option('disp_menu_input', '…', 'indicator if input required for command') -vd.option('disp_menu_fmt', '| VisiData {vd.version} | Alt+H for help menu', 'right-side menu format string') +vd.option('disp_menu_fmt', '| VisiData {vd.version} | {vd.hintStatus}', 'right-side menu format string') BaseSheet.init('activeMenuItems', list) vd.menuRunning = False +@VisiData.property +def hintStatus(vd): + if vd.options.disp_expert <= 0: + if int(time.time()/60) % 2 == 0: + return 'Alt+H for help menu' + else: + return 'Ctrl+G to cycle help sidebar' + + return vd.sheet.getHint() + def menudraw(*args): return clipdraw(*args, truncator='')