add test for a bug
fix bug duplicate line in region with newline character at the end