about summary refs log tree commit diff stats
path: root/res
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-09-26 17:00:26 +0200
committerbptato <nincsnevem662@gmail.com>2023-09-26 17:00:26 +0200
commit32a528939d6f39cefc00bb1742cf75739c64f006 (patch)
tree765a5b72d8b6662f12b1564437363df9c35ec8d8 /res
parent2b47c6f5ac8d41a8025c10d02da4d6090e616a68 (diff)
downloadchawan-32a528939d6f39cefc00bb1742cf75739c64f006.tar.gz
js: improve optional argument handling
If a fallback argument has been specified, treat undefined as if no
argument had been given.

This removes the need for the ?? 1 checks in the config.
Diffstat (limited to 'res')
-rw-r--r--res/config.toml36
1 files changed, 18 insertions, 18 deletions
diff --git a/res/config.toml b/res/config.toml
index fbda89b6..a3976eaa 100644
--- a/res/config.toml
+++ b/res/config.toml
@@ -62,14 +62,14 @@ substitute-url = '(x) => "https://lite.duckduckgo.com/lite/?kp=-1&kd=-1&q=" + en
 [page]
 q = 'quit()'
 C-z = 'suspend()'
-h = 'n => pager.cursorLeft(n ?? 1)'
-j = 'n => pager.cursorDown(n ?? 1)'
-k = 'n => pager.cursorUp(n ?? 1)'
-l = 'n => pager.cursorRight(n ?? 1)'
-'M-[D' = 'n => pager.cursorLeft(n ?? 1)'
-'M-[B' = 'n => pager.cursorDown(n ?? 1)'
-'M-[A' = 'n => pager.cursorUp(n ?? 1)'
-'M-[C' = 'n => pager.cursorRight(n ?? 1)'
+h = 'n => pager.cursorLeft(n)'
+j = 'n => pager.cursorDown(n)'
+k = 'n => pager.cursorUp(n)'
+l = 'n => pager.cursorRight(n)'
+'M-[D' = 'n => pager.cursorLeft(n)'
+'M-[B' = 'n => pager.cursorDown(n)'
+'M-[A' = 'n => pager.cursorUp(n)'
+'M-[C' = 'n => pager.cursorRight(n)'
 '0' = 'pager.cursorLineBegin()'
 '^' = 'pager.cursorLineTextStart()'
 '$' = 'pager.cursorLineEnd()'
@@ -77,9 +77,9 @@ b = 'pager.cursorPrevWord()'
 w = 'pager.cursorNextWord()'
 '[' = 'pager.cursorPrevLink()'
 ']' = 'pager.cursorNextLink()'
-H = 'n => pager.cursorTop(n ?? 1)'
+H = 'n => pager.cursorTop(n)'
 M = '() => pager.cursorMiddle()'
-L = 'n => pager.cursorBottom(n ?? 1)'
+L = 'n => pager.cursorBottom(n)'
 ';' = 'pager.cursorLeftEdge()'
 '+' = 'pager.cursorMiddleColumn()'
 '@' = 'pager.cursorRightEdge()'
@@ -91,12 +91,12 @@ C-b = 'pager.pageUp()'
 'M-[5~' = 'pager.pageUp()'
 '>' = 'pager.pageRight()'
 '<' = 'pager.pageLeft()'
-C-e = 'n => pager.scrollDown(n ?? 1)'
-C-y = 'n => pager.scrollUp(n ?? 1)'
-J = 'n => pager.scrollDown(n ?? 1)'
-K = 'n => pager.scrollUp(n ?? 1)'
-'('= 'n => pager.scrollLeft(n ?? 1)'
-')' = 'n => pager.scrollRight(n ?? 1)'
+C-e = 'n => pager.scrollDown(n)'
+C-y = 'n => pager.scrollUp(n)'
+J = 'n => pager.scrollDown(n)'
+K = 'n => pager.scrollUp(n)'
+'('= 'n => pager.scrollLeft(n)'
+')' = 'n => pager.scrollRight(n)'
 C-m = 'pager.click()'
 C-j = 'pager.click()'
 M-u = 'pager.dupeBuffer()'
@@ -123,8 +123,8 @@ M-d = 'pager.discardTree()'
 M-c = 'pager.command()'
 '/' = 'pager.isearchForward()'
 '?' = 'pager.isearchBackward()'
-n = 'n => pager.searchNext(n ?? 1)'
-N = 'n => pager.searchPrev(n ?? 1)'
+n = 'n => pager.searchNext(n)'
+N = 'n => pager.searchPrev(n)'
 c = 'pager.peek()'
 u = 'pager.peekCursor()'
 C-w = '''