Sublime Forum

Copy and Paste with hotkeys into PowerShell suddenly ignores newlines

#1

Hello! The topic is simple enough, but basically, it used to be the case that when I copied code from Sublime Text (3) and then pasted it into PowerShell, newlines were preserved. It is suddenly not the case, although if I copy with the context menu instead of ctrl+v, it works as before. Anyone have an idea what I can look into that might have changed this behavior?

0 Likes

#2

Have you tried reverting to a freshly installed state? I assume pasting from other applications preserves newlines, if not then powershell is the most likely culprit.

0 Likes

#3

I have not, I was hoping to try other alternatives before nuking from orbit.

0 Likes

#4

It’s hardly a nuke. You can move the folder and later put it back without losing anything.

0 Likes

#5

Sure, regardless, it would be nice to have a root cause so I know what I’m dealing with rather than just reverting any time a problem shows up.

0 Likes

#6

Generally speaking when someone mentions reverting, it’s a troubleshooting step and not a request that you just throw your configuration away and start fresh.

The first step in determining the root cause is to determine if it’s Sublime, one of the packages you have installed, or something external to both of them that’s causing the problem.

The easiest way to do that is to revert; if the problem still persists, perhaps it is Sublime or the external thing. If the problem goes away, now you know it’s something in your config and you can start digging in to see where.

2 Likes

#7

I was mostly hoping to have more information to work with, and the ideal situation here would be that someone who has run into it before would happen upon the thread and chime in with a “why”. Since that hasn’t happened, I did temporarily revert config, and the problem hasn’t persisted (even after restoring the backup config folder). This does mean it’s solved, for me, at this point in time, but it also means that we can no longer track down a root cause if we’re at all interested in that.

0 Likes

#8

Actually, I spoke too soon–it copies fine into PowerShell, but not into Python’s REPL, so there is some sort of interaction there. It’s also slightly weird into PowerShell. This code in Sublime

class AccessTokenController(object):
    """
    This controller implements section 2.4 on the following document
    """

    def __init__(self, logger, oauth2_handler):
        self.__logger = logger
        self.__oauth2_handler = oauth2_handler

gets pasted like this into PowerShell

    """
    This controller implements section 2.4 on the following document
        """

    def __init__(self, logger, oauth2_handler):
        self.__logger = logger
        self.__oauth2_handler = oauth2_handler
class AccessTokenController(object):

After noticing the above I reverted again and did confirm that this behavior does not persist while config is reverted. It also happens in both Python 3 and Python 2 REPLs, identically.

0 Likes

#9

For the record, disabling this package put the behavior back: https://packagecontrol.io/packages/CopyEdit

There was some time between installing that and noticing the paste behavior, so I didn’t connect the two even though it seems obvious in retrospect. I’ve filed an issue with the package maintainer so presumably things will go (or not) from there.

0 Likes