diff options
-rw-r--r-- | makefile | 2 | ||||
-rw-r--r-- | src/bindings/quickjs.nim | 2 | ||||
-rw-r--r-- | src/display/client.nim | 3 | ||||
-rw-r--r-- | src/js/javascript.nim | 6 | ||||
-rw-r--r-- | src/main.nim | 2 |
5 files changed, 8 insertions, 7 deletions
diff --git a/makefile b/makefile index 47dbff7c..6c7dd1be 100644 --- a/makefile +++ b/makefile @@ -1,5 +1,5 @@ NIMC = nim c -FLAGS = -d:ssl -o:cha +FLAGS = -o:cha FILES = src/main.nim debug: diff --git a/src/bindings/quickjs.nim b/src/bindings/quickjs.nim index 4a1ad639..661b08b6 100644 --- a/src/bindings/quickjs.nim +++ b/src/bindings/quickjs.nim @@ -118,7 +118,7 @@ type JSClassDefConst* {.importc: "const JSClassDef *", header: qjsheader.} = ptr JSClassDef - JSCFunctionEnum* {.size: sizeof(cint).} = enum + JSCFunctionEnum* {.size: sizeof(uint8).} = enum JS_CFUNC_generic, JS_CFUNC_generic_magic, JS_CFUNC_constructor, JS_CFUNC_constructor_magic, JS_CFUNC_constructor_or_func, JS_CFUNC_constructor_or_func_magic, JS_CFUNC_f_f, JS_CFUNC_f_f_f, diff --git a/src/display/client.nim b/src/display/client.nim index d06ec87c..efdc2c88 100644 --- a/src/display/client.nim +++ b/src/display/client.nim @@ -556,8 +556,7 @@ proc isearchBack(client: Client) {.jsfunc.} = client.buffer.cpos = cpos proc quit(client: Client) {.jsfunc.} = - #eraseScreen() - #print(HVP(0, 0)) + print(HVP(getTermAttributes().height, 0)) quit(0) proc feedNext(client: Client) {.jsfunc.} = diff --git a/src/js/javascript.nim b/src/js/javascript.nim index 9ba4e87f..0bb7b12f 100644 --- a/src/js/javascript.nim +++ b/src/js/javascript.nim @@ -1,6 +1,5 @@ import macros import options -import sequtils import strformat import strutils import tables @@ -272,7 +271,10 @@ func newJSClass*(ctx: JSContext, cdef: JSClassDefConst, cctor: JSCFunction, func else: proto = JS_NewObject(ctx) if funcs.len > 0: - rtOpaque.flist.add(funcs.toSeq()) + # We avoid funcs being GC'ed by putting the list in rtOpaque. + # (QuickJS uses the pointer later.) + #TODO maybe put them in ctxOpaque instead? + rtOpaque.flist.add(@funcs) JS_SetPropertyFunctionList(ctx, proto, addr rtOpaque.flist[^1][0], cint(funcs.len)) assert JS_SetProperty(ctx, proto, ctxOpaque.sym_toStringTag, JS_NewString(ctx, cdef.class_name)) == 1 JS_SetClassProto(ctx, result, proto) diff --git a/src/main.nim b/src/main.nim index 584c92e6..990372ee 100644 --- a/src/main.nim +++ b/src/main.nim @@ -21,7 +21,7 @@ Options: -T, --type <type> Specify content mime type -v, --version Print version information -h, --help Print this page - -- Interpret all following arguments as URLs/files""" + -- Interpret all following arguments as URLs""" if i == 0: echo s else: |