Fixes #12243. Merged style definitions.

The styleText variable does not always have a trailing ';' as it may come like this directly when pasting. Added a sanity check/fix to ensure it ends in ';' so that adding now definitions keeps a valid syntax.