Still pending testing. Old logic did not work when lines would wrap, so changing things to a character/line measuring technique. Fixed some other isues too while testing shortcuts.
Also aligned the construction of the inputs where possible.
Created implementation for codemirror, yet to use it.