Fix nasty one-off in offset segment creation

For in-code-point byte offsets. I can't even come up with a good
test case for this, apart from the manual one of doing a buffer-grep
for a large buffer, that unearthed this to begin with.
Fix off-by-one for brace matching of preceding braces

Fixes #16, as reported by @shalabhc.
Move auto-pair handling into Editor

Since we need to control the interaction between that and the
completion popup.

Fixes #9, hopefully for good this time.