summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--res/help.gmi6
-rw-r--r--src/gmrequest.c53
2 files changed, 54 insertions, 5 deletions
diff --git a/res/help.gmi b/res/help.gmi
index 1652f392..ad569230 100644
--- a/res/help.gmi
+++ b/res/help.gmi
@@ -16,7 +16,11 @@
16 16
17## Navigation 17## Navigation
18 18
19Hold down Alt/Option to see link shortcut keys. Each visible link on the page gets an alphanumeric shortcut. For example, the first link can be opened by pressing Alt-1. The tenth link is Alt-A. Additionally hold down Control/Command to open the link in a new tab. 19When navigating via keyboard, hold down ${ALT} to see link shortcut keys. Try doing so now and see how the link icon below is replaced with a number.
20
21=> gemini://gemini.circumlunar.space/ Project Gemini
22
23Each visible link on the page gets an alphanumeric shortcut. For example, the first link can be opened by pressing ${ALT+}1. The tenth link is ${ALT+}A. Additionally hold down ${CTRL} to open the link in a new tab.
20 24
21### SEomting 25### SEomting
22 26
diff --git a/src/gmrequest.c b/src/gmrequest.c
index 0d69861d..f0101080 100644
--- a/src/gmrequest.c
+++ b/src/gmrequest.c
@@ -278,18 +278,63 @@ static const iBlock *aboutPageSource_(iRangecc path) {
278} 278}
279 279
280static const iBlock *replaceVariables_(const iBlock *block) { 280static const iBlock *replaceVariables_(const iBlock *block) {
281 iRegExp *var = new_RegExp("\\$\\{([A-Z_]+)\\}", 0); 281 iRegExp *var = new_RegExp("\\$\\{([A-Z_+-]+)\\}", 0);
282 iRegExpMatch m; 282 iRegExpMatch m;
283 if (matchRange_RegExp(var, range_Block(block), &m)) { 283 if (matchRange_RegExp(var, range_Block(block), &m)) {
284 iBlock *replaced = collect_Block(copy_Block(block)); 284 iBlock *replaced = collect_Block(copy_Block(block));
285 do { 285 do {
286 const iRangei span = m.range; 286 const iRangei span = m.range;
287 remove_Block(replaced, span.start, size_Range(&span));
288 const iRangecc name = capturedRange_RegExpMatch(&m, 1); 287 const iRangecc name = capturedRange_RegExpMatch(&m, 1);
288 iRangecc repl = iNullRange;
289 if (equal_Rangecc(&name, "APP_VERSION")) { 289 if (equal_Rangecc(&name, "APP_VERSION")) {
290 insertData_Block(replaced, span.start, 290 repl = range_CStr(LAGRANGE_APP_VERSION);
291 LAGRANGE_APP_VERSION, strlen(LAGRANGE_APP_VERSION)); 291 }
292 else if (equal_Rangecc(&name, "ALT")) {
293#if defined (iPlatformApple)
294 repl = range_CStr("\u2325");
295#else
296 repl = range_CStr("Alt");
297#endif
298 }
299 else if (equal_Rangecc(&name, "ALT+")) {
300#if defined (iPlatformApple)
301 repl = range_CStr("\u2325");
302#else
303 repl = range_CStr("Alt+");
304#endif
305 }
306 else if (equal_Rangecc(&name, "CTRL")) {
307#if defined (iPlatformApple)
308 repl = range_CStr("\u2318");
309#else
310 repl = range_CStr("Ctrl");
311#endif
292 } 312 }
313 else if (equal_Rangecc(&name, "CTRL+")) {
314#if defined (iPlatformApple)
315 repl = range_CStr("\u2318");
316#else
317 repl = range_CStr("Ctrl+");
318#endif
319 }
320 else if (equal_Rangecc(&name, "SHIFT")) {
321#if defined (iPlatformApple)
322 repl = range_CStr("\u21e7");
323#else
324 repl = range_CStr("Shift");
325#endif
326 }
327 else if (equal_Rangecc(&name, "SHIFT+")) {
328#if defined (iPlatformApple)
329 repl = range_CStr("\u21e7");
330#else
331 repl = range_CStr("Shift+");
332#endif
333 }
334 remove_Block(replaced, span.start, size_Range(&span));
335 insertData_Block(replaced, span.start, repl.start, size_Range(&repl));
336 printf("{%s}\n", cstr_Block(replaced));
337 iZap(m);
293 } while (matchRange_RegExp(var, range_Block(replaced), &m)); 338 } while (matchRange_RegExp(var, range_Block(replaced), &m));
294 block = replaced; 339 block = replaced;
295 } 340 }