Search code examples
windowscygwinclipboardmsys2

MSYS2 paste problem when pasting multiple and long lines


I have an issue with recent versions of MSYS2 that I didn't have with older versions.

I often paste a large number of commands, some of which are longer that the console width. There are also sometimes multiline commands in there (e.g. shell if stuff with the fi several lines later). But I do make sure there are no tabs in there to avoid autocompletion from kicking in.

In old MSYS2 I could just paste everything and the commands would start right away.

In newer MSYS2 after pasting it is apparently waiting for another Enter before starting.

But what's worse: the data pasted isn't intact. Sometimes pieces are missing, sometimes it gets truncated, sometimes both.

I have reproduced this on Windows 10 and Windows 11.

I also tried running msys2.exe as well as others like mingw64.exe, and I even tried running sh.exe from ConsoleZ.

Is there some kind of setting or environment variable to get the old paste behaviour back?

UPDATE

  • Also tried with Windows Terminal
  • Tried pasting from different source (Notepad instead of Notepad++)
  • Tried changing copied source (in Notepad++) to different line endings (CR, LF, CR+LF)

No improvement.

Additionally I noticed sometimes part of the beginning of the copied text are pasted last. So it's not just a matter of missing pieces - the contents get thrown around during paste...


Solution

  • I have not been able to resolve this issue in ConsoleZ or Console2, but when using mintty from MSYS2 the following fixes the paste problem:

    bind 'set enable-bracketed-paste off'
    

    As mintty is not a console program (in the Windows application sense) this solution can't be made to work with ConsoleZ or Console2, but it is possible with ConEmu.