Wow, this prompted me to go look for a GPL PalmOS editor I wrote 11 years ago and _someone's put it on GitHub [1]_ and updated it 2 months ago. It was the first serious programming I did.
I used a bizarre structure where the each onscreen line in the document (soft-wrapped) was represented by a (uint16?) character count and pointer to an array containing the characters. I had to write a custom memory allocator that put adjacent lines next to each other in memory to make moving characters between lines efficient.
Way too much overhead, and if you changed font you had to completely reload the file, but it was pretty quick even on the old 68K Palms.
I used a bizarre structure where the each onscreen line in the document (soft-wrapped) was represented by a (uint16?) character count and pointer to an array containing the characters. I had to write a custom memory allocator that put adjacent lines next to each other in memory to make moving characters between lines efficient.
Way too much overhead, and if you changed font you had to completely reload the file, but it was pretty quick even on the old 68K Palms.
[1] https://github.com/rtiangha/SiEd-Dana