+ # special case: typing before a space that's the only thing in a block/doc
+ # reason: enter key creates blocks with just a space in them
+ special_case = false
+ if n.text is ' '
+ if n.parent?.el?
+ if n.parent.children.length is 1
+ if n.parent.children[0] is n
+ special_case = true
+ else
+ special_case = true
+ if special_case
+ n.text = char
+ else
+ n.text = char + n.text