Help: Fn+h lists the keys of the screen you're on, and no screen names its keys any more (#69)
CI / build (pull_request) Successful in 7m22s
Site / build (pull_request) Successful in 14s

Fn+h on any screen, text fields included, and ? outside Text Entry, open a
panel over the content area: the screen's own keys, then the ones that work
everywhere. Every App declares its keys for the state it is in (pages,
viewers, dialogs and text fields answer for themselves); the App manager
opens the panel and takes every key while it is open.

About 30 hint lines are gone, from every App. What stays on a screen is
state. The first-start Setup keeps its hints and teaches the key; a device
set up before gets one Toast, once. The guide and the FAQ open with it.
`key help` over the consoles.

476 host tests (8 new). Checked on the device with key help and screenshots:
the Launcher, all nine Apps and several of their states. 8.5 KB of flash and
40 bytes of static RAM. Decisions Q196 to Q203 in docs/milestones/U1.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EhqxQ49eCju4CzKYNjZzwT
This commit is contained in:
2026-10-07 01:29:51 +02:00
co-authored by Claude Opus 5.5
parent 1c6ae0e04f
commit 7fe8b3d22a
62 changed files with 855 additions and 81 deletions
+30 -4
View File
@@ -171,7 +171,7 @@ void GeminiApp::update(uint32_t nowMs) {
else {
std::string mime = result.header.mimeType();
showMessage(url, "# Not a text page\nThis is " + mime +
", which the Cardputer can't show. s saves it to the card, in "
", which the Cardputer can't show. Saving it puts it on the card, in "
"/gemini/downloads.\n");
page_.header.meta = mime; // so s knows to download it
}
@@ -302,6 +302,32 @@ void GeminiApp::selectLink(int direction) {
requestRedraw();
}
void GeminiApp::help(std::vector<KeyHelp>& out) const {
if (certDialog_ || deleteDialog_) return help::dialog(out);
if (inputOpen_) return help::textEntry(out, "send it");
if (addressOpen_) return help::textEntry(out, "go there");
out.push_back({"Tab", "the next link"});
out.push_back({"Aa Tab", "the link before"});
out.push_back({"Enter", "follow the link"});
out.push_back({"` Del", "the page before"});
out.push_back({"; .", "scroll"});
out.push_back({"Space", "a page down"});
out.push_back({", /", "sideways, in wide blocks"});
out.push_back({"g", "type an address"});
out.push_back({"b", "bookmark this page"});
if (isSaved()) {
out.push_back({"r", "refresh this Saved Page"});
out.push_back({"d", "delete this Saved Page"});
} else {
out.push_back({"s", "save the page to the card"});
out.push_back({"S", "...with the pages it links to"});
}
}
const char* GeminiApp::helpTitle() const {
return inputOpen_ ? "Gemini: an answer" : addressOpen_ ? "Gemini: an address" : nullptr;
}
bool GeminiApp::onKey(const KeyEvent& e) {
requestRedraw();
if (certDialog_) {
@@ -388,7 +414,7 @@ bool GeminiApp::onKey(const KeyEvent& e) {
if (isGemini(page_.base())) gemini_.addBookmark(page_.base(), titleOf());
break;
case 's': // Q82, Q73
if (isSaved()) status_ = "Already saved; r refreshes it";
if (isSaved()) status_ = "Already saved: it can be refreshed";
else if (!isGemini(page_.url)) status_ = "Only Gemini pages can be saved";
else if (page_.header.mimeType().rfind("text/", 0) == 0) gemini_.save(page_.url);
else gemini_.download(page_.url);
@@ -485,7 +511,7 @@ void GeminiApp::draw(Canvas& c) {
c.fillRect(box.x - 2, box.y - 12, box.w + 4, box.h + 14, theme::kBackground);
c.setFont(&fonts::small);
c.setTextColor(theme::kMuted);
c.drawString("Go to (Enter, or ` to cancel)", box.x, box.y - 10);
c.drawString("Go to", box.x, box.y - 10);
widgets::lineEditor(c, address_, box);
}
if (inputOpen_) {
@@ -496,7 +522,7 @@ void GeminiApp::draw(Canvas& c) {
c.drawString(displayText(inputPrompt_).substr(0, 39).c_str(), box.x, box.y - 22);
c.setFont(&fonts::small);
c.setTextColor(theme::kMuted);
c.drawString(inputSensitive_ ? "(hidden) Enter sends, ` cancels" : "Enter sends, ` cancels", box.x, box.y - 9);
if (inputSensitive_) c.drawString("(hidden)", box.x, box.y - 9);
if (inputSensitive_) {
LineEditor masked(1024);
masked.setText(std::string(input_.text().size(), '*'));