Fix assertion failure when deleting all lines

Lines need to be deselected before they're deleted, but new lines need
to be committed before they can be selected, so reorder things to
remove -> insert new line if needed -> commit -> update selection -> delete.
Fix permissions on installed files. Closes #1669.
Update Galician translation. Closes #1167.