Can I disable collapsed text automatically expanding when edited?
-
When I’m editing a section that contains collapsed text below it, all of the text automatically expands when I hit enter. e.g.:
<table style=“margin-top: 10px”>
<tr>
<td> [collapsed]
<td> [collapsed]
</tr>
</table>… expands to show …
<table style=“margin-top: 20px”>
<tr>
<td>
rabbit
rabbit
rabbit
</td>
<td>
rabbit
rabbit
rabbit
</td>
</tr>
</table>… as soon as I hit enter to change “10px” to “20px”.
Is there a way to disable this auto-expansion? Apologies if this is already answered elsewhere. I have looked, honest, but perhaps I’ve not been searching for the correct terminology!
Many thanks in anticipation!
-
Cannot replicate.
Please give us your ? menu’s Debug Info. Please give us more details on how to replicate your problem.
-
@PeterJones Hmmm. Now I can’t replicate it either. What I was trying to describe happens quite frequently (often enough to have prompted me to ask the question) but perhaps it isn’t happening for the reason I thought it was and I’m doing something else to cause it.
Many thanks for the response. Please ignore my question for now. If/when it happens again I’ll pay more attention to exactly what I did, and if I can’t work out myself why it happened and how to stop it, I’ll ensure I can give a replicable description.
-
@PeterJones Got it! It isn’t when I edit a line, it’s when I delete a spacing line between two pieces of collapsed text. The lower collapsed lines automatically expand when I delete the blank line.
305 + <table> [collapsed lines]
379 [Null line, to be deleted]
380 + <table> [collapsed lines]
386 <xsl:if …When I delete line 379 using the [Delete] key, the collapsed segment below automatically expands, so the screen becomes …
305 + <table> [collapsed lines]
379 - <table> [expanded automatically]
380 <tr>
381 <td>rabbit</td>
382 <td>rabbit</td>
383 <td>rabbit</td>
384 </tr>
385 </table>
386 <xsl:if …I’d like, if possible, to be able to delete the null line keeping the next line collapsed
305 + <table> [collapsed lines]
379 + <table> [collapsed lines]The debug info from the ? menu is:
Notepad++ v7.8.6 (32-bit)
Build time : Apr 21 2020 - 15:17:06
Path : C:\Program Files (x86)\Notepad++\notepad++.exe
Admin mode : OFF
Local Conf mode : OFF
OS Name : Windows 10 Enterprise (64-bit)
OS Version : 1903
OS Build : 18362.388
Plugins : ComparePlugin.dll DSpellCheck.dll mimeTools.dll NppConverter.dll NppExport.dll -
I can reproduce that. If I have two collapsed
<table>
s with a blank line in between, and delete the blank line, the second<table>
will expand.My guess is that it was done intentionally, to protect you from deleting the next “line” and accidentally deleting the whole table.
I do not know of a way to disable that behavior.
As a workaround, you could just hit
Ctrl+Alt+F
, or whatever key View > Collapse Current Level has assigned for your installation – or click the collapse button.Maybe someone else knows another way to prevent it or how to work around it; I cannot think of any that are practical and easier than clicking once or
Ctrl+Alt+F
. -
@PeterJones Thanks, Peter. It shouldn’t be a problem for me to just hit the collapse command again after I’ve deleted the line. The problem is it keeps surprising me. I forget it’s going to happen! The example I gave was simplistic, but when it’s two hundred lines collapsed underneath, not just two or three, everything moves on the screen and I have to find where I was editing again in order to collapse that section.
If there is a solution, I’d love to hear it. At least this exercise has made it clearer to me what’s causing it. No doubt I’ll still forget the next time I start using Notepad++, but now it should only happen once to prompt me to note what line I’m on before hitting [Delete]!
… Although, thinking a little more about it, if I follow your recommendation of immediately using Ctrl+Alt+F it shouldn’t matter what section the screen is showing me, it’ll collapse at the correct point! Yippie! So you have provided a solution. Many thanks. :-)