Implement rectangular selection editing#4326
Conversation
|
NB: for undoability, this really depends on #4310. Ideally, that would be checked and merged first. I've tested them together on my machine. |
| // making it input handler-specific. | ||
| char c = event.getKeyChar(); | ||
| if (!rectSelect || (c != '\n' && c != '\r') || | ||
| (event.getModifiers() & InputEvent.META_MASK) != 0) { |
There was a problem hiding this comment.
@GKFX Quick question, why do you check META here?
|
Is this something we even want to support? It seems like the sort of thing that's going to open up many more headaches (especially as we try to support Chinese, Japanese, Korean...) |
|
I'm not sure whether it's worth it. I tried this PR today and it still has some quirks which would need to be ironed out. However, having multiple cursors (selections) or rectangular selection is the thing right now and can be very useful when done properly. I'm using it in IDEA from time to time. Not sure how many people, easpecially beginners, can make use of it though. Maybe it would be better to first focus on making Undo and Find/Replace solid, then think about rect mode and whether we can implement it neatly without headaches. |
|
If this patch isn't perfect, let's not do it. We can wait until we either have a better patch and someone who wants to actively support it. The half-implemented support (that I wasn't aware of) probably needs to be disabled if it exists so that it's "not implemented," not a "bug." (The mess created by the comment/uncomment change we're discussing right now is a good example of why this sort of half-implemented feature is a huge headache.) |
|
@JakubValtar Besides the meta key thing (which I'll check; I think I had a reason but it's all a bit hazy) what were the quirks you found? I can go through them and try to improve it. |
|
@benfry Maybe we should wait then. @GKFX If we are going full in, we should not have separate code for single cursor and for rect selection (which probably means multiple cursors). The code for multiple cursors should be able to handle single cursor, because it's basically multiple cursors with the size of 1. I want to avoid having the same code (and related bugs) twice in the code and also I don't want the uncertainty which code will run when I call some method setting/getting text. I think most of the problems/ideas described below will simply disappear once you start treating the rect selection as multiple single cursors (multiple single selections). The act of rect selecting will then be just a special way to place multiple cursors (multiple selections). The existing code where feeding in multiple cursors/selections does not make sense would get only the last cursor/selection. To implement this, Some things which I think should be fixed/handled:
Things I would expect from "perfect" implementation
Let's ask @benfry if he thinks I'm being reasonable here and this is something we want before starting working on this (if you would still like to work on it of course) :) |
|
For something this invasive, I'd rather see the effort put into replacing JEditSyntax with something less buggy, more modern, more full-featured (that has features like this already). Or even, better integration between Processing and other full-featured editors that people like to use (Sublime, IntelliJ, etc). Both seem like time better spent priority-wise. In the meantime, are there things that need to be disabled so that we don't have half-working rectangular selection in the current code base? |
|
In terms of invasiveness... I think most of it will be just using the same code as now, but looping through multiple cursors instead of one. Rest of my complaints will be handled by improving the method which handles the act of rect selection and by fixing Undo (which I will be doing anyway). Though you are probably right that spending those hours on the integration with other editors would directly benefit more people. It looks like many people prefer to use different editors. |
|
The switch from (Closing this, per discussion) |
|
@benfry Fair enough. @GKFX Can I ask you to remove the rect selection code which is currently present in the codebase? You probably know better where it is. Otherwise let me know and I'll do it. Sorry that we are not going to use your code, but supporting this feature would likely create more headaches for us and take more hours to maintain than we can afford. |
|
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Fixes #4250. There was a bit of code for working with column selections—obviously you could make them—but the code for editing with them was just unfinished. This makes ordinary typing, pasting, backspace and delete work, even with overtype mode on.