hoelzro / lua-linenoise

Lua bindings for linenoise with UTF-8 support (https://github.com/yhirose/linenoise/tree/utf8-support)
MIT License
47 stars 13 forks source link

Support for hinting #16

Open aleclarson opened 6 years ago

aleclarson commented 6 years ago

See here: https://github.com/antirez/linenoise#hints

hoelzro commented 6 years ago

Thanks for the report! For this one, I'll just need to grab what's upstream and wrap it - #17 has a similar story. I should be able to get around to this within the next few days.

hoelzro commented 6 years ago

Hi @aleclarson - I took a stab at this and #17 tonight. Could you pull down the new code and let me know what you think?

aleclarson commented 6 years ago

Hey @hoelzro - I'll let you know when I get some time to try it out. Thanks!

hoelzro commented 6 years ago

@aleclarson Have you had a chance to look at this?

aleclarson commented 6 years ago

When the sethints callback is triggered, my terminal goes bonkers with weird whitespace and a segmentation fault occurs (at least in Tarantool).

Segmentation fault
code: SEGV_MAPERR
addr: 0x13
context: 0x10ad6c978
siginfo: 0x10ad6c910
Current time: 1520203843
Please file a bug at http://github.com/tarantool/tarantool/issues
Attempting backtrace... Note: since the server has already crashed, 
this may fail as well
#0  0x1085b83b9 in print_backtrace+9
#1  0x1085067d8 in _ZL12sig_fatal_cbiP9__siginfoPv+158
#2  0x7fff56a74f5a in _sigtramp+1a
#3  0x108632d86 in lj_alloc_malloc+66
#4  0x10ab524ca in hints_callback_wrapper+ea
#5  0x10ab528db in refreshShowHints+cb
#6  0x10ab53590 in refreshLine+870
#7  0x10ab52b11 in linenoiseEditInsert+91
#8  0x10ab543d3 in linenoise+523
#9  0x10ab51dfc in l_linenoise+4c
#10 0x1085d1015 in lj_BC_FUNCC+44
#11 0x1085ddcd8 in lj_dispatch_ins+2b8
#12 0x1085d2dab in lj_vm_inshook+31
#13 0x1085e7582 in lua_pcall+a2
#14 0x1085a9ca3 in luaT_call+13
#15 0x1085a59d6 in lua_fiber_run_f+66
#16 0x10850633c in _ZL16fiber_cxx_invokePFiP13__va_list_tagES0_+c
#17 0x1085b60da in fiber_loop+4a
#18 0x108702b1b in coro_init+4b
tarantool: line 54: 19275 Abort trap: 6           tarantool ./__entry__.lua
hoelzro commented 6 years ago

Oh no! Does this happen with a standalone Lua interpreter? Maybe it's some version mismatch with the version Tarantool's embedding and the version the shared library was compiled against, or (hopefully not) there's something sinister going on when integrating with Tarantool. What version of Lua is Tarantool using, and what version was the shared library compiled against?

hoelzro commented 6 years ago

@aleclarson Do you mind if we migrate the later issue with the segfault to its own issue?

aleclarson commented 6 years ago

👍

Sorry for not following up. I forgot about that issue, and gave up on hinting since it wasn't required for my use case.

epicfilemcnulty commented 2 years ago

@hoelzro Hey, so do hints work or not? =) Judging by the docs they should, but I did not get any hints using the example code...

hoelzro commented 2 years ago

@epicfilemcnulty They should be working - which example code are you trying that they're not working on?

epicfilemcnulty commented 2 years ago

@hoelzro I'm using the example code from the README in the repo, and hinting does not work =(

hoelzro commented 2 years ago

Ok, thanks for clarifying - so when you say it doesn't work, does the program crash, does nothing special happen, etc? The way I test it is to run it and type h - after that I see a little hint show up.

Also, which terminal are you using, and how are you installing the library?