Skip to content

Commit 59c0e69

Browse files
committed
Change behavior
if all line is empty, ignore it, and do not append an \n.
1 parent ca5d267 commit 59c0e69

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

MyScripts/hotkey/renumber-selected-text.ahk

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,17 @@ $^!n::
7676
Loop, Parse, normalizedValue, `n
7777
{
7878
If (A_Index >= startLine && A_Index <= endLine) {
79-
If (!RegExMatch(A_LoopField, "^\s*$"))
79+
If (!RegExMatch(A_LoopField, "^\s*$")) {
8080
finalText .= ++currLineNo . ". " . RegExReplace(A_LoopField, "^(\s*)((\d+\.)|([-\+\*]))(\s*)(.*)", "$6")
81-
Else
82-
finalText .= A_LoopField
8381

84-
If (A_Index < endLine)
85-
finalText .= "`n"
82+
If (A_Index < endLine)
83+
finalText .= "`n"
84+
}
85+
Else {
86+
; if all line is empty, ignore it, and do not append an \n
87+
; finalText .= A_LoopField
88+
}
89+
8690
}
8791
}
8892
If (isEndNewLine){

0 commit comments

Comments
 (0)