On save, cursor changes place

Thanks for reporting an issue! Spend 60 seconds reading this…
Wappler Version : 3.7.4
Operating System : Windows 10
Server Model: php
Database Type: MySQL
Hosting Type: NAMP

Expected behavior

When saving, the cursor should stay where it was placed at the time of saving.

Actual behavior

When saving (ctrl+s in my test case) the cursor moves way up the page.

How to reproduce

  1. Take a long file (in my test case, a css page)
  2. Place the cursor at least in the middle of the page, to give it room to go up.
  3. Paste a good bit of code.
  4. Save.
  5. Once the green confirmation appears, you will notice the whole page has scrolled up significantly above your initial insertion point.

chrome_debug.zip (4.7 KB)

Is the autoprefixer option enabled in Wappler settings?

Yes, it is, as well as the prettifier:

So does the same happen if the autoprefixr is off?

No, it doesn’t seem to happen when autoprefix is off.

maybe @patrick can check if this can be improved.

Correction, it still happens when autopreffix is off, I hadn’t pasted a long enough snippet. Apologies for the confusion.

I believe it happens when autoprefixer or prettify is turned on, they both take the content of the editor and to do their formatting and then replaces the whole editor content with the formatted content. When replacing the whole content the cursor position is lost. This only happens when there is something to format, so when there is a change detected.

Yes, if I disable both, it seems to work fine. Oddly enough, I couldn’t undo changes (ctrl-z had forgotten the previous stage), which is an issue I reported last week - I don’t know if it’s two different issues with similar symptoms or completely unrelated.

I will check the undo issue, could be that it has to do with the full content replacement on save when code was formatted, it should then still allow to undo that.

It will be improved with the next update, undo will work after save and the cursor can change the position a bit after content was updated, but will not jump all the way back to the beginning.

2 Likes

This has been fixed in Wappler 3.7.5

This topic was automatically closed after 44 hours. New replies are no longer allowed.