Prevent going to new line on text copy
-
Use the keyboard instead of the mouse to do the selection? The default keyboard combo for doing this is Shift+End.
-
I am aware of the keyboard usage but that is more of a bother to me than using my current method. Is using the keyboard the only choice? As flexible as this editor is, it seems strange that it forces the use of the keyboard.
-
No, it’s not your only choice, it’s just a really good one, because it’s super-simple.
If you absolutely have to use mouse-only for this selection, you could turn on line-wrapping: then you don’t have to scroll, so it’s much easier to not accidentally change lines while highlighting a long line.
-
Thanks for the suggestion but I had already tried changing the word wrap option and it makes the page far too cluttered. Hopefully an option for this will be added at some point. I’ll just stick with how I do it now…
-
Hopefully an option for this will be added
So, I’m curious, what are your ideas for how this would be made into an option?
-
Maybe I missed something but how about pressing the SHIFT key before clicking into the end position?
Eko
-
Probably not going to be acceptable to the OP. People get into their “use patterns” and trying to get them to do something different (e.g. Shift+End, or click-release-move-shift-click) isn’t going to do it for them! :-)
-
user pattern
Like we all do :-D
But one other method, which involves only the mouse is using the begin/end select methods from the edit or context menu.
Eko
-
begin/end select methods
I wasn’t going to suggest that because I know that is way more burden (invoking a menu [twice]) than anyone would want! BTW, it is too bad Begin/End Select doesn’t have a default keycombo–it is a valuable command that doesn’t get enough publicity–[I tied mine to ctrl+b].
-
At first I dismissed this and figured, like everyone else, “just use the keyboard”. Then I realized it happens to me pretty often. Some joker writes a line of code 400 characters wide, I start scrolling to see what’s out there, realize I want a chunk of it, start highlighting with the mouse knowing full well that I have to be careful and then BAM! I’m three lines down and back at the left margin. There’s no good way to get back to the selection start and I’m at level 9 annoyance even though I know it’s my own fault. Sure you can hold the shift key and arrow around until you eventually find your selection start, but it’s cumbersome.
So a functionality like Autocad’s “Orthagonal” (where you hold down a key and the object you’re moving will only move perfectly up, down, left, or right) wouldn’t be entirely useless. It would be kind of like grabbing a scroll bar. You don’t have to be right over the scroll bar to get it to move. But since apparently it’s difficult to get the mouse coordinates in python, and I don’t see any way to constrain the vertical mouse movement, I don’t know how I’d implement it.
All the solutions so far have been prevention, but since it’s pretty obvious I just can’t learn the lesson, here’s a short but sweet mitigation solution in python script form:
# coding: iso-8859-1 pos = editor.getSelectionStart() editor.setCurrentPos(pos)
When you’ve screwed up and you accidentally have multiple lines selected, stop, keep your selection, run this and you’ll go back to your selection start. This won’t prevent the problem, but it will take you right back to the selection start and give you the opportunity to do the smart thing and use the keyboard.
BTW, I’m intrigued by this Begin/End Select witchcraft you speak of. I’m going to keep that in my back pocket.
-
Aaaand too late for an edit. You could just hold the ALT key down while you make your selection too. That will give you the opportunity to reduce the selection to just one line. But again, you have to think of it before you start selecting.
-
You could just hold the ALT key down
That is a nice suggestion as a cure for the “problem”. Again, requires an “attitude adjustment” from the user (to get on the Alt key before selecting), but…I say good one!
Along these same lines, one could enable the “free the caret” mode so that the caret may move into the void beyond each end-of-line. I tried it and it also works to solve the original problem, without having to “think of it before you start selecting” (but it does involve setting something up–a one time kinda thing).
However, the free-caret may not be liked in other circumstances…six of one, half-a-dozen of the other. There’s more discussion of “free the caret” mode in the following links:
- https://notepad-plus-plus.org/community/topic/13153/feature-request-virtual-space
- https://superuser.com/questions/401551/notepad-cursor-past-end-of-line-virtual-spaces
- https://notepad-plus-plus.org/community/topic/13778/to-add-virtual-spaces-or-cursor-beyond-end-of-line-option
- https://notepad-plus-plus.org/community/topic/13531/turn-on-cursor-beyond-eol-remove-unnecessary-spaces-when-saving
intrigued by this Begin/End Select witchcraft
The real use of Begin/End Select is when you need to select a lot of text.
Selecting with the mouse and moving off-window downward (for ex.) can get slow and tedious as you watch every line scroll by…for maybe thousands of lines…ho…humm…ZzzZZzz…and then if you accidentally stutter with the mouse and lose your selection, you have to start over!
Much easier to move to the start of where you want to select, invoke Begin/End Select, then quickly navigate to the end (okay, implies you know the ballpark area of the file where your desired end is!) and reinvoke Begin/End Select when the caret is in the right place. BOOM goes the dynamite–your big selection is now there!
BTW you can also do Begin/End Select in column mode to get a rectangular selection of huge size quickly!
a functionality like Autocad’s “Orthagonal”
Seems like it could be useful but also seems like it would be something that belongs in Scintilla.
since apparently it’s difficult to get the mouse coordinates in python
I contend that it is NOT difficult…perhaps it just seems that way when you have a poster that wants to complain about things that don’t work 100% the way they think it should [and for clarity, I’m talking about the mouse coords thread you referenced, not THIS thread, although…hmmmm. :-) ]
-
@cipher-1024 said:
You could just hold the ALT key down…
This works great. If there was an option to simulate holding the alt key that would be nice but this method will save me so much frustration. I’m glad to see I’m not the only one it affects. My thanks to everyone that replied.