Skip to content

Pasting multiline code conflicts with parentheses/brackets/brace-matching key handler #735

Closed
@mklement0

Description

@mklement0

Substantially revised after feedback from @SeeminglyScience.

Environment data

PS version: 6.1.0-preview.4
PSReadline version: 2.0.0-beta2
os: Linux vm-ub16 4.4.0-131-generic #157-Ubuntu SMP Thu Jul 12 15:51:36 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
PS file version: 

Steps to reproduce or exception report

If you have a key handler installed that inserts a matching parenthesis/bracket/brace, pasting multiline strings breaks:

{
 'hi'
}

results in:

PS>{}
PS>  'hi'
hi
PS> }
At line:1 char:1
+ }
+ ~
Unexpected token '}' in expression or statement.
+ CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : UnexpectedToken

It seems that pasting triggers the same behaviors as when typing, which is undesired.
That is, the { that is pasted on the first line causes a matching } to be inserted, which breaks the code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions