liamg / darktile

:waning_crescent_moon: Darktile is a GPU rendered terminal emulator designed for tiling window managers.
MIT License
3.04k stars 112 forks source link

Fix issue: sometimes it cuts selected text when copying to clipboard #186

Closed vadymeng0 closed 5 years ago

vadymeng0 commented 5 years ago

Description

Sometimes terminal cells contain runes with code 0x0000 (which seems ok). But when putting such a text with embedded zeroes into clipboard the text was cut on the first zero rune. So, now those zero runes are replacing with spaces when putting text to clipboard. Also, I did some refactoring and used strings.Builder instead of concatenating the string, in order to minimize memory allocations.

Fixes #169

Type of change

How Has This Been Tested?

  1. Run Aminal on Windows and SSH to a Linux box (this increases the possibility of zero runes).
  2. Select several lines on the screen and press Ctrl+Shift+C to copy the selected text
  3. Open notepad and press Ctrl+V there. See that all the selected text is pasted from the clipboard.

Test Configuration: