geany/geany — pull request #21 by earshinov (2012-02-05 12:24:31+00:00)
Title: Move line(s) up/down: properly handle last line without trailing newline

Code inside `editor.c:move_lines()` didn't work correctly if user tried to

* move up the last line without trailing newline;
* **or** move down the line before such the last line.

In those cases two last lines were merged. You can easily check it yourself.

I rewrote the `move_lines` function to correctly handle this situation. As described in the commit message, the solution is to cut moved lines without their surrounding newlines and append necessary newlines after inserting the lines at the new position.

I also created (to be more precise, extracted from another code) function `sci_deselect_last_newline`, because it was useful this time and may be useful in future.