jaar23 / tui_widget

terminal ui widget based on illwill
14 stars 1 forks source link

example fails with error #4

Closed Houdiee closed 1 month ago

Houdiee commented 1 month ago
import tui_widget, illwill

var inputBox = newInputBox(1, 1, consoleWidth(), 3, "message")

var display = newDisplay(1, 4, consoleWidth(), 16, "display panel") 

let enterEv = proc(ib: InputBox, arg: varargs[string]) =
  display.add(inputBox.value & "\n")
  inputBox.value("")

inputBox.onEnter = enterEv

var app = newTerminalApp(title="tui widget")

app.addWidget(inputBox)
app.addWidget(display)

app.run()

fails with Error: type mismatch: got <typedesc[EventFn[display_wg.Display]]> but expected one of: EventFn[display_wg.Display]

I have all the dependencies installed as shown by nimble list --installed: ansiparse [(version: 0.4.0, checksum: 49411d0e4b4e90df4020386b6f14be8c54809a63)] asciigraph [(version: 0.1.2, checksum: 6b2ee742ac2329be1aa1bbedeef5b37a48295965)] ast_pattern_matching [(version: 1.0.0, checksum: e7d2f92c1a3390b4b2da00e021baf14b91ff5017)] asynctools [(version: 0.1.1, checksum: 3f7096335282f45ebab49b939b20a1ed52cdec31)] bearssl [(version: 0.2.5, checksum: 550e6f9321b85de53bba9c0ffab9c95ffbe12ab3)] c2nim [(version: 0.9.19, checksum: 1954eb89cc353cf2a4e54804d38d5a1e72f3c98e)] chronicles [(version: 0.10.3, checksum: 79f09526d4d9b9196dd2f6a75310d71a890c4f88)] chronos [(version: 4.0.3, checksum: ba179f34b0513ebd1615076f07b61e2e217bd228)] faststreams [(version: 0.3.0, checksum: 5f92cbf69506e6c8c702397336528c2345f4dba2)] httputils [(version: 0.3.0, checksum: d1b1ec718e432b9dde5e176965ebd9380f494d41)] illwill [(version: 0.4.1, checksum: 9c58351502f89a16caf031cbd1992ad3fdfd3c67), (version: 0.4.0, checksum: 1a505391af490a4b5fdac69cade985037a0b7f41)] json_rpc [(version: 0.4.2, checksum: 5c451e05b217e19d5a5ebaf087ecbb8576257a73)] json_serialization [(version: 0.2.6, checksum: 23ccb053d28077c4536066814bdcd5ec52721a5b)] jsonschema [(version: 0.2.1, checksum: 8ae2ef3c6c97e9bf2fdf650436adf512ba2f5991)] malebolgia [(version: 0.1.0, checksum: 5c404addea46d485f94915a897fba9906feff92d)] nancy [(version: 0.1.1, checksum: 626d5a8937046ed31841d8af728e98013c476768)] nim [(version: 2.0.8, checksum: 46333e8f4bda41dd6d3852a3f5fa4975b96b66a2)] nimclipboard [(version: 0.1.2, checksum: bf02a33b9ac528b92aec2088bb8b38d91eb23603)] nimcrypto [(version: 0.6.0, checksum: 5c65396428df9112a15a9e58f0b1a6156dca1b35)] nimgen [(version: 0.5.1, checksum: 31deb7a09271d9916a5ef3dbdee95b96fcbcda2e)] nimlangserver [(version: 1.6.0, checksum: 2ec09c6fbc0c1a56fd8587aee5f4dd7e1afc5b98)] regex [(version: 0.25.0, checksum: cb2e24397c051e55ad5b72b3c0d4f270a90084df)] results [(version: 0.5.0, checksum: 901e2ed088160fdcb8fdf3b315ce62baedc3f7ba)] serialization [(version: 0.2.2, checksum: 320676ee66fba7dba2dc0f97bb2c73e1abbb1bf7)] stew [(version: 0.1.0, checksum: 1324b9f156102250b18aff75641c16947ff26094)] stint [(version: 2.0.0, checksum: 46e33fff3afdedd1a07c0accd483d03106ccfaee)] terminaltables [(version: 0.1.1, checksum: 5fdf88d70cc1d904291204cd4f9e2adf992fb564)] termstyle [(version: 0.1.0, checksum: 4641c9f9e587d5cf04ccd3ce0bf1ef0263a16299)] testutils [(version: 0.5.0, checksum: 7c44bdaba36e0dcae7a9abe9d1fec293b9da9389)] threading [(version: 0.2.0, checksum: 1bb1be822a989a8b56bd86c4e1117367426f1b67)] tui_widget [(version: 0.1.1, checksum: 4099bb7ec94c2b42a7a614c218b178d403402423)] unicodedb [(version: 0.13.0, checksum: 5c5fc0c8a83d270aca74fe41d33158e9042bb91a)] unittest2 [(version: 0.2.2, checksum: 6ac7f7ea74df812a25be5d6d36a59d23789eb508)] websock [(version: 0.1.0, checksum: 164be92f60f6356af6602ddb113e7298075f2842)] with [(version: 0.5.0, checksum: 1d7e37bdf122d3bc4c7996f382a0006573eb6ece)] zlib [(version: 0.1.0, checksum: c415b7c692e633e5015392f66f0cb2dd8c1b8ee0)]

jaar23 commented 1 month ago

Hi I guess there is some changes on tables, just to check, are you using nim 2.2?

jaar23 commented 1 month ago

You can verify this by down nim version to 2.0

jaar23 commented 1 month ago

@Houdiee I've pushed a new fix to main to support nim at version 2.2. Try to pull the main branch again, this example should be working again. thank you.

Houdiee commented 1 month ago

Hi I guess there is some changes on tables, just to check, are you using nim 2.2?

Yup, I'm on 2.2.

First, I'd like to thank you for quickly trying to resolve this issue, but even after cloning the main repo today, my compile fails with a different error:

Warning: imported and not used: 'illwill' [UnusedImport]
Hint:  [Link]
ld: error: undefined symbol: clipboard_text_ex
>>> referenced by clipboard_common.c
@m..@s..@s.nimble@spkgs2@snimclipboard-0.1.2-bf02a33b9ac528b92aec2088bb8b38d91eb23603@snimclipboard@ssrc@sclipboard_common.c.o:(clipboard_text)

ld: error: undefined symbol: clipboard_set_text_ex
>>> referenced by clipboard_common.c

ld: error: undefined symbol: libiconv_open
>>> referenced by @m..@s..@s..@s..@susr@slocal@snim@slib@spure@sencodings.nim.c

ld: error: undefined symbol: libiconv
>>> referenced by @m..@s..@s..@s..@susr@slocal@snim@slib@spure@sencodings.nim.c

ld: error: undefined symbol: libiconv_close
>>> referenced by @m..@s..@s..@s..@susr@slocal@snim@slib@spure@sencodings.nim.c

ld: error: undefined symbol: clipboard_new
>>> referenced by @m..@s..@s.nimble@spkgs2@stui_widget-0.1.2-80770e9ec8a4b49377b145b4617d703d7d80c90d@swidget@stextarea_wg.nim.c

ld: error: undefined symbol: clipboard_clear
>>> referenced by @m..@s..@s.nimble@spkgs2@stui_widget-0.1.2-80770e9ec8a4b49377b145b4617d703d7d80c90d@swidget@stextarea_wg.nim.c

clang: error: linker command failed with exit code 1 (use -v to see invocation)
Error: execution of an external program failed: 'clang   -o 

note that ive reduced the error output down for readability, otherwise there is a whole lot of boilerplate from the compiler.

jaar23 commented 1 month ago

This error may come from the nimclipboard library, what is your os environment? Basically it complain for linker compiler. I think it's running fine on macos and Linux. Haven't tested on windows with nimclipboard before.

Houdiee commented 1 month ago

This error may come from the nimclipboard library, what is your os environment? Basically it complain for linker compiler. I think it's running fine on macos and Linux. Haven't tested on windows with nimclipboard before.

i see. makes sense. i am running from freebsd, i wouldn't be surprised if it wasn't compatible. Thanks for spending your time trying to fix this error