I'm working on a plugins that add carets. However, during that process, the primary caret gets changed (I'm not a 100% sure why, though while digging in the code, it seems the last caret added is the primary one).
Anyway, as a work around, I save the position of the caret, then after adding other carets, I "restore" the position, so it's put last. Works fine.
Issue is, if you don't "allow cursor beyond end of line", when you're on column 10, and scroll down to an empty line, you go to column 0. Fine. And when you scroll again to a longer line, let's say 20 chars, you're back at column 10. But when I set manually the primary caret, this information is lost, so scrolling down again brings you to column 0. Any way to solve this?