Xhivat Hoxhiq01/25/2023, 8:24 AM
with `BasicText`'s for the lines and a
for each cursor. I was able to get the positioning and height of the cursor from the
. Idk if that's a bad or good solution but it works. The real hacky part is how I solved the shared input buffer, what I did is, I placed an invisible
at one of the cursors and gave it focus that also give me just the "changes" when I type/paste into as it's value is always blank. What would the proper solution to these be? Or even more generically, what if compose on desktop is not enough, do I use a lower lever library that can integrate with it? I am really impressed with how well a
performs with loading millions of
lines which I tested just for fun as I will at most have 30-40 in my tool to edit.
Alexander Maryanovsky01/25/2023, 9:33 AM
Xhivat Hoxhiq01/25/2023, 10:12 AM
For a text editor you can try to adapt the existing BasicTextField, but if you need a lot of custom functionality, eventually it will make more sense to write your own widget using the low-level API.Oh wow I wasn't aware of this. This is a passion project of mine with no real time limit and I want it to not have such hacks so I'd love to do this. Can you just nudge me in the right direction on how I do lower level stuff? For example I wanted to mess around with a custom lazy grid and make it fully dynamic. Many of the functions that are used to build LazyGrid are internal functions, did you mean by low-level, I should modify the library itself (which is a pain as it's a huge download and compiles slowly on my machine).
Or maybe someone has already written something you can use.Maybe, I didn't really look but my needs for the text editor are quite niche and I wanted to make my own as a learning experience. It's going to be a tool that allows you to write UI's in a language I'll make just for this that will allow the users to create their own UI's for the mobile app with live previews on the side, that's where the editor comes in. The project goal is to be an easy framework to build home automation/IoT devices with customizable UI's.
Alexander Maryanovsky01/25/2023, 10:34 AM
The drawText() is not available on multiplatform, I think.I think it’s being added in 1.3.0 (in release-candidate stage in mpp right now, soon to be released). For 1.2 there’s
I’d like to take advantage of at the very least IME input from the library instead of making something myselfThere are APIs on all levels. I’m sure some you’ll find useful, others may lack something you need.
Many of the functions that are used to build LazyGrid are internal functionsDepending on your licensing and requirements, you could copy/paste some of the code and adjust to your needs.
Can you just nudge me in the right direction on how I do lower level stuff?Take a look at all the androidx.compose.ui packages
did you mean by low-level, I should modify the library itselfWhatever works better for you - modify the existing code, or write your own.
Xhivat Hoxhiq01/25/2023, 10:39 AM
I think it’s being added in 1.3.0 (in release-candidate stage in mpp right now, soon to be released). For 1.2 there’s
packages. The project will be open source with probably Apache-2.0 licensing I hope that means I can copy some of the code I didn't look into it tbh