Fix a unicode bug in python3.

Fixes #609
This commit is contained in:
Holger Rapp 2015-11-21 07:27:23 -08:00
parent 53bf0dbd7b
commit 9c73ce948a
3 changed files with 13 additions and 13 deletions

View File

@ -43,11 +43,8 @@ class VimBuffer(object):
@property @property
def line_till_cursor(self): # pylint:disable=no-self-use def line_till_cursor(self): # pylint:disable=no-self-use
"""Returns the text before the cursor.""" """Returns the text before the cursor."""
# Note: we want byte position here _, col = self.cursor
_, col = vim.current.window.cursor return as_unicode(vim.current.line)[:col]
line = vim.current.line
before = as_unicode(line[:col])
return before
@property @property
def number(self): # pylint:disable=no-self-use def number(self): # pylint:disable=no-self-use

View File

@ -240,4 +240,15 @@ class Snippet_With_Umlauts_Python(_UmlautsBase):
snippets = ('ül', 'üü ${1:world} üü `!p snip.rv = len(t[1])*"a"`') snippets = ('ül', 'üü ${1:world} üü `!p snip.rv = len(t[1])*"a"`')
keys = 'te ül' + EX + 'hüüll' keys = 'te ül' + EX + 'hüüll'
wanted = 'te üü hüüll üü aaaaa' wanted = 'te üü hüüll üü aaaaa'
class UmlautsBeforeTriggerAndCharsAfter(_UmlautsBase):
snippets = ('trig', 'success')
keys = 'ööuu trig b' + 2 * ARR_L + EX
wanted = 'ööuu success b'
class NoUmlautsBeforeTriggerAndCharsAfter(_UmlautsBase):
snippets = ('trig', 'success')
keys = 'oouu trig b' + 2 * ARR_L + EX
wanted = 'oouu success b'
# End: Umlauts and Special Chars #}}} # End: Umlauts and Special Chars #}}}

View File

@ -16,22 +16,14 @@ elif [[ $VIM_VERSION == "NEOVIM" ]]; then
VIM="$(which nvim)" VIM="$(which nvim)"
if [[ $TRAVIS_PYTHON_VERSION =~ ^2\. ]]; then if [[ $TRAVIS_PYTHON_VERSION =~ ^2\. ]]; then
INTERFACE="--interface tmux_nvim --python-host-prog=$PYTHON_CMD" INTERFACE="--interface tmux_nvim --python-host-prog=$PYTHON_CMD"
PY_IN_VIM="py"
else else
INTERFACE="--interface tmux_nvim --python3-host-prog=$PYTHON_CMD" INTERFACE="--interface tmux_nvim --python3-host-prog=$PYTHON_CMD"
PY_IN_VIM="py3"
fi fi
else else
echo "Unknown VIM_VERSION: $VIM_VERSION" echo "Unknown VIM_VERSION: $VIM_VERSION"
exit 1 exit 1
fi fi
if [[ $TRAVIS_PYTHON_VERSION =~ ^2\. ]]; then
PY_IN_VIM="py"
else
PY_IN_VIM="py3"
fi
PYTHON_VERSION=$($PYTHON_CMD -c 'import sys;print(sys.version.split()[0])') PYTHON_VERSION=$($PYTHON_CMD -c 'import sys;print(sys.version.split()[0])')
echo "Using python from: $PYTHON_CMD Version: $PYTHON_VERSION" echo "Using python from: $PYTHON_CMD Version: $PYTHON_VERSION"
echo "Using vim from: $VIM. Version: $($VIMn)" echo "Using vim from: $VIM. Version: $($VIMn)"