Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion core/help/help.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ def gui_operators(gui: imgui.GUI):

def format_context_title(context_name: str) -> str:
global cached_active_contexts_list
if is_wildcard_context_name(context_name):
return context_name
return "{} [{}]".format(
context_name,
(
Expand Down Expand Up @@ -358,14 +360,31 @@ def gui_context_help(gui: imgui.GUI):
actions.user.help_hide()


def is_wildcard_context_name(context_name: str) -> bool:
return context_name.startswith("*")


def find_commands_corresponding_to_context(context_name: str):
if is_wildcard_context_name(context_name):
# match every context ending with the part of the context name after the *
expected_context_tail = context_name[1:]
commands = []
for context in context_command_map:
if context.endswith(expected_context_tail):
commands.extend(context_command_map[context].items())
else:
commands = context_command_map[context_name].items()
return commands


def draw_context_commands(gui: imgui.GUI):
global selected_context
global total_page_count
global selected_context_page

context_title = format_context_title(selected_context)
title = f"Context: {context_title}"
commands = context_command_map[selected_context].items()
commands = find_commands_corresponding_to_context(selected_context)
item_line_counts = [get_command_line_count(command) for command in commands]
pages = get_pages(item_line_counts)
total_page_count = max(pages, default=1)
Expand Down Expand Up @@ -779,6 +798,10 @@ def help_selected_context(m: str):
register_events(True)
ctx.tags = ["user.help_open"]

def help_dictation():
"""Display primary dictation mode commands"""
actions.user.help_selected_context(("*.dictation_mode.talon"))

def help_next():
"""Navigates to next page"""
global current_context_page
Expand Down
5 changes: 5 additions & 0 deletions core/help/help_dictation.talon
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
mode: command
mode: dictation
-
^help dictation$: user.help_dictation()
^help active$: user.help_context_enabled()
2 changes: 2 additions & 0 deletions core/help/help_open.talon
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
tag: user.help_open
mode: command
mode: dictation
-
help next$: user.help_next()
help (previous | last)$: user.help_previous()
Expand Down