Leaving the cursor in the Object explorer tree after selecting text prevents editing the query
Describe the bug
When clicking onto the editor and dragging the mouse to select text, if the cursor leaves the editor window before releasing the LMB (e.g. if you do a wide movement left and leave the cursor over the object explorer or up and leave the cursor over the menubar), it becomes impossible to type a query until the cursor is moved back over the query editor window.
More precisely, every character typed from there will be selected, meaning the next character will overwrite it. If you type e.g. SELECT, then the following happens:
- S is typed, and immediately selected.
- E is typed, overwrites the selected S and is immediately selected.
- L is typed, overwrites the selected E and is immediately selected.
- etc.
- At the end of the word, only T remains, automatically selected and ready to overwritten by the space you are about to type.
The query editor seems to lose track of what happens with the mouse after it leaves it, thinking the LMB is still pressed and the cursor is on the left of the widget.
To Reproduce
- Type whatever in the query editor. It can be a whole query, a single character or even nothing.
- With the mouse, select the text typed from right to left as if you were to replace it with new text. At the end of the mouse movement, the cursor should be in the object explorer tree on the left. This is where you should release the mouse (and the LMB).
- For as long as you leave the cursor over the object explorer, every character you type will be selected, meaning the character you type after that will overwrite it, then the next character will overwrite that one and so on.
Expected behavior
Same as v8.3 and before: wherever the mouse ends when the button is released should not affect the editor.
Desktop:
- OS: Windows 10
- Version: 8.4, 8.5 (v8.3 has no bug)
- Mode: Desktop
I noticed the same issue immediately after upgrading from 8.3 to 8.6.
I run the Mac Silicon version. Therefore it is not windows only related issue.
This is fixed with one of CodeMirror sub-package update when updating the the yarn.lock file. Putting this to in testing.
Issue fixed and verified on snapshot build: https://www.postgresql.org/ftp/pgadmin/pgadmin4/snapshots/2024-06-19/ Environment: OS: OSX ventura 13.5.1 Package: arm64