Typing something like "abc_def", the state changes at "_". It should only change for this, as well
as some other inline codes, at the start of a term.
The patch also adds braces around a few single-line consequents to improve maintainability and
readability, since I was changing those lines anyway.