Option to automatically trim trailing linefeed(s) before pasting from clipboard #14324

Closed
opened 2026-01-31 04:07:11 +00:00 by claunia · 5 comments
Owner

Originally created by @NeilMacMullen on GitHub (Jun 23, 2021).

Description of the new feature/enhancement

Many applications (such as Excel or PowerBI) have an annoying habit of adding a linefeed when copying selected text to the clipboard. When this text is then pasted to Terminal it results in this kind of warning dialog...

image

In these circumstances the extraneous linefeed is almost never desirable but it's frustrating to keep being interrupted by the warning dialog.

In the case that the clipboard text ends with a mixture of linefeeds and whitespace AND removing this trailing portion would result in no remaining linefeeds then either:

  • automatically remove the trailing portion (possibly after consulting a new setting to check desired behaviour)
  • Add an extra button to the dialog to allow the user to "paste without trailing linefeed"
  • Provide an option to convert linefeeds to line-continuation characters (obviously would need to be shell specific)
  • other options?
Originally created by @NeilMacMullen on GitHub (Jun 23, 2021). # Description of the new feature/enhancement Many applications (such as Excel or PowerBI) have an annoying habit of adding a linefeed when copying selected text to the clipboard. When this text is then pasted to Terminal it results in this kind of warning dialog... ![image](https://user-images.githubusercontent.com/9131337/123127996-abc9ef00-d442-11eb-82b9-947e40673411.png) In these circumstances the extraneous linefeed is almost never desirable but it's frustrating to keep being interrupted by the warning dialog. <!-- A clear and concise description of what you want to happen. --> In the case that the clipboard text ends with a mixture of linefeeds and whitespace AND removing this trailing portion would result in no remaining linefeeds then either: - automatically remove the trailing portion (possibly after consulting a new setting to check desired behaviour) - Add an extra button to the dialog to allow the user to "paste without trailing linefeed" - Provide an option to convert linefeeds to line-continuation characters (obviously would need to be shell specific) - other options?
claunia added the Issue-FeatureResolution-Duplicate labels 2026-01-31 04:07:11 +00:00
Author
Owner

@PankajBhojwani commented on GitHub (Jun 23, 2021):

Thanks for filing the request! I believe this is covered by #9400 and there's currently a PR to add this.

/dup

@PankajBhojwani commented on GitHub (Jun 23, 2021): Thanks for filing the request! I believe this is covered by [#9400](https://github.com/microsoft/terminal/issues/9400) and there's currently a PR to add this. /dup
Author
Owner

@skyline75489 commented on GitHub (Jun 24, 2021):

@PankajBhojwani I believe you need to /dup #9400 . Anyway I'll just do it for ya.

@skyline75489 commented on GitHub (Jun 24, 2021): @PankajBhojwani I believe you need to /dup #9400 . Anyway I'll just do it for ya.
Author
Owner

@NeilMacMullen commented on GitHub (Jun 24, 2021):

agree it's a dup - great that it's already in progress - thanks :-)

@NeilMacMullen commented on GitHub (Jun 24, 2021): agree it's a dup - great that it's already in progress - thanks :-)
Author
Owner

@DHowett commented on GitHub (Jun 24, 2021):

I do think we should be more intelligent here... text that is a single line and ends in a newline with no further content should just strip it by default, I think. I am opposed to adding a button to every paste dialog that folks will have to process when they paste. Perhaps there's a middle ground!

@DHowett commented on GitHub (Jun 24, 2021): I do think we should be more intelligent here... text that is a single line and ends in a newline with no further content should just strip it by default, I think. I am opposed to adding a button to every paste dialog that folks will have to process when they paste. Perhaps there's a middle ground!
Author
Owner

@NeilMacMullen commented on GitHub (Jun 24, 2021):

@DHowett Agreed. Being interrupted by a dialog on every paste would be annoying (especially if I have to move the mouse to select the appropriate response) , hence the suggestion for an option to "do the right thing" automatically. Looking at the linked PR, I think it just adds another button which is definitely better than having no control over this.

FWIW, if you were to go down the route of allowing more flexibility in pasting then maybe it would be worth exposing this as an "apply regex" command then letting users bind their own keystroke to it to get custom paste behaviour?

@NeilMacMullen commented on GitHub (Jun 24, 2021): @DHowett Agreed. Being interrupted by a dialog on every paste would be annoying (especially if I have to move the mouse to select the appropriate response) , hence the suggestion for an option to "do the right thing" automatically. Looking at the linked PR, I think it just adds another button which is definitely better than having _no_ control over this. FWIW, if you were to go down the route of allowing more flexibility in pasting then maybe it would be worth exposing this as an "apply regex" command then letting users bind their own keystroke to it to get custom paste behaviour?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#14324