Copy & Paste only Pasting ONE Line

I've been using Keyboard Maestro 11 for about a month on my new MacBook Pro M4 Pro (Sequoia 15.5 (24F74). Yesterday, I noticed that when I tried to Copy & Paste blocks of text, only the first line will paste into my document. I was able to work around it and it seemed to eventually clear up. Today (after rebooting at start-up), Copy & Paste was functioning fine, until it wasn't. Suddenly, it reverted back to the one-line behavior. I decided to launch the Clipboard History Switcher, and I saw that the entirety of the copied text is there, even though only the first line would paste. I was able to drag the entry of the copied entry into my document, though all the formatting was gone. What's going on?

Not sure. I've never seen this behavior before. Does it make a difference what app you're pasting into?

It was a few different apps. When the problem started, I was in Chrome (latest build) copying some AppleScript that Claude generated for a KM Macro (ironic, huh?). I pasted it into an Execute AppleScript Action and noticed that only part of one line (in this instance, a

tag) was pasting into the text box. Nothing else made it. I tried a few times, then switched to different apps (an MS Outlook email, Apple Notes, TextEdit, Stickies) to see if the behavior would repeat, and it did. The real weird thing is it's intermitttant. Sometimes it C&P works fine. Sometimes it doesn't.

Copy and Paste how? In what way is Keyboard Maestro involved? Is it involved, or might this be something else entirely?

2 Likes

I wonder if the remaining lines were hidden off to the right ?

If the copied source has a different line delimiter (\r is a common alternative to the expected \n and "Claude" may copying from (cough... approximately retrieving from ... a Windows source, or assuming a Windows client))
then in a macOS context you may see a single (very) long line, rather than a series of delimited lines.

The solution, if you are putting yourself down-stream of a lot of reconstituted mulch from a Claude hose-pipe, or material generated on Windows systems, will be to automatically run a clipboard cleaner, normalizing to \n, and perhaps pruning out multiple white space sequences.

Yes, although it seems, from what @NealWiser writes, that Keyboard Maestro is involved, it might be worth turning its Engine off if there is any doubt about that (see ‘File > Quit Engine` in Keyboard Maestro). Find out whether the unexpected behaviour continues, and then of course, turn the Engine back on so you can continue using KM.

Also, @NealWiser, try Help > Interactive Help if you have not already done so, and follow the Wiki’s guide on troubleshooting.

Were you using the standard MacOS shortcuts (hotkeys) to do that? If so, have you perhaps reassigned ⌘-V for use with a macro? Check for ⌘-C too. (Reassigning such common shortcuts to macros can be used to enhance copy and paste behaviour for one’s needs, but one has to be fully aware of what the macros are doing. :wink:)

Do any of your macros interact with clipboard history?

In short: you (or we, if you report the results of your experiments here) need to narrow down the possible reasons for the problem.

If you are able to narrow the problem down to just one macro, and need help with it, post the macro in a reply to this topic.

Good luck with your testing and let us know how you get on.

2 Likes

Thanks for everyone's help. While I was away for the weekend, I haven't noticed the behavior returning (for now). I'll keep my eyes open if it recurs.
@kevinb I didn't think of quitting the engine. I'll definitely try that if/when it happens again. Also:

  • I haven't changed the Copy/Paste Mac shortcuts.
  • While it occurred while trying to create a specific Keyboard Maestro macro, it wasn't one that interacts with the clipboard history, and I don't have any that do.
    @Nige_S I assumed Keyboard Maestro is involved because the error occurred when using keyboard shortcuts as I was working on another keyboard shortcut, and was able to get partial resolution by finding the content I was cutting and pasting in the Keyboard Maestro Clipboard History. While correlation is not causation, it's the logical first place to start.
    @ComplexPoint No, nothing was hidden off screen (I did look).
1 Like

If you suspect Keyboard Maestro, the best first place to start is the Engine Log (~/Library/Logs/Keyboard Maestro/Engine.log, also available via the Editor's Help menu then the "Open Logs Folder" menu item). That'll show you which, if any, macros have triggered -- much quicker than checking all your macros for any reference to the Clipboard.

If it is KM then there's at least three ways this could be happening:

  1. When you Copy with ⌘C a macro is triggered that does the Copy and then sets the System Clipboard to only the first line of the text
  2. When you Paste with ⌘V a macro is triggered that sets the System Clipboard to the first line of the System Clipboard, then Pastes
  3. You have a macro with a "Clipboard Changed Trigger" that executes when the System Clipboard changes, and sets the Clipboard to the first line of the Clipboard

Any of the above may only be active when certain apps are frontmost, may be enabled/disabled by another macro, etc. -- that may be why the problem is intermittent.

They don't have to -- they'd interact with the System Clipboard itself. There is only one System Clipboard; the History is KM's record of previous states and yes, when a macro changes the System Clipboard the previous Clipboard is added to the top of the History stack.

1 Like