about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--res/config.toml36
-rw-r--r--src/js/javascript.nim5
2 files changed, 22 insertions, 19 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 = '''
diff --git a/src/js/javascript.nim b/src/js/javascript.nim
index 87d160ed..0d49cf86 100644
--- a/src/js/javascript.nim
+++ b/src/js/javascript.nim
@@ -507,7 +507,10 @@ proc addParam2(gen: var JSFuncGenerator, s, t, val: NimNode, fallback: NimNode =
     else:
       let j = gen.j
       gen.jsFunCallLists[i].add(newLetStmt(s, quote do:
-        if `j` < argc: `stmt` else: `fallback`))
+        if `j` < argc and not JS_IsUndefined(getJSValue(argv, `j`)):
+          `stmt`
+        else:
+          `fallback`))
 
 proc addValueParam(gen: var JSFuncGenerator, s, t: NimNode, fallback: NimNode = nil) =
   let j = gen.j