Add way to ensure valid mode state up to a certain line, mostly used for writing specs.