Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Idea: visual feedback text colorised #48

Open
QM-System-32 opened this issue Dec 4, 2024 · 3 comments
Open

Idea: visual feedback text colorised #48

QM-System-32 opened this issue Dec 4, 2024 · 3 comments

Comments

@QM-System-32
Copy link

Would be possible to create an onTextChange listener that is called when the text typed by the user has changed? Possibly returning it (the text changed).
And another function that allows to modify the text in the input allowing to be colorise with ANSI escape codes...
Thanks.

@lionkor
Copy link
Owner

lionkor commented Dec 4, 2024

Hi, the first should be pretty simple, the second should also be possible. If you feel like it, you could implement the first one yourself and raise a PR? It should be very straightforward :)

@QM-System-32
Copy link
Author

QM-System-32 commented Dec 4, 2024

I can try. But I have some questions:

  1. These callbacks are defined in the main: std::function<void(Backend&)> on_command { nullptr };

    // gets called when tab is pressed and new suggestions are requested
    std::function<std::vectorstd::string(Backend&, std::string, int)> on_autocomplete { nullptr };

    // gets called on write(), for writing to a file or similar secondary logging system
    std::function<void(const std::string&)> on_write { nullptr };

And since they are a sort of listener, where they have been called?

  1. What is commandline.lib and why I need to include as lib in visual studio to compile? Otherwise linker cannot resolve some stuff.

  2. To test the program I downloaded the code in a zip and I added it to a Visual Studio project manually rewriting the main file. Is there a properly way to download and test the code or that's it?
    Thanks.

@lionkor
Copy link
Owner

lionkor commented Feb 3, 2025

The best way is to include the commandline.h, and then link to commandline.lib.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants