Corrected selectedText var (contain too many text before)
Correct checking table algorithm
Merge pull request #1089 from matheod/tableFix

Table fix (problems when editing table)