Skip to content
New issue

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

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

Already on GitHub? # to your account

Feature Request: syntax highlighting #63

Open
juarezr opened this issue Feb 27, 2024 · 4 comments
Open

Feature Request: syntax highlighting #63

juarezr opened this issue Feb 27, 2024 · 4 comments

Comments

@juarezr
Copy link

juarezr commented Feb 27, 2024

Hi,

Do you have any plans for supporting syntax highlighting in the widget?

There are some crates that could help, but I don't know if there is interest in having syntax highlighting as a feature.

@Julien-cpsn
Copy link

Julien-cpsn commented Mar 4, 2024

YES PLEASE

Or at least it would be great to have the possibility to use TextArea with ratatui's Line, since we can color the Spans inside ourselves

@KiraCoding
Copy link

I think this would be awesome to have, I'm writing a code editor right now and well syntax highlighting is a key feature of every code editor. I hope someone works on this.

@Julien-cpsn
Copy link

Julien-cpsn commented Mar 6, 2024

I think this would be awesome to have, I'm writing a code editor right now and well syntax highlighting is a key feature of every code editor. I hope someone works on this.

I am doing kind of the same thing and I succeed to apply Syntax highlighting on a Vec of Line into a Paragraph using Syntect. But since the TextArea does not work with a Vec of Line, it's incompatible...

https://github.com/Julien-cpsn/ATAC/blob/main/src%2Futils%2Fsyntax_highlighting.rs#L15

(After digging a little the component, it is rendered by transforming the String to a Vec of Line and putting into a Paragraph. So we might not be that far)

@Julien-cpsn
Copy link

Julien-cpsn commented Apr 26, 2024

Hello guys!

I tried to make a fork and do a quick implementation. Everything works great until you have a tab.
The lib creator has put some mechanism to replace \t by some spaces (according to widget tab_len property) only in the text representation. It increments the line length but not the actual text length. I can't get to fix it....
It took me about 5h to do this and I don't to play with it anymore to keep some sanity

Here is the link of my fork:
https://github.com/Julien-cpsn/tui-textarea

If you wish to correct this problem, it would be greatly appreciated!!!!

Here are some screenshots:

image
image

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

No branches or pull requests

3 participants