Skip to content

Commit

Permalink
Change behavior
Browse files Browse the repository at this point in the history
if all line is empty, ignore it, and do not append an \n.
  • Loading branch information
tsaiid committed May 21, 2014
1 parent ca5d267 commit 59c0e69
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions MyScripts/hotkey/renumber-selected-text.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,17 @@ $^!n::
Loop, Parse, normalizedValue, `n
{
If (A_Index >= startLine && A_Index <= endLine) {
If (!RegExMatch(A_LoopField, "^\s*$"))
If (!RegExMatch(A_LoopField, "^\s*$")) {
finalText .= ++currLineNo . ". " . RegExReplace(A_LoopField, "^(\s*)((\d+\.)|([-\+\*]))(\s*)(.*)", "$6")
Else
finalText .= A_LoopField

If (A_Index < endLine)
finalText .= "`n"
If (A_Index < endLine)
finalText .= "`n"
}
Else {
; if all line is empty, ignore it, and do not append an \n
; finalText .= A_LoopField
}

}
}
If (isEndNewLine){
Expand Down

0 comments on commit 59c0e69

Please sign in to comment.