flamendless / Slab

An immediate mode GUI for the Love2D framework.
MIT License
286 stars 25 forks source link

Enhancement: addition of line numbers to multi-line Input Control #168

Open SugarRayLua opened 7 months ago

flamendless commented 7 months ago

This is a good enhancement, will work on it as soon as I can

SugarRayLua commented 7 months ago

Thank you! 😊

flamendless commented 7 months ago

Progress: image

Sample API:

Slab.Input("test", {
    MultiLine = true,
    LineNumbers = true,
    LIneNumbersStart = 1,
    W = 160,
    H = 160,
})

NOTE: Right now, they are not synced i.e, if the view for the actual Input widget scrolls down, the line numbers widget does not follow

SugarRayLua commented 7 months ago

Thank you very much, @flamendless, for letting me know such progress! I tried modifying Slab myself and was able to also get Line numbers that weren't synched. By having two input controls next to each other (one controlling the line numbers), I was once able to get them to sync by having the input control with numbers scroll position = the multi line word input control position but then ended up with a scroll bar and cursor in a line numbers box which didn't look very good. Without knowing Slab more, I also couldn't figure out how to "skip" line numbers if the multi line word input control wrapped words from the same line.

I'll look forward to your process. I'm a novice programmer but happy to help if there was anything you thought I could do or test to help. :-)

flamendless commented 7 months ago

@SugarRayLua you can make PRs for your attempt(s) as well :)

SugarRayLua commented 7 months ago

👍