-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
Handle pasting code from column selection specially #5940
Comments
+1 |
+1
to
[when the line count, text length/complexity high it is an essential feature in a code editor of substance as many others have commented in the original column select issue] |
+1 |
Paste the column has been support,cool ,
|
@chen56 not following, still isn't working, version 1.10.1 |
I would definitely like this feature. There was some talk of it in #1515 but that issue seems to have been closed before it was resolved. |
so, we're on 1.18.1 and this is still not working as intended =( |
Looking forward to this feature |
I don't get it-- what's the point of rectangular selection if you can't paste a rectangular selection into other code? This has been a useful feature of Visual Studio editors since Visual C++ in the early '90s. |
Assignment removal 21 days ago, that's unfortunate. |
I'd like to see this feature work just like VS and Notepad++. Until it does, column/block copy is pretty much useless. |
+1 |
+1 |
+1 I regularly use and need this feature. Please implement. |
This was not immediately obvious to me, so it may help other people to know this. While not an ideal solution, you can easily paste columns by creating a new column selection and pasting into that.
|
In the case you would be surprised like me, pbb72's solution only works if you select the same exact number of lines between the copied selection and the target selection! So for example, if you copy 3 lines from column selection, and then try to paste it on 4 lines, instead of pasting on the 3 first lines, it will create a mess (copy the full selection on each line). Coming from Intellij IDEs it's quite surprising for me. Would be good to support it on Vscode. |
If someone on the vscode team could polish this feature, that would be greatly appreciated. |
More examples of this problem can be found here: #43145 |
This even works in TextEdit on Mac (default built-in editor)... |
It actually used to work for me, but was broken now. |
Just encountered this again, and note that even though pasting columns has since been implemented, it only seems to work correctly for equal line counts. Pasting a mismatching number of lines still causes the inconvenience described above. |
I think the way this is performed in VSCode is a frustrating UX. But, it does work. The only way I could get it to copy a rectangle or columns is:
et voila In the destination, if the top-right is in the same column as the bottom right, you can see how many rows are selected in the bottom status bar to the right of the spaces per tab and the encoding (e.g. UTF-8) |
@peteraritchie Nope. Well actually yes it can work in limited circumstances, provided neither the block you're cutting and the destination location don't extend beyond the end of any lines between the start and end of selection. When that's the case, the number of rows selected in the source won't include the blank lines, which you would want to be treated as blank lines in the block. The only way that it will work is if virtual whitespace is treated explicitly. |
Meanwhile, this might solve some of your headaches. The author just added an option to replicate the current line white space. john-guo/columnpaste#5 |
Could someone explain to me the extent of this issue? Is this (#5940) and #13960 working with tabs and other multi-width characters in the same way, virtual navigation? Do these issues propose multi-width whitespace to be filled up with "virtual spaces"? I mean, being able to navigate (or click) INTO multi-space whitespace like tabs (or stretched character space) and being able to input characters there, and inserting physical space when necessary. I know, some people will complain about using spaces for this case but this is not the point. A tab character is a control character. Space is not a control character. I mean control characters for a future, where people wouldn't hard-code visual presentation anymore inside code because tools would be doing it automatically. I would even consider virtual space to be some sort of control character but which is not serialized. An extension could treat the tab character as an instruction for the renderer to align characters behind the tab (or double tab) character in consecutive lines with virtual spaces. These virtual spaces may be copied, pasted as physical or virtual spaces but not saved to the file. Instead of fixed modulo behaviour the tab would be of dynamic length depending on context. When being split by a typed character, only the left part would be filled with physical spaces. An extension, which would like to implement that, would require multi-width characters to be filled with virtual spaces automatically, also so that people can navigate in virtual coordinates instead of physical unicode characters stored in the text. |
#1515 (comment)
From @seva0stapenko
Tried column selection in VSCode 1.0. Well, rectangular selection does work, cutting and pasting back also works, but that's about it.
Cutting and pasting into a different part of the code does not work as expected. Both Notepad++ and VS remember that copied text was a rectangular block and paste it as a rectangular block.
VSCode treats copied block just like a regular text, so pasting it anywhere outside of the current multi-cursor context would create a mess.
It's good that the feature is being worked on, but it's not fully baked yet.
Addition from @hediet
This is (still) the current behavior of VS Code. The copied/pasted text matches the selection:
However, the copied/pasted text should match this selection:
See also #43145 for how other editors handle it.
The text was updated successfully, but these errors were encountered: