ocaml-community/lambda-term

Completion widget

Drup opened this issue · 3 comments

Drup commented

I'm trying to build a widget which is a delicate mix between LTerm_edit and LTerm_read_line, and I can't manage to make it work. My final goal is to reimplement ocp-browser with lambda-term.

So, what I want is a single line editor widget with autocompletion.

I managed to implement it without autocompletion, here, it works as expected.

To add autocompletion, I figured I could use LTerm_read_line. I can't simply inherit from it and LTerm_edit at the same time (they are incompatible in numerous ways), so I tried to build a widget inhering from LTerm_read_line and using the code from LTerm_edit. The frankenstein-y result is here. It doesn't work, and I have no idea why, and I'm starting to be a bit desperate about it. :(

Drup commented

And I found the issue, and it was stupid: I forgot to put a method can_focus = true. I feel slightly dumb now.

We can now move on to my second question: Would it be possible to modify the edit widget in order not to have to copy the code ?

Hello,

modifying edit widget should be entirely possible (though I didn't have a look at your code yet). Would you like to create a pull request or would you like me to have a look at your code and do the changes myself? Both ways are fine.

P.S. I'm having my vacations and living now in the place with very limited connectivity so don't be surprised if it takes a couple of days from me to reply.

Drup commented

I'm not completely sure how you would do it, in fact, it seems to introduce too much parametricity to be acceptable.