How do i unhide lines?
This is with npp v8.5.8 though likely applies to many older versions.
Among the things I have done to reduce the on-screen clutter I have turned off the
display bookmarkfeature using Preferences / Margins-border-edge / Display bookmark.
The display bookmark feature creates a blank area in the left margin. Turning display bookmark off means I can’t see the blue bookmark dots but I’m fine with that as bookmarks still work well.
Today while working on a text file I fumble fingered Alt-H which is the shortcut to hide lines. A thin green line appeared in my document and I see from the line numbering that a line of my text file is not visible.
I don’t see a
View / Unhide line(s)menu option. I tried Shift+Alt+H, no joy. The same blank area that is used by the blue bookmark dots is also used by the green arrows used to unhide lines.
Are there a ways to unhide lines other than re-enabling
Display bookmarkin preferences for a moment so I can click the green arrow, closing and re-opening the file, or closing and restarting Notepad++?
This example file has ten lines of text with lines 4 to 7 hidden.
Are there a ways to unhide lines other than
Not as far as I know, which seems to be confirmed because no one closed-with-answer this issue: https://github.com/notepad-plus-plus/notepad-plus-plus/issues/12717
I’ve commented a few times before that hidden lines is an underdeveloped feature. Use it if you will, but it will probably be just a short time before it disappoints you (again). :-(
I have created official bug reports concerning hidden lines, but they haven’t been acted upon. :-(
I dug into the source code a bit and saw:
SCI_SHOWLINES 2226 SCI_HIDELINES 2227
I tried to define an Alt+Shift+H
Show linesmacro using:
<Macro name="Show lines" Ctrl="no" Alt="yes" Shift="yes" Key="72"> <Action type="0" message="2226" wParam="0" lParam="0" sParam="" /> </Macro>
<Macros>section of my shortcuts.xml but nothing happened when I tried to unhide. Maybe it’s supposed to be in the
<InternalCommands>section but I don’t know if and how I can use SCI commands in that section. The existing ones all use IDM commands.
Those commands I believe are going to take a line range as arguments. That makes it impractical for hiding lines, but if your goal is to show all lines, you might be able to pass it a zero and a “really big” line number in such a macro.
But definitely see the user manual section on how the messages are encoded in shortcuts.xml, in order to satisfy Notepad++'s requirements (so the macro would even have a chance at working). Ref. HERE.
So taking it a bit further I changed @mkupper 's macro a bit to correspond to my additional information:
<Macro name="Show all lines" Ctrl="no" Alt="yes" Shift="yes" Key="72"> <Action type="0" message="2226" wParam="0" lParam="999999" sParam="" /> </Macro>
Then I hid some lines and ran the macro. It appeared to do nothing, but then I switched the active tab and switched back to the tab where I had hidden the lines.
Like magic those lines were shown again. But, the green arrows were still present in the bookmark margin. This makes sense as the Scintilla “show lines” is very “low level” and knows nothing about Notepad++ margins; it only knows about…ta dum…which lines are showing in the editing view.
Bottom line: While a macro can be made to show lines, it leaves something to be desired.
<Action type=“0” message=“2226” wParam=“0” lParam=“999999” sParam=“” />
You must have been wearing the wizard hat. :-)
I also had tried lParam=“999999” but had not thought about switching tabs and then back. However, I still can’t replicate the “Like magic those lines were shown again” part. I tried various ways of switching tabs such as via
Window / Windows...menu.
I tested this on v8.5.8 x32 installed and a fresh bare-bones v8.5.8 x64 portable. In both cases the lines remained hidden, and the green line plus arrows remain. I had run
Show all linesboth via the keyboard shortcut and the drop down menus.
I would have to apprentice a few more decades before my head will fit in that wizard’s hat but am happy with that I understand this line hiding thing a bit better.
@PeterJones and @Alan-Kilborn, a thought that had floated in and out at times what I was not near a computer resurfaced today. I had been wondering if hiding lines also blocks selections and copy/paste. It turns out it doesn’t meaning to unhide or show the text that we can select a range of text from before to after the hidden line(s) and then do
Ctrl-C Ctrl-V Ctrl-Z. The
Ctrl-Zis not essential but it will clear the file dirty or modified flag.
I’m not sure if we’d call it a Notepad++ bug or a feature that hidden lines are included when making a selection.
Experimenting finds that, for example, a column mode selection also column-selects data in the hidden lines and that operations such as delete, replace, etc. also affect the hidden lines. When doing column mode work the lines remain hidden.
This could be useful. Let’s say you want to do column mode work on a very long series of lines. Select and hide all of the lines except the first and last. Do a column mode selection on the two visible lines. Now do whatever you want in column mode. The hidden lines remain hidden. To reveal the results do a normal (non-column) selection of the two visible lines and then do
Ctrl-C Ctrl-V Ctrl-Z.
I’m not sure if we’d call it a Notepad++ bug or a feature that hidden lines are included when making a selection
Some people think it is a bug, some think it isn’t.
I’m reminded of the case where some lines are “hidden” because of “folding”. (Scintilla considers folded lines as hidden, another “problem” with the hidden-lines feature IMO).
Anyway, users have folded lines and they want to cut the folded block to move it somewhere else. They don’t understand that you can’t just select the line with the
+on its left and get the whole block in the cut. You have to select across that line’s line-ending as well (so caret shows on line beneath the line with the
+), before cutting. When you do that, you see the effect that you pointed out, i.e., that folded/hidden lines are actually part of selected text.
I suppose that there could be a command made that would copy/cut/etc only selected text that you can see, i.e., ignoring embedded hidden lines, but, as I stated before, hidden lines is such an underdeveloped feature generally that that kind of mod to it in its current state is of limited value.