Fix paste operation bug when cursor is on last line.