yi-editor / yi

The Haskell-Scriptable Editor
GNU General Public License v2.0
1.5k stars 200 forks source link

Using Yi as a widget in an existing GUI toolkit #962

Open deech opened 7 years ago

deech commented 7 years ago

Hi, I'm in the process of trying to port Yi to fltkhs. But instead of a text editor app I'd like to publish it simply as another widget (rather like GTK Sourcecandy). I've studied the pango and vty examples but I can't figure out how to adapt them. I also tried to grab the code in Yi.Core.startEditor but it uses dispatch which is unexposed. I could copy-paste what I need but I'm hoping you might point me in a better direction. Thanks!

Fuuzetsu commented 7 years ago

If you need something exposed then it can be exposed. AFAIU something like this was done before, Yi wqs embedded in leksah as part of an IDE. From what I know, anything needed to do this was implemented directly in Yi itself.

Basically figure out what your needs are then try adapting Yi itself rather than trying to make existing code work for a usecase it wasnt deisgned for

deepfire commented 7 years ago

@Fuuzetsu, I find myself in a same situation as @deech -- I'd like to be able to use some part of yi to drive the logic behind a text editing widget in a different visual substrate/system -- but not necessarily bringing in the whole text-editor-as-an-application.

It would be nice if we had a more clear story on that front..

noughtmare commented 7 years ago

@deepfire well, I guess @Fuuzetsu's answer still applies. First try then ask. Yi is very big and complex so I understand that you might not know where to start.

If so, you might want to try to understand the pango frontend (the source is located here). After that you can try to write to write your own frontend.

This is not an easy task and might take some time, but that is to be expected.

You can always ask questions here or on IRC.

Also, when you say "some part of yi" do you mean that you just want a widget version of Yi or do you also mean reduced functionality. If you want reduced functionality then it might be easier to look into more lightweight text editors like rasa or even to write your own text editing engine. We might be able to help you better if you specify what functionality you need (or don't need).