holzschu / holzschu/a-shell

Lost newlines and repeated junk when copying text from terminal

Open
#862 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Perl
Stars
3.9k
Forks
213
Avg merge
1m
Merged PRs (30d)
1

Description

In this example, I open a fresh a-Terminal session, display a file on screen with cat, copy its text, and paste it in this GitHub issue. Note that extra newlines got added before and after the selected text, and the newlines after the shebang line and function got lost.

Selected text:
![IMG_0321](https://github.com/user-attachments/assets/e82e5d83-daa6-490f-a9ef-472dcf245bfd)

Copied text:

~~~

[~/Documents]$ cat repro5.sh
#! /bin/sh
foo() {
printf "baa "
printf "caa "
printf "daa "
}
foo | tr 'a' 'z'
printf "\n"

~~~

In some other cases, particularly when I’ve been repeatedly opening and closing and editing files, or when I’m struggling a bit to get text selection to cooperate, I end up with bigger mismatches between what is shown selected on screen and what actually gets copied, such as lines or entire paragraphs/functions repeated. This issue is rather tricky to reproduce and actual behaviour seems to vary. Nonetheless, there do seem to be bugs in the text selection and/or text copying logic for the terminal.

The main issues I see are:

1. Blank lines in selected text are usually lost in what is copied.
2. Sometimes, copied text has blank lines prepended and appended.
3. Sometimes lines or groups of lines get repeated/duplicated in the copied text.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.