coderifous/textobj-word-column.vim — pull request #7 by inkarkat (2012-11-14 15:03:32+00:00)
Title: Fix for shorter lines

With the cursor on `ab`, I get an invalid selection that extends to the `.` of the second line (and a beep when smart boundaries are used), instead of the expected selection of lines 3 + 4.

```
" Use real visual mode mappings to avoid the mapping delay when entering visual
" mode with "v".
xnoremap ab :call TextObjWordBasedColumn("aw")
xnoremap aB :call TextObjWordBasedColumn("aW")
```

This can be fixed by checking that there's actually a character at the start virtual column. The match for the exact column number also ensures that if the position is inside a Tab or in the middle of a double-width character, the selection will not be extended.

----

Addtionally, `synID()` needs the byte column, not virtual column.

This matters when there are multi-byte, unprintable, or Tab characters, in which cases the virtual (screen) column is not equal to the byte index.