I made this [pull request](https://github.com/tpope/vim-markdown/pull/53) on the `vim-markdown` plugin by Tim Pope. Everything works except that
there is one bug, and one missing feature. This question is about the bug.

But first let me describe briefly the pull request:

* It implements auto-lists
* When a user is in a markdown list, presses `<CR>`, depending on where the caret is on the line, a
new list item might be added (or the line will be split if the caret is in the middle of a line)

The problem is that I can't manage to detect when the caret is at the end of the line. The closest I
could get was to add a new list item if the caret is on one of the last two characters. The problem
is that whatever I do, the when the caret is before or after the last character in insert mode, it
goes ON the last character in normal mode, so I can't manage to detect if the caret is before or
after the last character in insert mode.

I tried using different combinations of `col('.')`, `col('$')` and `len(getline('.'))` among other
things, but everything I tried produced the same results: I can't differentiate the before and after
positions of the caret when on the last character in insert mode.

So how can check if the caret is AFTER the last character of a line in insert mode please?