PSReadLine icon indicating copy to clipboard operation
PSReadLine copied to clipboard

Interpret control characters pasted into `-LiteralPath` arguments verbatim – do not replace them.

Open RokeJulianLockhart opened this issue 10 months ago • 0 comments

Prerequisites

  • [x] Write a descriptive title.

Description of the new feature/enhancement

Tabs are valid in UNIX file paths. However, when pasted into PowerShell running as an interactive shell, they are converted into spaces, due to issues/144#event-1337497655. ^1 This means that accessing paths with tabs inside them is impossible in an interactive shell, despite being possible in a .PS1 script.

I propose that inline tabs (those not prepended to a line's non-whitespace content) be retained, verbatim.

Proposed technical implementation details (optional)

Because issues/144#event-1337497655 solely cares about indentative tabs, retaining inline tabs wouldn't be problematic. Likewise, tabs prefixing a line do not impact this use case, because any path with a prefixed tab shall regardless be escaped (as '$Path').

However, PSReadLine currently pastes content by simulating typing. ^2 https://github.com/PowerShell/PSReadLine/issues/1471#issue-600646593 requests that paste bracketing be implemented so that functionality like this can be implemented, which means that this FR depends upon its implementation.

RokeJulianLockhart avatar Feb 04 '25 18:02 RokeJulianLockhart