How to highlight single line without caret going to next line
-
Hello,
Can someone please tell me how can I highlight only one line without caret going to next line. For example I’m trying to edit multiple lines scattered across a file but whenever I highlight a line and try to replace it via ctrl-h, the caret goes to the beginning of the next line and pulls up the line to the line I replaced making file broken.
I’m new in all this as it can be noticed so please bear with me, thanks in advance!
-
This is just “how it works”. When what you describe occurs, N++ is blocking the entire line, including the line-ending. If you don’t want the line ending, simply decrease the width of the block by one position (usually shift+left arrow). This will move the cursor up to the previous line because it will now be between the last non-line-ending character and the line-ending.
And, the behavior you “don’t like” is actually perfect when you are going to move the entire line somewhere else–you wouldn’t want an empty line replacing what is cut out (arguable, maybe you would), and where you paste it it would join with a line at the paste point, and I’m sure that would bug you too.
In short, I think it is just something in N++ that you have to get used to. I did.
-
Right, I thought that might be the case. It’ll take a bit to get used to it and I can see how it can be useful in other cases, I just hoped there was a way to change how it works. Thanks for information on how it works.
-
sorry, I don’t get what you were talking about and I’m curious what it is so
excuse me while I’m stepping in and rephrase a bit.Can someone please tell me how can I highlight only one line without caret going to next line.
By using SHIFT+END
For example I’m trying to edit multiple lines scattered across a file but whenever I highlight a line and try to replace it via ctrl-h, the caret >goes to the beginning of the next line and pulls up the line to the line I replaced making file broken.
But this means that your clipboard data has already the end of line chars (carriage return new line feed) added, meaning
you selected it.As said, it might be that I’m completely wrong, but …
Cheers
Claudia -
Basically what I wanted to know is if there is a way to select a line without automatically highlighting the end characters which make caret move to the beginning of the next line, because when I try to replace the line I intended it moves that line below it to the replaced one since end characters (which were hidden and I didn’t know about them) are highlighted and carried into replace tool.
Sorry for confusion, I hope this clears it up a bit.
-
By using the keys SHIFT+END
and you don’t have to excuse, I’m not a native speaker a simply didn’t understand it.
Cheers
Claudia -
I may be remembering wrongly because I’ve used N++ so long, but I think that in the editors I used before if your cursor was in column 1 and you pressed Shift+DownArrow, the entire line was blocked in inverse video but the cursor remained at the end of the line it started on and not the next line (as N++ does it). I think that is what the OP didn’t like, and I tried to help explain and make the OP feel better about how it works in N++ in my earlier reply.
-
Hi Scott,
you are right, when I used npp the first time, long long time ago, this was one of the things which drove me crazy - but then I found the SHIFT+END ;-))
Cheers
Claudia -
I have the same need, but for a different reason.
When I want to hide some lines, I click in the line numbers margin area for the first line, drag to the last line I want to select, and then hit Alt-H to hide the lines. Problem is that an additional line beyond the ones I selected gets hidden, because the caret had moved down to the beginning of the next line. Yes, I could hit Shift-Left first, but that seems a bit awkward.
I do appreciate Scott’s & Claudia’s point about the OP’s issue (as long as the REPLACE text includes the EOL, then it’s advantageous to have the selection-driven FIND text do the same).
So maybe my problem is less an issue of how Selecting works and more about the way Hide figures out its target?
Any thoughts/suggestions would be appreciated.
-
Hello @William-B,
if I understood correctly you could
- click on the line margin
- press shift and then
- click last position of the last2hide line.
- alt+h
Cheers
Claudia -
Hi, Darkemis, Scott and Claudia,
Thanks Claudia and Scott to make us remember about the difference between the two shortcuts Shift + Down arrow and Shift + End ! A very little thing that may, sometimes, speed up our N++ work :-)
So, when cursor is at the very beginning of a line ( column 1 ) :
-
Shift + Down arrow selects all the contents of this line,
WITH
its End of Line character(s) -
Shift + End selects all the contents of this line,
WITHOUT
its End of Line character(s)
Cheers,
guy038
-