pgadmin4 icon indicating copy to clipboard operation
pgadmin4 copied to clipboard

Ctrl+C to copy does not work in data grid

Open thewildman opened this issue 1 year ago • 7 comments

Describe the bug

Copying data from the datagrid in the Query Tool does not work in the latest release. Clicking on the "copy" button in the toolbar works fine though.

To Reproduce

Steps to reproduce the behavior:

  1. Run a query
  2. Select all lines by clicking the top left box in the result pane.
  3. Hit ctrl+c
  4. Try to paste anywhere

Expected behavior

Should paste the data

Error message

Pastes what was previously in the clipboard.

Desktop (please complete the following information):

  • OS: Windows 11
  • Version: 8.11
  • Mode: Desktop

thewildman avatar Sep 12 '24 11:09 thewildman

Instead of the 2nd step, you could just try to copy any cell value by just selecting it (not double-click) and then use keyboard shortcut to copy the value (Ctrl+C). This bug exists since the last version (8.11), in the previous version it works fine.

tsardaryanCamenAI avatar Sep 12 '24 19:09 tsardaryanCamenAI

I'll add some extra information here: this only happens when there is selected text in the query editor. In that case, it's the selected text that's copied, regardless of focus. When clearing the selection, the selection from the data grid is copied correctly. Double-clicking the cell to copy the value works, however, sometimes you want to copy multiple rows or columns at once.

augustomen avatar Sep 16 '24 13:09 augustomen

Instead of the 2nd step, you could just try to copy any cell value by just selecting it (not double-click) and then use keyboard shortcut to copy the value (Ctrl+C). This bug exists since the last version (8.11), in the previous version it works fine.

But what f I want to copy the entire data grid ?

I'll add some extra information here: this only happens when there is selected text in the query editor. In that case, it's the selected text that's copied, regardless of focus. When clearing the selection, the selection from the data grid is copied correctly. Double-clicking the cell to copy the value works, however, sometimes you want to copy multiple rows or columns at once.

Possibly, yes. I can't reproduce this in a systematic manner. I thought you were right because most of the time when this happens I paste some SQL instead of values, but right now I'm unable to reproduce it.

thewildman avatar Sep 16 '24 14:09 thewildman

It looks like an issue with the CodeMirror editor. I have raised the issue here - https://discuss.codemirror.net/t/codemirror-copies-text-even-if-blurred/8627

adityatoshniwal avatar Sep 17 '24 10:09 adityatoshniwal

Tried to create a minimal reproducible example - https://stackblitz.com/edit/vitejs-vite-wudzeh. Looks like an issue with pgAdmin.

adityatoshniwal avatar Sep 18 '24 11:09 adityatoshniwal

OK, I think I am able to reproduce this in pgadmin.

Failing :

  1. run a query with multicolumn/multiline output (probably not necessary, but more obvious)
  2. copy anything in the clipboard (doesn't have to be in pgadmin), paste it somewhere just to be sure you of what was copied
  3. click in the top left box of the datagrid (intersection of column and line headers) (ie. select all)
  4. ctrl+c
  5. paste anywhere
  6. FAIL (nothing was copied from the datagrid, previously copied content is pasted)

Working :

  1. run a query with multicolumn/multiline output (probably not necessary, but more obvious)
  2. copy anything in the clipboard (doesn't have to be in pgadmin), paste it somewhere just to be sure you of what was copied
  3. click in the top left box of the datagrid (intersection of column and line headers) (ie. select all)
  4. reclick in the same box (ie. deselect all)
  5. reclick in the same box (ie. reselect all)
  6. ctrl+c
  7. paste anywhere
  8. PASS !

thewildman avatar Sep 18 '24 11:09 thewildman

Found an issue: if we have a query selected in the editor and then select a row in the result grid, copying it and attempting to paste will paste the selection into the editor instead of the result grid.

pravesh-sharma avatar Sep 30 '24 11:09 pravesh-sharma

on windows, paste or Ctrl+p doesnt work. it just paste random thing

mukhlim avatar Oct 05 '24 10:10 mukhlim

Issue fixed. Verified on snapshot build.

Env: OS - macOS 14.7 (Sonoma) Mode - Desktop

pravesh-sharma avatar Oct 10 '24 12:10 pravesh-sharma