This looks like an over-complicated approach to me. What about searching just in one direction with `wrap` option enabled. i.e.
`let spaces = ' \{' . s:indent_spaces . ',}\s*\S'
let indents = [search(spaces, 'nw'), search('\t\s*\S', 'nw')]`
if indents[0] != 0 && intents[1] != 0
mixed = &expandtab ? indents[1] : indents[0]
endif`
`'\t\s*\S'` this regexp searches for a tab in the middle of line and ignores trailing cases.
This also fixes the case when <Tab>s placed not at the beginning of a line were not being reported.