panwriter icon indicating copy to clipboard operation
panwriter copied to clipboard

Paste operation with empty clipboard duplicates current text block

Open lproven opened this issue 4 months ago • 2 comments

I very frequently copy URLs into the text that I am editing. Often I do a round-trip:

  1. Type open square bracket.
  2. Switch to browser, copy link text.
  3. Switch to Panwriter, paste text.
  4. Type closing square bracket, opening round bracket.
  5. Switch to browser, select URL, copy.
  6. Switch to Panwriter, paste URL, type closing round bracket.

If I fumble the copy operation, then when I hit paste with an empty clipboard, Panwriter duplicates the current block of text at the cursor.

This happens frequently but I can't give better steps to reproduce.

(I use macOS a lot of the time and really miss Linux's middle-click-to-insert-selection function here.) I don't know how to clear the clipboard to give better steps to reproduce.

The text duplicated is not the current paragraph but sometimes most of one.

I've had this on Linux and macOS in the past.

lproven avatar Aug 05 '25 12:08 lproven

I have isolated a second, similar issue today.

If no text is highlighted, the Cut command (Ctrl+x) cuts the entire current paragraph.

I initially thought it was deleting the paragraph and used Undo (Ctrl+z) to put it back, but now I know how to reproduce this, I have confirmed it's in the clipboard and can be pasted back in.

I find this very alarming and unexpected.

Expected behaviour: if there is no selection, Cut should do nothing.

lproven avatar Aug 08 '25 14:08 lproven

Hm, interesting. I'm pretty sure that's just what CodeMirror does. I started work on upgrading to the newest major release: CodeMirror 6, but it stalled somewhat: https://github.com/mb21/panwriter/pull/170

mb21 avatar Aug 11 '25 09:08 mb21