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

Add Word Coloring to Multi-Line Control #986

Closed
aiekick opened this issue Jan 19, 2017 · 8 comments
Closed

Add Word Coloring to Multi-Line Control #986

aiekick opened this issue Jan 19, 2017 · 8 comments

Comments

@aiekick
Copy link
Contributor

aiekick commented Jan 19, 2017

Hello,

finally i abandon scintilla.

i just need word coloring in the text multi line control.

I hope i can have a string with information about word start, word end, and word color to pass to the multi-line control. like that maybe "start : end : color" => "10:22:#99ccff"

So before the multi-line control i imagine analyse the text and format a special string for it in the ImGuiTextEditCallback

Finally i imagine pass this buffer to a modified version of ImFont::RenderText.

Do you think i may be heavy , maybe you have another way ?

Thanks for your help

@ocornut
Copy link
Owner

ocornut commented Jan 19, 2017

Hello,
I will merge this topic with #902

Realistically it isn't going to happen soon, but eventually we may evolve the text editor to provide some sort of text coloring facility. It's not a trivial feature and won't happen soon so don't hold your breath right now :)

@aiekick
Copy link
Contributor Author

aiekick commented Jan 19, 2017

ah, ok thanks :)

@ocornut
Copy link
Owner

ocornut commented Dec 12, 2017

Closing this as expected.

Note that there is a full-featured code editor that you might want to use here:
https://github.com/BalazsJako/ImGuiColorTextEdit

@ocornut ocornut closed this as completed Dec 12, 2017
@sadovsf
Copy link

sadovsf commented Feb 26, 2019

Unfortunatelly linked widget has currently broken calculation of cursor position. It is off in +x axis more the longer text is on line. Basically there seems to be some issue with calculation from column to screen pos of character. I did report it to author. Maybe you may know about some change that may broke it i found for example rounding in ImGui::CalcTextSize which iam not sure about (but removing it did not help either)

@ocornut
Copy link
Owner

ocornut commented Feb 26, 2019

Hmm, the only thing I can think of is that change
3d20471

@sadovsf
Copy link

sadovsf commented Feb 26, 2019

I tried to revert this but it did not fix the issue but when i removed rounding at the end of ImGui::CalcTextSize it started working. Problem from what i have seen is that author is using CalcTextSize on per character basis to calculate cursor position. This rounding then introduces bigger and bigger error with each character (none of them has exact size). Part from commit you mentioned he probably attempt to mitigate resulting in another error after mentioned commit.

@ocornut
Copy link
Owner

ocornut commented Feb 26, 2019

They should probably use the lower level ImFont->CalcTextSizeA function.

@sadovsf
Copy link

sadovsf commented Feb 26, 2019

I tried that and it seem to be working well now (had to remove their parts that were fighting removed code you mentioned previously). OK, will test font scaling and give them patch :-)

Thank you for your assistance, it was really helpfull

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

No branches or pull requests

3 participants