Narrowed this down by disabling plugins one-by-one.
- Install Syntax Highlighter plugin.
- Post a {code} block in a comment.
- Comment will be displayed with excessive whitespace.
- Reloading the page will show the comment correctly, but performing any edits on the bug will trigger the excessive whitespace again.
- Try disabling JFS plugin.
- See that behaviour of Syntax Highlighter plugin is now normal.