modify :s check to avoid looping forever
Review Request #102140 - Created July 29, 2011 and submitted
the substitute command “s/$/x/g” would loop forever. it makes no sense to add the ‘g’ at the end of a substitutions that replaces at EOL, but for many this is appended out of habit. the check at the end of the replacement code makes sure that the replacement column is within the line, but since one replacement has already been done, and $/EOL is the last possible position where a replacement can happen, it makes no sense that the new start column is equal to the line length (i.e. after the line) either. the test should therefore be against line length minus one.
a test making sure that s/$/x/g and s/.*/x/g work correctly has been added.