FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Supporting line wise yanks, including paste and undo. by springcomp · Pull Request #811 · PowerShell/PSReadLine · GitHub

Supporting line wise yanks, including paste and undo. - #811

Merged
Dongbo Wang (daxian-dbw) merged 8 commits into
PowerShell:masterfrom
springcomp:#333
Nov 8, 2019
Merged

Supporting line wise yanks, including paste and undo.#811
Dongbo Wang (daxian-dbw) merged 8 commits into
PowerShell:masterfrom
springcomp:#333

Conversation

Copy link
Copy Markdown
Contributor

This is my take at #333.

I thought best to create a ViRegister class to replace the current _clipboard String because I wanted to support pasting "line wise" irrespective of where the cursor is at when pasting occurs. I created an event that gets raised each time the buffer is about to change as part of a paste operation, to hook into undo/redo without too much coupling.

Please, let me know your thoughts and suggestions for improvements.

Copy link
Copy Markdown
Contributor Author

I updated this pull request via force push using the accepted answer from this question.

Microsoft Contribution License Agreements (msftclas) commented Oct 19, 2019
edited
Loading

Copy link
Copy Markdown


All CLA requirements met.

Jason Shirk (lzybkr) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Sorry it took forever for me to take a look
I have some general comments that need to be addressed and I'll try to take a closer look then, or maybe Dongbo Wang (@daxian-dbw) will beat me to it.

Comment thread PSReadLine/ViRegister.cs Outdated
Comment thread PSReadLine/ViRegister.cs Outdated
Comment thread PSReadLine/ViRegister.cs Outdated
Comment thread PSReadLine/ViRegister.cs Outdated

Copy link
Copy Markdown
Contributor Author

Sorry, I force-pushed again because there was structural changes to address your general comments.
You can now take a closer look.

From now on I will address your feedback with additional commits.

Copy link
Copy Markdown
Contributor Author

This PR still shows changes requested even though I have carried out the changes.
Jason Shirk (@lzybkr) can you please re-review?

Copy link
Copy Markdown
Contributor

It looks like not all of the new tests were run in CI - presumably because test discovery isn't searching Microsoft.PowerShell.PSReadLine2.dll.

I'd like Dongbo Wang (@daxian-dbw) to approve including tests like this before merging.

Maxime Labelle (springcomp) commented Nov 6, 2019
edited
Loading

Copy link
Copy Markdown
Contributor Author

The latest commit adds discovery and execution of thoses unit-tests.

For this purpose, the main module is compiled with an alternate set of options and to a target assembly named Microsoft.PowerShell.PSReadLine2.UnitTests.dll so that it does not conflict with the release assembly.

Dongbo Wang (@daxian-dbw), are you OK with these changes?

Copy link
Copy Markdown
Member

Can we move the test code to PSReadLine.Tests (under PSReadLine\test)? We can make Microsoft.PowerShell.PSReadLine2 internal visible to PSReadLine.Tests.

Maxime Labelle (springcomp) commented Nov 8, 2019
edited
Loading

Copy link
Copy Markdown
Contributor Author

I thought about doing this but was deterred as per Jason Shirk (@lzybkr)’s comment.

I would be happy to go ahead, but I do not know how to handle InternalsVisibleTo and assembly delay-signing?

For this to work, there would need to be a strong-name snk file in the repository for signing both assemblies. The way I handled this in the past was for the owner of the repository to include an encrypted version of the release strong-name snk file in the repository, and use AppVeyor secure strings to decrypt the file during the build.

Would that work for you Dongbo Wang (@daxian-dbw)?

Copy link
Copy Markdown
Member

I don't think InternalsVisibleTo requires the involved assemblies to be strong-name signed. Quoted the following from the doc of this attribute

If both assemblies are unsigned, the assemblyName argument consists of the name of the friend assembly, specified without a directory path or file name extension.

I think you can just add [assembly: InternalsVisibleTo("PSReadLine.Tests")] to PSReadLine\PSReadLine\AssemblyInfo.cs and it should work.

Copy link
Copy Markdown
Contributor Author

I can’t believe I just learned about that fact today 😱😱!

Copy link
Copy Markdown
Member

Thanks Maxime Labelle (@springcomp)!
I made a minor change to move the InternalsVisibleTo declaration to AssemblyInfo.cs, where other assembly scope attributes are put. That change breaks the build and it seems that file gets excluded somehow. I will fix it.

Copy link
Copy Markdown
Member

Build fixed. Maxime Labelle (@springcomp) Could you please review my changes? Thanks!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Yes, that is the reason why I created a separate file but this solution is certainly better.

Copy link
Copy Markdown
Contributor Author

With this PR, I intend to work next on implementing dd (delete line) and, possibly S (substitute line) as natural extensions, so am looking forward to seeing this merged.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL