Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PastePlain] Introduce Paste as Plain Text module #23645

Merged
merged 29 commits into from
Feb 23, 2023

Conversation

carlos-zamora
Copy link
Member

@carlos-zamora carlos-zamora commented Jan 27, 2023

Summary of the Pull Request

Introduces the "Paste as Plain Text" module which allows the user to paste their most recent clipboard content as plain text (as opposed to formatted text).

PR Checklist

  • Closes: Paste as plain text #1684
  • Communication: I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected
  • Tests: Added/updated and all pass
  • Localization: All end user facing strings can be localized
  • Dev docs: Added/updated
  • New binaries: Added on the required places
  • Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx

Detailed Description of the Pull Request / Additional comments

This is heavily based on the work done for the "Text Extractor" module then ripping out anything that may be unnecessary. The same KeyboardMonitor is implemented and used. The interesting logic really falls inside the KeyboardMonitor as that is where the clipboard is opened/read/modified, then a ctrl+v input sequence is injected.

The default key binding for this will be ctrl+win+v.

Validation Steps Performed

  • works with win+shift+v
  • settings UI added and updated
  • added to "welcome to powertoys"
  • tested with rebinded keys

@github-actions

This comment has been minimized.

Copy link
Member Author

@carlos-zamora carlos-zamora left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Questions/Comments

  • Need to replace the PastePlainLogo with an actual new icon
    • requested resources from Ethan in an email thread. I'll update them on the PR once I get them.
  • Need to figure out telemetry
    • just need to figure out how to track enablement/disablement. Probably easier once I update the settings UI Yup, it was in there.
  • Need to fix Ctrl+Win+V not working
    • so, when I first implemented this, I thought the keybinding was supposed to be Win+Shift+V. I went back and tried to replace Win+Shift+V with Ctrl+Win+V at the end, but it seems to not be working. Idk where that's set up. Any ideas?
    • EDIT: fixed! the win+shift+v was written to the settings.json. As expected, if you delete the settings.json, it'll revert it back to the default value of ctrl+win+v (as desired).
  • if you see any Text Extractor references, let me know. Probably missed them.
  • It seems like the first time I do the keybinding, it doesn't work (or it has a decent delay). Not sure if this is due to debug mode. I'll keep an eye out for that as we move forward. Totally possible I did something wrong.
    • EDIT: seems to be due to debug mode. Resolving.

Comment on lines 48 to 49
// TODO CARLOS: I just used a new GUID here. I don't know if this is the right way to do it.
const wchar_t SHOW_PASTEPLAIN_SHARED_EVENT[] = L"Local\\PastePlainEvent-57dc5a03-20b4-423b-aa5c-574e809d95a7";
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Want to bring attention to this. Let me know if the guid should be generated/inserted in a specific way. I just generated a new one using VS.

Comment on lines +234 to +237
inline gpo_rule_configured_t getConfiguredPastePlainEnabledValue()
{
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_PASTE_PLAIN);
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any way I can test this and make sure I did it right?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@carlos-zamora
I think the only way to test it is by setting the registry key manually.

@@ -0,0 +1,1211 @@
// Copyright (c) Microsoft Corporation
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a big file. Had to introduce a lot of stuff to get SendInput() to work (particularly to define what an INPUT is).

_activationShortcutPressed = true;
e.Handled = true;
{
var data = Clipboard.GetContent();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This here is really the interesting part of the PR. 😉

{
var package = new DataPackage();
package.SetText(text);
if (Clipboard.SetContentWithOptions(package, new ClipboardContentOptions() { IsAllowedInHistory = false, IsRoamable = false }))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idk if we want to make IsRoamable configurable? 🤷

@davidegiacometti
Copy link
Collaborator

Hi @carlos-zamora

Love this! Very useful!

  • There are a few references to PowerOCR in PastePlainModuleInterface.vcxproj. Wasn't able to build before fix them.
  • I think KeyboardMonitor.cs should be started only where running detatched from PowerToys runner (VS debug) and use Low Level Keyboard Hook when launched under the runner. ColorPicker and PowerOCR are designed this way.
  • WIN+SHIFT+V should work with PowerToys Low Level Keyboard Hook since I am able to use it as activation for other utilities.

@crutkas
Copy link
Member

crutkas commented Jan 29, 2023

So 🔥

Copy link
Collaborator

@snickler snickler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting ready to test it out, but here are changes I had to make in order for compilation :)

@snickler
Copy link
Collaborator

Tested and verified that it pastes rich text as plain text using Ctrl+Win+V. \o/

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@carlos-zamora
Copy link
Member Author

Updated the settings UI and OOBE, but when I try to deploy the settings UI project I get a popup saying "The application cannot be run as a standalone process. Please start the application through the runner.".

How can I validate the settings UI and OOBE?

@htcfreek
Copy link
Collaborator

htcfreek commented Jan 31, 2023

Updated the settings UI and OOBE, but when I try to deploy the settings UI project I get a popup saying "The application cannot be run as a standalone process. Please start the application through the runner.".

How can I validate the settings UI and OOBE?

Option 1
You can build the settings ui as standalone project in debug mode. Then you can start debugging the settings project. The message box can be closed using the X. (Don't close it using the "text" button.)

Option 2
Build the complete solution and start the PowerToys (tray) exe.

@carlos-zamora
Copy link
Member Author

Weird. "Paste as Plain Text" won't pop up in the settings UI when I deploy PowerToys.Settings.

If I try to build the complete solution, the "Hosts" project fails:

Build log for failure in Hosts project
Build started...
1>------ Build started: Project: Hosts (modules\Hosts\Hosts), Configuration: Debug x64 ------
1>C:\Program Files\dotnet\sdk\7.0.100-preview.7.22377.5\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.RuntimeIdentifierInference.targets(219,5): message NETSDK1057: You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error :
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error : Unhandled Exception: System.NotImplementedException: The method or operation is not implemented.
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error :    at Microsoft.CodeAnalysis.CommonCompiler.LoggingMetadataFileReferenceResolver.GetHashCode()
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error :    at Roslyn.Utilities.Hash.Combine[T](T newKeyPart, Int32 currentKey)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error :    at Microsoft.CodeAnalysis.CompilationOptions.GetHashCodeHelper()
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error :    at Microsoft.CodeAnalysis.CSharp.CSharpCompilationOptions.ComputeHashCode()
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error :    at Microsoft.CodeAnalysis.CompilationOptions.GetHashCode()
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error :    at System.Collections.Generic.ObjectEqualityComparer`1.GetHashCode(T obj)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error :    at System.Collections.Generic.HashSet`1.InternalGetHashCode(T item)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error :    at System.Collections.Generic.HashSet`1.AddIfNotPresent(T value)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error :    at Microsoft.CodeAnalysis.InputNode`1.UpdateStateTable(Builder graphState, NodeStateTable`1 previousTable, CancellationToken cancellationToken)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error :    at Microsoft.CodeAnalysis.DriverStateTable.Builder.GetLatestStateTableForNode[T](IIncrementalGeneratorNode`1 source)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error :    at Microsoft.CodeAnalysis.TransformNode`2.UpdateStateTable(Builder builder, NodeStateTable`1 previousTable, CancellationToken cancellationToken)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error :    at Microsoft.CodeAnalysis.DriverStateTable.Builder.GetLatestStateTableForNode[T](IIncrementalGeneratorNode`1 source)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error :    at Microsoft.CodeAnalysis.CombineNode`2.UpdateStateTable(Builder graphState, NodeStateTable`1 previousTable, CancellationToken cancellationToken)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error :    at Microsoft.CodeAnalysis.DriverStateTable.Builder.GetLatestStateTableForNode[T](IIncrementalGeneratorNode`1 source)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error :    at Microsoft.CodeAnalysis.TransformNode`2.UpdateStateTable(Builder builder, NodeStateTable`1 previousTable, CancellationToken cancellationToken)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error :    at Microsoft.CodeAnalysis.DriverStateTable.Builder.GetLatestStateTableForNode[T](IIncrementalGeneratorNode`1 source)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error :    at Microsoft.CodeAnalysis.CombineNode`2.UpdateStateTable(Builder graphState, NodeStateTable`1 previousTable, CancellationToken cancellationToken)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error :    at Microsoft.CodeAnalysis.DriverStateTable.Builder.GetLatestStateTableForNode[T](IIncrementalGeneratorNode`1 source)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error :    at Microsoft.CodeAnalysis.TransformNode`2.UpdateStateTable(Builder builder, NodeStateTable`1 previousTable, CancellationToken cancellationToken)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error :    at Microsoft.CodeAnalysis.DriverStateTable.Builder.GetLatestStateTableForNode[T](IIncrementalGeneratorNode`1 source)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error :    at Microsoft.CodeAnalysis.TransformNode`2.UpdateStateTable(Builder builder, NodeStateTable`1 previousTable, CancellationToken cancellationToken)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error :    at Microsoft.CodeAnalysis.DriverStateTable.Builder.GetLatestStateTableForNode[T](IIncrementalGeneratorNode`1 source)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error :    at Microsoft.CodeAnalysis.CombineNode`2.UpdateStateTable(Builder graphState, NodeStateTable`1 previousTable, CancellationToken cancellationToken)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error :    at Microsoft.CodeAnalysis.DriverStateTable.Builder.GetLatestStateTableForNode[T](IIncrementalGeneratorNode`1 source)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error :    at Microsoft.CodeAnalysis.TransformNode`2.UpdateStateTable(Builder builder, NodeStateTable`1 previousTable, CancellationToken cancellationToken)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error :    at Microsoft.CodeAnalysis.DriverStateTable.Builder.GetLatestStateTableForNode[T](IIncrementalGeneratorNode`1 source)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error :    at Microsoft.CodeAnalysis.TransformNode`2.UpdateStateTable(Builder builder, NodeStateTable`1 previousTable, CancellationToken cancellationToken)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error :    at Microsoft.CodeAnalysis.DriverStateTable.Builder.GetLatestStateTableForNode[T](IIncrementalGeneratorNode`1 source)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error :    at Microsoft.CodeAnalysis.BatchNode`1.UpdateStateTable(Builder builder, NodeStateTable`1 previousTable, CancellationToken cancellationToken)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error :    at Microsoft.CodeAnalysis.DriverStateTable.Builder.GetLatestStateTableForNode[T](IIncrementalGeneratorNode`1 source)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error :    at Microsoft.CodeAnalysis.CombineNode`2.UpdateStateTable(Builder graphState, NodeStateTable`1 previousTable, CancellationToken cancellationToken)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error :    at Microsoft.CodeAnalysis.DriverStateTable.Builder.GetLatestStateTableForNode[T](IIncrementalGeneratorNode`1 source)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error :    at Microsoft.CodeAnalysis.SourceOutputNode`1.UpdateStateTable(Builder graphState, NodeStateTable`1 previousTable, CancellationToken cancellationToken)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error :    at Microsoft.CodeAnalysis.DriverStateTable.Builder.GetLatestStateTableForNode[T](IIncrementalGeneratorNode`1 source)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error :    at Microsoft.CodeAnalysis.SourceOutputNode`1.AppendOutputs(IncrementalExecutionContext context, CancellationToken cancellationToken)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error :    at Microsoft.CodeAnalysis.GeneratorDriver.UpdateOutputs(ImmutableArray`1 outputNodes, IncrementalGeneratorOutputKind outputKind, Builder generatorRunStateBuilder, CancellationToken cancellationToken, Builder driverStateBuilder)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error :    at Microsoft.CodeAnalysis.GeneratorDriver.RunGeneratorsCore(Compilation compilation, DiagnosticBag diagnosticsBag, CancellationToken cancellationToken)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error :    at Microsoft.CodeAnalysis.GeneratorDriver.RunGeneratorsAndUpdateCompilation(Compilation compilation, Compilation& outputCompilation, ImmutableArray`1& diagnostics, CancellationToken cancellationToken)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error :    at Microsoft.CodeAnalysis.CommonCompiler.RunGenerators(Compilation input, ParseOptions parseOptions, ImmutableArray`1 generators, AnalyzerConfigOptionsProvider analyzerConfigOptionsProvider, ImmutableArray`1 additionalTexts, DiagnosticBag generatorDiagnostics)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error :    at Microsoft.CodeAnalysis.CommonCompiler.CompileAndEmit(TouchedFileLogger touchedFilesLogger, Compilation& compilation, ImmutableArray`1 analyzers, ImmutableArray`1 generators, ImmutableArray`1 additionalTextFiles, AnalyzerConfigSet analyzerConfigSet, ImmutableArray`1 sourceFileAnalyzerConfigOptions, ImmutableArray`1 embeddedTexts, DiagnosticBag diagnostics, CancellationToken cancellationToken, CancellationTokenSource& analyzerCts, AnalyzerDriver& analyzerDriver, Nullable`1& generatorTimingInfo)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error :    at Microsoft.CodeAnalysis.CommonCompiler.RunCore(TextWriter consoleOutput, ErrorLogger errorLogger, CancellationToken cancellationToken)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error :    at Microsoft.CodeAnalysis.CommonCompiler.Run(TextWriter consoleOutput, CancellationToken cancellationToken)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error :    at Microsoft.CodeAnalysis.CSharp.CommandLine.Csc.<>c__DisplayClass1_0.<Run>b__0(TextWriter tw)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error :    at Microsoft.CodeAnalysis.CommandLine.ConsoleUtil.RunWithUtf8Output[T](Func`2 func)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error :    at Microsoft.CodeAnalysis.CSharp.CommandLine.Csc.Run(String[] args, BuildPaths buildPaths, TextWriter textWriter, IAnalyzerAssemblyLoader analyzerLoader)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error :    at Microsoft.CodeAnalysis.CommandLine.BuildClient.RunLocalCompilation(String[] arguments, BuildPaths buildPaths, TextWriter textWriter)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error :    at Microsoft.CodeAnalysis.CommandLine.BuildClient.RunCompilation(IEnumerable`1 originalArguments, BuildPaths buildPaths, TextWriter textWriter, String pipeName)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error :    at Microsoft.CodeAnalysis.CommandLine.BuildClient.Run(IEnumerable`1 arguments, RequestLanguage language, CompileFunc compileFunc, CompileOnServerFunc compileOnServerFunc)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error :    at Microsoft.CodeAnalysis.CSharp.CommandLine.Program.MainCore(String[] args)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error :    at Microsoft.CodeAnalysis.CSharp.CommandLine.Program.Main(String[] args)
1>Done building project "Hosts.csproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 7 up-to-date, 0 skipped ==========

But I get the same issue when building the solution off of main, so I'm guessing I'm doing something wrong here. The unit tests for Hosts is also failing, but that's less surprising.

Any ideas how to fix this?

@davidegiacometti
Copy link
Collaborator

@carlos-zamora thats awkward 😓
Main branch on CI build.. May be related to preview VS? Are you up to date?

Are Hosts tests failing or not building? I am confused since Hosts doesn't build.
In case of failed tests, can you please share the result?

@snickler
Copy link
Collaborator

snickler commented Jan 31, 2023

\7.0.100-preview.7.22377.5

@carlos-zamora Update that .NET 7 SDK to 7.0.102 ;). You're still running the .NET 7 Preview 7 SDK.

@carlos-zamora
Copy link
Member Author

\7.0.100-preview.7.22377.5

@carlos-zamora Update that .NET 7 SDK to 7.0.102 ;). You're still running the .NET 7 Preview 7 SDK.

Yup, that fixed the build for me. Thanks!

Still not seeing Paste As Plain Text pop up in the settings UI or the OOBE though. I was hoping this would fix it. Any ideas?

@jaimecbernardo
Copy link
Collaborator

Hi @carlos-zamora ,
Thanks for the contribution!
I've added a commit to add the navigation items to the Settings and OOBE Navigation menu so you can see it in Settings :)
Hope this helps.

@jaimecbernardo
Copy link
Collaborator

Added another commit to add Paste as Plain text to the new quick access flyout as well :)

@jaimecbernardo
Copy link
Collaborator

Regarding the feature itself, doesn't seem to be working for me when I start PowerToys. Is it supposed to work out of the box?

@carlos-zamora
Copy link
Member Author

Regarding the feature itself, doesn't seem to be working for me when I start PowerToys. Is it supposed to work out of the box?

Thank you!! Yeah this is weird. It works when I'm debugging the feature itself, but it looks like when I have the settings app open, it won't actually enable/disable it. Probably something I messed up in the settings app. Investigating.

@carlos-zamora
Copy link
Member Author

Still didn't manage to fix that PastePlain isn't running via the runner/settings app. I did find a few places I missed though, but no luck.

When I run the runner, I get this:
image

settings_window.cpp::ESettingsWindowNames_from_string() is given an empty string and we hit that assert. I figured I should add PastePlain as a case in the function, but it's weird that it's just getting an empty string. Clint suggested setting a breakpoint in dllmain.cpp::launch_process() but we don't even get that far. Any suggestions on how to debug this further? Maybe some common traps people hit when adding a new module?

Another thing on my radar now is that I need to update the Product.wxs, but Clint said that there have been changes to how to handle that since the PowerOCR PR merged back in August. Any PRs you can send me way to know how to update it properly?

@htcfreek
Copy link
Collaborator

htcfreek commented Feb 1, 2023

Still didn't manage to fix that PastePlain isn't running via the runner/settings app. I did find a few places I missed though, but no luck.

When I run the runner, I get this:
image

settings_window.cpp::ESettingsWindowNames_from_string() is given an empty string and we hit that assert. I figured I should add PastePlain as a case in the function, but it's weird that it's just getting an empty string. Clint suggested setting a breakpoint in dllmain.cpp::launch_process() but we don't even get that far. Any suggestions on how to debug this further? Maybe some common traps people hit when adding a new module?

The assertion thing is a known bug that happens only when PT was build in debug mode: #15139 => #15139 (comment)

@htcfreek
Copy link
Collaborator

htcfreek commented Feb 1, 2023

Another thing on my radar now is that I need to update the Product.wxs, but Clint said that there have been changes to how to handle that since the PowerOCR PR merged back in August. Any PRs you can send me way to know how to update it properly?

@jaimecbernardo can you help here?

@crutkas
Copy link
Member

crutkas commented Feb 22, 2023

is this getting near ready to merge in? :)

@jaimecbernardo
Copy link
Collaborator

is this getting near ready to merge in? :)

Yes, Almost done with the wrap up. Will need a review after that, though ;)

@jaimecbernardo jaimecbernardo marked this pull request as ready for review February 22, 2023 13:30
@jaimecbernardo
Copy link
Collaborator

All wrapped up and ready to review!

@github-actions

This comment has been minimized.

@jaimecbernardo
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@crutkas crutkas added the Needs-Review This Pull Request awaits the review of a maintainer. label Feb 22, 2023
Copy link
Collaborator

@stefansjfw stefansjfw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, works good! Nice job!

One note: when I want to paste something a few times in a row using standard Ctrl+V, I'd hold Ctrl and pres V a few times. I'd expect this to work the same, but it doesn't. I have to press the entire hotkey all over. Is that intended?

@jaimecbernardo
Copy link
Collaborator

Looks good, works good! Nice job!

One note: when I want to paste something a few times in a row using standard Ctrl+V, I'd hold Ctrl and pres V a few times. I'd expect this to work the same, but it doesn't. I have to press the entire hotkey all over. Is that intended?

Thanks for the review.
We're sort of clearing the modifier keys, in order to simulate Ctrl+V. Might make sense to reinstate those 🤔 . The main issue with trying to restore it is that the user might have unpressed one of the keys asynchronously and that would lead to a "sticky key" situation.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This image is 3041 x 3443 where every other image in the folder is 36 x 36. It also makes the icon in the UI unclear.
image

@crutkas crutkas deleted the dev/cazamor/paste-as-plain-text branch March 24, 2023 17:13
@carlos-zamora carlos-zamora restored the dev/cazamor/paste-as-plain-text branch May 5, 2023 05:21
@crutkas crutkas deleted the dev/cazamor/paste-as-plain-text branch May 18, 2023 20:06
BLM16 pushed a commit to BLM16/PowerToys that referenced this pull request Jun 22, 2023
* [PastePlain] Introduce Paste as Plain Text module

* fix build

* add telemetry

* update settings UI

* spell

* Add navigation items to Settings and OOBE

* Add PastePlain to the Quick Access flyout

* try to fix PastePlain not being enabled from runner/settings

* load dll properly

* installer files

* Add PastePlain project name

* Use win32 APIs in the module interface instead

* Fix spellcheck

* Fix build errors

* Add success, error and invoke telemetry

* Add Settings Telemetry

* Add GPO definitions

* Fix analyzer errors

* Use static_cast instead of reinterpret_cast

* Add images to Settings

* Add note about replacing clipboard contents

* Fix learn more text

* Add link to readme

* Remove unneeded C# app

* Fix installer

* Fix spellchecker

---------

Co-authored-by: Jaime Bernardo <jaime@janeasystems.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs-Review This Pull Request awaits the review of a maintainer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants