microsoft / terminal

The new Windows Terminal and the original Windows console host, all in the same place!
MIT License
95.43k stars 8.3k forks source link

Unexplained crash while copying with the terminal #2000

Closed zyyBjtu closed 5 years ago

zyyBjtu commented 5 years ago

You can't copy and paste with windows terminal. Normally you can paste and copy with the right mouse button, but at some point it will cause terminal to crash.

zadjii-msft commented 5 years ago

There were a couple bugfixes in this area recently. What build of Windows Terminal are you running?

What steps are you taking to get the terminal to crash while selecting?

@carlos-zamora may be interested.

QuantumZain commented 5 years ago

I also have the same issue unable to copy from cmd nor paste to it, but instead of crashing, it outputs: ^V for Ctrl + V. where as for Ctrl + C (when selecting text) it performs the same behavior when text isn't selected

ellie-idb commented 5 years ago

@QuantumZain I believe that's done intentionally see: https://github.com/microsoft/terminal/blob/9b92986b49bed8cc41fde4d6ef080921c41e6d9e/src/host/input.cpp#L112-L129

A simple check if IsSelectionActive() would fix this, but in most cases you would prefer NOT to break interrupting (since Ctrl+C is effectively sending a SIGINT). Try rebinding to Ctrl+Shift+C/Ctrl+Shift+V instead.

breakid commented 5 years ago

Copy/paste works in the version currently on the Windows Store (as of 2019-07-21; 0.2.1831.0), you just don't use CTRL+C/V. Highlight the text you want to copy, then right click; it will automatically copy. Then right-click again to paste in the Terminal or CTRL+V in your other application of choice.

I assume this was done intentionally as PuTTY and various other Linux terminals use the same mechanic.

ghost commented 5 years ago

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

LongLiveCHIEF commented 5 years ago

I'm experiencing this issue as well, running 0.2.1831.0. I'll try to update to latest build and see if it resolves issue.

LongLiveCHIEF commented 5 years ago

n/m, 1831 is the latest build.

LongLiveCHIEF commented 5 years ago

specific action I'm trying to do is copy from system clipboard into vim that's open in WSL2 Ubuntu.

DHowett-MSFT commented 5 years ago

You can do that with right click. Is it crashing? Do you have any events about "Windows Error Reporting" in your event log? If so, please share: they contain vital information that we can use to find your crash.

mdx0111 commented 5 years ago

Would CTRL+Shift+C and CTRL+Shift+V be good candidates to be added to perform Copy and Paste please?

zadjii-msft commented 5 years ago

They already are the keybindings, as of #1093.

I'd really like to see a stack or some info to help us track down the source of the crash reported in OP. Without more info,there's nothing more we can really do with this issue.

mdx0111 commented 5 years ago

Thanks for your reply.

I'm on the latest release but the CTRL+Shift+C and CTRL+Shift+V don't work for me at all to do copy/paste. Having said that, I tried copy/paste via mouse clicks a lot and never encountered any issues.

miniksa commented 5 years ago

The only part here we're actively still looking for is information on the crash that @zyyBjtu experienced.

The issues with the keybindings are getting resolved in other PRs and in the upcoming 0.3 release.

We want to know more about this crash.

darkmacheken commented 5 years ago

Just to know, currently, is there any keybinding to copy and paste using the terminal? Will it be possible to change the keybindings to copy and paste text in the profiles.json? Also, I've randomly been experiencing some crashes using the windows clipboard using tmux and vim, where clip.exe crashes with error code 0xc0000142. As it is random I didn't find any probable cause, so, haven't open an issue yet.

mikeymop commented 5 years ago

Ctrl+C is problematic because ^c is an interrupt signal.

However I also observed that selection is copy, and right click is paste. I believe here having the native windows right click context menu would be nice.

duydao commented 5 years ago

@pedrodaniel10 Ctrl+Chift+C / Ctrl+Chift+V works for me

darkmacheken commented 5 years ago

@pedrodaniel10 Ctrl+Chift+C / Ctrl+Chift+V works for me

Yes, that got into v0.3

devstu commented 5 years ago

I would like to see customizable key commands for copy and paste. GitBash uses Ctrl+Ins and Shift+Ins and it seems pretty universal in a lot of apps.

DHowett-MSFT commented 5 years ago

@devstu you must mean the new customizable key bindings for copy and paste that went into v0.3?

devstu commented 5 years ago

I am sorry I found it now, it wasn't in the default keybindinds, but I added one for copy and paste and it worked. Thank you, sorry.

ghost commented 5 years ago

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

visceralfield commented 5 years ago

I am still experiencing this crash. When I right-click to copy text from a Powershell instance in Windows Terminal, I get the loading ring cursor for a few seconds, the window closes, and nothing is copied to my clipboard. Where should I look to get the relevant logs for debugging this issue?

visceralfield commented 5 years ago

This is the Event Viewer data for the crash:

Faulting application name: WindowsTerminal.exe, version: 1.0.1908.26002, time stamp: 0x5d641823
Faulting module name: CoreMessaging.dll, version: 10.0.18362.1, time stamp: 0x101a45b8
Exception code: 0xc000027b
Fault offset: 0x000000000005fe7e
Faulting process id: 0x2dd0
Faulting application start time: 0x01d56724c022ac87
Faulting application path: C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_0.4.2382.0_x64__8wekyb3d8bbwe\WindowsTerminal.exe
Faulting module path: C:\Windows\System32\CoreMessaging.dll
Report Id: 4003ef47-2e4f-45dd-bf0a-42c998a95924
Faulting package full name: Microsoft.WindowsTerminal_0.4.2382.0_x64__8wekyb3d8bbwe
Faulting package-relative application ID: App
visceralfield commented 5 years ago

And this is the associated Report.wer:

Report.zip

tolache commented 1 year ago

My terminal crashes upon pasting a string. I have an Even 1000 from Application Error:

Faulting application name: WindowsTerminal.exe, version: 1.15.2210.14005, time stamp: 0x6349fd20
Faulting module name: windows.applicationmodel.datatransfer.dll, version: 10.0.22621.1, time stamp: 0xd1b91d78
Exception code: 0xc0000005
Fault offset: 0x0000000000065009
Faulting process id: 0x0x3DC4
Faulting application start time: 0x0x1D8F8E77C39BCAB
Faulting application path: C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.15.2875.0_x64__8wekyb3d8bbwe\WindowsTerminal.exe
Faulting module path: C:\Windows\System32\windows.applicationmodel.datatransfer.dll
Report Id: 536af586-d6e2-4e58-a5c8-5bcf020c20b9
Faulting package full name: Microsoft.WindowsTerminal_1.15.2875.0_x64__8wekyb3d8bbwe
Faulting package-relative application ID: App

and an Event 1026 from .NET Runtime:

Application: pwsh.exe
CoreCLR Version: 7.0.22.51805
.NET Version: 7.0.0
Description: The process was terminated due to an unhandled exception.
Exception Info: System.InvalidOperationException: Cannot read keys when either application does not have a console or when console input has been redirected. Try Console.Read.
   at System.ConsolePal.ReadKey(Boolean intercept)
   at Microsoft.PowerShell.Internal.VirtualTerminal.ReadKey()
   at Microsoft.PowerShell.PSConsoleReadLine.ReadOneOrMoreKeys()
   at Microsoft.PowerShell.PSConsoleReadLine.ReadKeyThreadProc()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
zadjii-msft commented 1 year ago

@tolache This is a 3 year old stale issue about an unexplained crash while copying text. You should probably file a new issue, so we can triage your issue to its own root cause.

tolache commented 1 year ago

14412, for anyone else who finds this.