There needs to be a way to copy/cut & paste a vertical block of text. Useful
for table manipulation. This is a feature I use all the time in Visual Cafe but
there is no equivalent in netbeans.
I'm moving issue to editor module. I'm not sure what is the
"sourceeditor" module good for. (it appeared after migration to
*** Issue 13967 has been marked as a duplicate of this issue. ***
Changing subcomponent to "clipboard"
I'm also very interested in this feature. I've got to use Emacs if I
need it at the moment. This request is pretty old, what about defining
when it will be implemented?
*** Issue 58644 has been marked as a duplicate of this issue. ***
Recently discussed at javalobby:
*** Issue 53319 has been marked as a duplicate of this issue. ***
This would be great. See for example how this is handled in Ultraedit
(www.ultraedit.com) or WinEdt (www.winedt.com, called blocks).
I would suggest something like this:
- easy switch between line and column selection mode (Alt+C in Ultraedit, Alt +
- possibility to search and replace just in the column selection
- possibility to replace a column by a particular string (e.g. selecting an
empty column at the begining of several lines and typing "/" twice would be
equivalent to selecting those line normally, followed by the Source > Comment
- insert numbers into a column (with a starting value, increment and possibly a
Moving to the 'other' subcomponent.
*** Issue 65616 has been marked as a duplicate of this issue. ***
*** Issue 98045 has been marked as a duplicate of this issue. ***
*** Issue 57951 has been marked as a duplicate of this issue. ***
*** Issue 137089 has been marked as a duplicate of this issue. ***
*** Issue 84267 has been marked as a duplicate of this issue. ***
Thanks to Sandip, there is a module that supports this on the plugin portal:
For those of us just using part of the NetBeans libraries in our product (the editor libsrc module), is it possible to
get the source code for Sandip's plug-in and incorporate it into our own builds? This features has been heavily
requested by our users.
I would love it if this feature were implemented. More than anything else. Working on it might not be sexy but the
editor really does matter.
Use the plugin! It's called Rectangular Edit Tools and does its job very well.
> Use the plugin! It's called Rectangular Edit Tools and does its job very well.
Thanks for the tip proxity. I did download them before I posted. The Rectangular Edit Tools a great start but (in my opinion) there are two enhancements that
would really improve their usefulness:
(a) visual highlighting of the selected (vertical) block.
(b) non-destructive paste.
*** Issue 139116 has been marked as a duplicate of this issue. ***
*** Issue 146233 has been marked as a duplicate of this issue. ***
The best implementation of this that I have ever seen is in jEdit. I think if you make a 1 to 1 implementation of that
in netbeans that you will have the perfect implementation. And the activation is so simple, just hold down control and
select the area/region that you want to work on.
*** Issue 150230 has been marked as a duplicate of this issue. ***
I need this functionality immediately. Something like "komodo edit" or ultraedit's column mode function.
*** Issue 151731 has been marked as a duplicate of this issue. ***
The relevant links are here:
I tested the Rectangulat Edit Tools plugin with NetBeans IDE 6.5.1 and it works. The issue reported by Rory is still
there but I have a different observation.
When we click on the Java source file from Projects Panel the tool buttons get disabled but when we choose the Java
source from the Editor tabs then the tool buttons are enabled.
Something is going wrong when the files are opened or selected through the Projects panel. With this issue known the
plugin works to fulfill the need of block copy paste.
Many users have asked for visual clue of the rectangular highlighting. I believe this is a task which can only be done
by tweaking the main editor selection mechanism code which will be a significant effort and will need thorough
knowledge of the editor source.
If a dotted rectangle can be drawn, keeping the selection as it is, on top of the selection just to give a visual clue
for the rectangular selection it will help the users and this may need relatively less effort.
The selection mechanism of the caret can be rewritten relatively easily - the highlighting layer will be modified. But that means that the editor should have
two "modes" of operation (or three: normal; rectangular-selection; line-selection). There do not need to be extra actions (like copy; paste etc.) - instead the
regular actions would work according to the current mode. So there would be a mechanism for switching of the mode and few extra actions e.g. for lines
sorting. The truth is that the Swing's text framework (on which NB editor is based) is not line-based (it's offset-based) so the implementation is not
straightforward but it's doable.
> But that means that the editor should have two "modes" of operation
I believe that's what other editors do too, I recall UltraEdit has a menu item "Edit -> Block Mode" (or similar), which
behaves like a checkbox and controls the behavior.
Rectangular selection/editing is the one thing I really, really miss from Visual Slick Edit. In fact i still break out
Slick Edit when I need that feature. Their approach is similar to things discussed here. Some ctrl-key toggles 'block-
select-mode'. Right click and drag also creates a block selection. Another feature is that with a column of text
selected, you can type and it types in each row, similar to the Replace functionality of the plugin mentioned here, but
inline. Also, there are no new actions for rect-copy, etc. just the normal copy/paste.
This is very useful functionality which I miss. It's implemented in Far Editor and Comodo. Interestingly, Eclipse didn't
have it for a long time too, and they just recently incorporated it in their 3.5 (Galileo) release. Visualizing the
selected area is a must, otherwise it's too confusing to use. It would definitely benefit NetBeans and Sun Studio to
incorporate this into the editor.
*** Issue 172598 has been marked as a duplicate of this issue. ***
In many editors, Alt+Drag allows rectangular selection.
A few comments of things I noticed when adding visual block mode to jVi... I haven't worked with other editors in this regard, so I have no basis for comparison.
There's some jVi usage examples of vim's blockmode at http://jvi.sourceforge.net/javahelpset/jvi-vis_block.html; they are based on and extended from Sandip's original doc's.
Of possible interest are behaviors in the presence of short lines. vim pads with spaces in some situations to keep/make a source/destination rectangular.
One complexity is TAB treatment. vim works with virtual columns and splits tabs, converting to spaces, when needed. Also, it is impossible with netbeans/swing highlighting to rectangularly display a region that slices across a tab, the vertical edge has bumps in it. jVi behaves correctly, it just displays funny.
Vim has a command, gv, to reselect the previous block acc'd to absolute coordinates. This can be handy.
(In reply to comment #37)
> Of possible interest are behaviors in the presence of short lines. vim pads
> with spaces in some situations to keep/make a source/destination rectangular.
Yes, this is going to be a problem. I hope that with the new view hierarchy it will be possible to highlight areas behind the \n on a line.
> One complexity is TAB treatment.
Umm, this is going to be a problem. And another problem is going to be the use of proportional fonts. How does vim treats proportional fonts in respect to block select?
> Vim has a command, gv, to reselect the previous block acc'd to absolute
> coordinates. This can be handy.
How does this work exactly? Thanks
(In reply to comment #38)
> > Of possible interest are behaviors in the presence of short lines. vim pads
> > with spaces in some situations to keep/make a source/destination rectangular.
> Yes, this is going to be a problem. I hope that with the new view hierarchy it
> will be possible to highlight areas behind the \n on a line.
vim doesn't hightlight past the \n either; and the corners (first/last line, first/last chars) of the block must be within a line. But for example on a block yank (copy) intermediate short lines are lengthened so all lines are the same size. On a paste, where the destination is past a \n then it pads where needed so the copied text is still a rectangle.
> > One complexity is TAB treatment.
> Umm, this is going to be a problem. And another problem is going to be the use
> of proportional fonts. How does vim treats proportional fonts in respect to
> block select?
AFAIK, vim does not support proportional fonts.
A simple approach to the corner cases is to detect them, for example tabs in the lines, and refuse to do the operation. Not nice, but better than jumbling text I guess.
> > Vim has a command, gv, to reselect the previous block acc'd to absolute
> > coordinates. This can be handy.
> How does this work exactly?
Suppose block is (lines 3-5, cols 7-10). This is copied and pasted, then do some editing, then the "reselect previous block" command selects the (3-5,7-10). Actually, in vim the line numbers are text.Position so the line numbers may change if the document is modified before the first line and then number of lines may increase/decrease if edited between the first/last lines. The column numbers remain fixed no matter any changes. I haven't considered if these are the best semantics, but it seems to work out ok.
kdevelop is doing this for years.
The referenced plugin no longer works with netbeans 6.9, nor is the author maintaining it anymore, so I believe this issue has relevance.
I would really like to see this too as the plugin that was used for a workaround no longer works in 6.9
Created attachment 102501 [details]
Rectangular Tools for NetBeans 6.9
This attachment should work for 6.9.
could you ask someone to include contrib/rectangularedittools module to nbms-and-javadocs build ? It would be a simple change at nbbuild/cluster.properties file adding this module to nb.cluster.experimental property if I am not wrong.
Thanks a lot
Good idea Michel! Robert Novak agreed to do modify the cluster but it will take some time. Thanks for your patience.
I have just uploaded a version which works for 6.9 at plugins page . I sttil need to sign the nbm to request the review but it should work anyway.
This thing has been on the board for almost 10 years and supposedly on dev track for at least last two. Rather than depending on a plugin, that (though we really appreciate the authors effort) has marginal functionality at best, can we get some kind of update on if/how development is going?
I would like to second ApeWare's request for information. I appreciate that development resources are limited, but the effort in at least managing our expectations is surely much lower. Thank you very much for an update.
Yes, there are still no resources available for implementing this feature in the Editor. Why don't you use Rectangular Edit Tools plugin  guys? It works quite nicely.
Many thanks for the status update (even though as you may guess it wasn't the answer I was hoping for !) To answer your question as to why I don't use the plugin... whilst I appreciate the effort that has gone into developing it, the lack of intuitive visual feedback irks me and if I really need to perform this type of editing I tend to prefer to switch to a different editor. (Please correct me if I am wrong and if the plugin now really visually highlights the selected block).
(In reply to comment #50)
> Many thanks for the status update (even though as you may guess it wasn't the
> answer I was hoping for !) To answer your question as to why I don't use the
> plugin... whilst I appreciate the effort that has gone into developing it, the
> lack of intuitive visual feedback irks me and if I really need to perform this
> type of editing I tend to prefer to switch to a different editor. (Please
> correct me if I am wrong and if the plugin now really visually highlights the
> selected block).
You are right, AFAIK there is no visual highlight for it. Anyway, if anyone is up to try to implement it since the code is available. I can give any help if necessary, even to test and push it to contrib repository.
(In reply to comment #50)
> lack of intuitive visual feedback irks me
FYI. jVi plugin has a fully functional visual block mode with a full set of operations (yank, put before/after, delete, replace-selection, insert before/after, replace-with-single-char) and any corner of the rectangular selection can be moved with the cursor.
> and if I really need to perform this
> type of editing I tend to prefer to switch to a different editor.
If jVi is installed it can be enabled/disabled with a checkmark menu item under Tools (or the toggle action can be bound to a keystroke).
I put together a minimal intro/how-to of visual block-mode for non-jVi users which is available at http://jvi.sourceforge.net/?javahelpset/jvi-vis_block.html (I don't know if there are any non-jVi users that take advantage of it)
jVi downloads from http://sourceforge.net/projects/jvi/files/jvi/
(In reply to comment #52)
> FYI. jVi plugin has a fully functional visual block mode
Forgot to mention that tabs and tab-splitting are handled correctly.
(In reply to comment #52)
It looks pretty amazing! I will test it and spread the word as soon as I get it to work.
Visual block mode in jVI plugin looks awesome. This means we have some code for making rectangular selection already available in some other codebase.
Can we get that part into the main stream so it becomes available to many non jVI users also?
(In reply to comment #55)
> some code
> for making rectangular selection already available in some other codebase.
The rectangular selection is displayed using stuff from org.netbeans.spi.editor.highlighting infrastructure.
In jVi's org.netbeans.modules.jvi.impl.NbTextView.java there is
private static class VisualSelectHighlighter extends BlocksHighlighter
This does the highlighting based on an array of file offsets; the array elements are taken as pairs for start-highlight:end-highlight.
Implemented in jet-main.
Toggle button for rectangular selection on/off is in editor toolbar (next to Toggle Highlight Search icon) or switch by Alt+Shift+R shortcut.
Please test the feature (once it proceeds into Dev build) and report possible improvements. Thanks.
Thanks Milo. I will take a look at this asap.
Integrated into 'main-golden'
User: Miloslav Metelka <firstname.lastname@example.org>
Log: #13857 - Cutting/Copying vertical blocks of text.
I'll improve the selection to retain the right coordinate when dragging mouse over empty line.
Also I'll add a border to the selection.
Due to complaints that the rectangular selection "jumps" left and right when selecting over empty lines I've made a visual selection block bounded by a dashed line instead. See issue #201694.
*** Bug 200027 has been marked as a duplicate of this bug. ***
Vertical selection is an expected feature of any modern source editor and as such should be a *built-in* capability. Leaving it as a plug-in means that users downloading netbeans have additional work bringing the editor up to snuff so they can be most productive. I am not saying incorporate every plug-in into the main code line but surely this is an exception.
the vertical selection is already part of IDE
Perhaps you were expecting the standard Alt+Drag trigger. The feature exists but it doesn't work that way.
Jiri / kAlvaro / anyone else
Can you document here how it is done?
I do not see anything in the toolbar and alt+shift+r as mentioned in the comments above does not work (OS X).
Thanks for both of your quick replies earlier!
> I do not see anything in the toolbar and alt+shift+r as mentioned in the
> comments above does not work (OS X).
The shortcut on mac is Shift-Meta-R
ant it can be toggle from the editor toolbar - it is the 4th icon in the second group, just behind Highlight Search Result