Fixed a bug that cursor position is not working when whitespace is on the top of the snippet.