Skip to content

Clipboard Copies Ansi Escapes when using $PSStyle.OutputRendering = 'PlainText' #47

@ninmonkey

Description

@ninmonkey

Summary

  • Ansi Escapes are copied to the clipboard when using OutputRendering = 'PlainText'.
  • Ansi Escapes are preserved in a round-trip with PlainText Mode

To Reproduce

$PSStyle.OutputRendering = 'PlainText'
# breaks
[uri] | Find-Member *escape* | % DisplayString | Set-Clipboard

# I thought maybe round trip would omit escapes, but it copies them
# breaks:
[uri] | Find-Member *escape* | % DisplayString
| Set-Clipboard | Get-Clipboard | Set-Clipboard

# works:
[uri] | Find-Member *escape* | % DisplayString
| Set-Clipboard | Get-Clipboard

image

Working cases

It seems like other cases are reverting to plain-text, it's specifically the clipboard call.

image

[uri] | Find-Member *escape* | % DisplayString | out-string | Set-Clipboard

7.2.3🐒> $x # also clean
7.2.3🐒> $x = [uri] | Find-Member *escape* | % DisplayString
public static string UnescapeDataString(string stringToUnescape);
public static string EscapeUriString(string stringToEscape);
public static string EscapeDataString(string stringToEscape);
public static string HexEscape(char character);
public static char HexUnescape(string pattern, ref int index);
public bool UserEscaped { get; }

Environment

image

chocolateyProfile: 0.0
ClassExplorer: 2.3.3
Configuration: 1.3.1
dev.nin: 0.0.17
functional: 0.0.4
ninmonkey.console: 0.2.7
Pansies: 2.3.1
pslambda: 0.2.0
PSReadLine: 2.2.0
Utility: 0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions