klembot / twinejs

Twine, a tool for telling interactive, nonlinear stories
https://twinery.org
GNU General Public License v3.0
2k stars 295 forks source link

[2.6.1] Passage editor: both maximizing and restoring size will reset the view position and move the cursor to the end of passage #1377

Open randomname42 opened 1 year ago

randomname42 commented 1 year ago

Describe the bug.

This happens with any passage larger than can be shown entirely on screen at once. No matter where the cursor was, maximizing will move the view to the start of the passage. If you press an arrow key after that the view switches to the end of the passage. If you start typing after maximizing, what you type will show up at the end of the passage, no matter where the cursor was before you maximized.

Restoring size has the exact same disorienting and inconvenient behavior as maximizing.

In case it's somehow a factor I'm using Sugarcube. But I highly doubt story format has anything to do with the issue.

Steps to reproduce:

Using Twine 2.6.1 open any passage that can't fully fit on screen. Put the cursor somewhere that isn't the end of the passage. When you maximize or restore size the cursor will now be at the end of the passage.

To see how the view position changes, scroll down in a passage so that you're no longer at the top of the passage. When you maximize or restore size the view will now be at the top of the passage.

Expected behavior:

Cursor should stay where in the passage it was located before maximizing or restoring, instead of being sent to the very end of the passage.

View should not get scrolled to the top of the passage, just be shifted so that the cursor position is still on screen within the adjusted view size.

Additional context on this problem.

I've seen some other passage editor issues but this seems like a separate problem.

Twine version number

2.6.1

Does this problem occur with the web version of Twine or the desktop app?

Desktop app

What operating system does this problem occur on?

Linux

If this problem is occurring with the web version of Twine, what browser does it occur on?

None

Presubmission checklist

hituro commented 1 year ago

May be related to #1376, #1338, #1339, #1202

1202 showed the same behaviour of the cursor jumping to the end of the passage when you type.

I can reproduce the jump of the cursor to the end on maximisation in SugarCube, Harlowe, ChapBook, so I would agree that this instance is not related to the StoryFormat.

sternfuchs commented 1 year ago

1376, 1338, 1339 seem to be the same issue.

I am not sure if this one has the same cause.