Either remove the line break before or after the line. And yes, you’ll have to take care about corner cases for the start and end of the document, and indeed, removing the line break after the line will remove line decorations associated with the next line.
Can you clarify why removing a newline removes line decorations on the next line?
Any way to “restore” those line decorations? As per Easily track & remove content with decorations, I’m storing them all in a StateField, but based on my understanding, after those changes are applied the line decoration will have already been removed.
They are technically associated with the position before the line, and deleting that drops them, which is usually what you want to happen when merging lines.