Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help screen tweaks #53

Merged
merged 7 commits into from
Jan 8, 2025
Merged
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
11 changes: 11 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Braindrop ChangeLog

## Unreleased

**Released: WiP**

- Updated the help screen so that the command table shows the command name
first. ([#53](https://github.com/davep/braindrop/pull/53))
- Updated the help screen so that the commands are sorted by the command
name. ([#53](https://github.com/davep/braindrop/pull/53))
- Various cosmetic tweaks to the help screen.
([#53](https://github.com/davep/braindrop/pull/53))

## v0.3.0

**Released: 2025-01-08**
Expand Down
19 changes: 14 additions & 5 deletions src/braindrop/app/screens/help.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,21 @@ class HelpScreen(ModalScreen[None]):
border: solid $border;
}

Markdown {
Markdown, MarkdownTable {
padding: 0 1 0 1;
background: $panel;
}

MarkdownH1 {
padding: 1 0 1 0;
background: $foreground 10%;
}

VerticalScroll {
scrollbar-gutter: stable;
scrollbar-background: $panel;
scrollbar-background-hover: $panel;
scrollbar-background-active: $panel;
}

Center {
Expand All @@ -87,7 +96,7 @@ class HelpScreen(ModalScreen[None]):
}
"""

BINDINGS = [("escape", "close")]
BINDINGS = [("escape, f1", "close")]

def __init__(self, help_for: Screen[Any]) -> None:
"""Initialise the help screen.
Expand Down Expand Up @@ -129,9 +138,9 @@ def command_help(self, node: DOMNode) -> str:
"""
if (commands := getattr(node, "COMMAND_MESSAGES", None)) is None:
return ""
keys = "| Key | Command | Description |\n| - | - | - |\n"
for command in commands:
keys += f"| {self._all_keys(command)} | {command.command()} | {command.tooltip()} |\n"
keys = "| Command | Key | Description |\n| - | - | - |\n"
for command in sorted(commands, key=lambda command: command.command()):
keys += f"| {command.command()} | {self._all_keys(command)} | {command.tooltip()} |\n"
return f"\n\n{keys}"

def compose(self) -> ComposeResult:
Expand Down
Loading