Closes #34797 and its child #39508.  Release Notes: - Fixed `editor::DuplicateLineUp` duplicating the last line onto itself when the line doesn't end with a newline (#39508) - Fixed line copy not including a newline at end of buffer, causing paste to occur on the same line (#34797)