pgadmin4 icon indicating copy to clipboard operation
pgadmin4 copied to clipboard

Leaving the cursor in the Object explorer tree after selecting text prevents editing the query

Open AtmoFX opened this issue 1 year ago • 1 comments

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:

  1. S is typed, and immediately selected.
  2. E is typed, overwrites the selected S and is immediately selected.
  3. L is typed, overwrites the selected E and is immediately selected.
  4. etc.
  5. 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

  1. Type whatever in the query editor. It can be a whole query, a single character or even nothing.
  2. 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).
  3. 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

AtmoFX avatar Apr 05 '24 02:04 AtmoFX

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.

david-benes avatar May 02 '24 15:05 david-benes

This is fixed with one of CodeMirror sub-package update when updating the the yarn.lock file. Putting this to in testing.

adityatoshniwal avatar Jun 17 '24 05:06 adityatoshniwal

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

anilsahoo20 avatar Jun 19 '24 06:06 anilsahoo20