summaryrefslogtreecommitdiff
path: root/src/gmrequest.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2020-08-19 08:08:42 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2020-08-19 08:08:42 +0300
commit42ac16c668c84516e80bee5932ccb88bc7e91057 (patch)
treefb9d7eb49d785d11f3b293bed3742479a193956f /src/gmrequest.c
parentd358a439aa4d78e25ea17b8e5f4c79113ecaf100 (diff)
Help: Elaborate on link navigation via keyboard
Diffstat (limited to 'src/gmrequest.c')
-rw-r--r--src/gmrequest.c53
1 files changed, 49 insertions, 4 deletions
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 }