Folded regions around the cursor seem to be unfolded, if my understanding of this code is right. Would it be possible to make them atomic? So if the cursor is inside them, it is moved either to the left or right instead, and folded ranges can only be explicitly unfolded by clicking or pressing some key.
I’ve read the docs but have never implemented an extension, so would appreciate some pointers on how to do this.