about summary refs log tree commit diff stats
path: root/src/buffer
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2022-11-25 23:15:49 +0100
committerbptato <nincsnevem662@gmail.com>2022-11-25 23:16:39 +0100
commitd54e0258fd794ad54b42acc51ec65d9c7297d908 (patch)
tree028ec9ce0dc9ba77d23bea2e3f86e4aabb527b4b /src/buffer
parent7ab7f28fdefe503fdde53ba9e253e308cb06b44f (diff)
downloadchawan-d54e0258fd794ad54b42acc51ec65d9c7297d908.tar.gz
Fix some table layout issues
Diffstat (limited to 'src/buffer')
-rw-r--r--src/buffer/container.nim35
1 files changed, 7 insertions, 28 deletions
diff --git a/src/buffer/container.nim b/src/buffer/container.nim
index b1f73629..20f04f62 100644
--- a/src/buffer/container.nim
+++ b/src/buffer/container.nim
@@ -511,32 +511,6 @@ proc popCursorPos*(container: Container, nojump = false) =
     container.sendCursorPosition()
     container.needslines = true
 
-macro proxy(fun: typed) =
-  let name = fun[0] # sym
-  let params = fun[3] # formalparams
-  let retval = params[0] # sym
-  var body = newStmtList()
-  assert params.len >= 2 # return type, container
-  var x = name.strVal.toScreamingSnakeCase()
-  if x[^1] == '=':
-    x = "SET_" & x[0..^2]
-  let nup = ident(x)
-  let container = params[1][0]
-  body.add(quote do:
-    `container`.ostream.swrite(`nup`))
-  for c in params[2..^1]:
-    let s = c[0] # sym e.g. url
-    body.add(quote do:
-      `container`.ostream.swrite(`s`))
-  body.add(quote do:
-    `container`.ostream.flush())
-  if retval.kind != nnkEmpty:
-    body.add(quote do:
-      `container`.istream.sread(result))
-  var params2: seq[NimNode]
-  for x in params.children: params2.add(x)
-  result = newProc(name, params2, body)
-
 proc cursorNextLink*(container: Container) {.jsfunc.} =
   container.writeCommand(FIND_NEXT_LINK, container.cursorx, container.cursory)
   container.expect(JUMP)
@@ -569,8 +543,13 @@ proc gotoAnchor*(container: Container, anchor: string) =
   container.expect(ANCHOR_FOUND)
   container.expect(ANCHOR_FAIL)
 
-proc readCanceled*(container: Container) {.proxy.} = discard
-proc readSuccess*(container: Container, s: string) {.proxy.} = discard
+proc readCanceled*(container: Container) =
+  container.writeCommand(READ_CANCELED)
+
+proc readSuccess*(container: Container, s: string) =
+  container.writeCommand(READ_SUCCESS, s)
+  container.expect(OPEN)
+  container.expect(RESHAPE)
 
 proc reshape*(container: Container, noreq = false) {.jsfunc.} =
   container.writeCommand(RENDER)