Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Rewrite edInsert() without @tmplines2 and $tmp_chars * Use splice() to add @tmp_lines into @lines directly * Use scalar(@tmp_lines) instead of $tmp_chars to indicate whether @lines needs to be updated (early return added) * Input address normally counts from 1 so handles the placeholder at $lines[0] * Input address 0 is allowed for 'a' and 'i' commands, so be careful not to move $lines[0] placeholder * In edEdit() be more careful to reset @lines if no file is being read; the array needs to have one element * test1: start ed on empty buffer and run '0i' or '0a', enter text terminated with '.' line * test2: start ed with text file with 9 lines and run '9a'; text is appended starting from line 10 * test3: apply an ed patch containing 'a' commands (below) %perl diff -e ed.new ed > patch.ed %echo w >> patch.ed %perl ed ed.new < patch.ed 30368 29383 %perl sum -a md5 ed ed.new e5748aef0ba835feb1daba4a99778b9c ed e5748aef0ba835feb1daba4a99778b9c ed.new
- Loading branch information