mirror of
https://github.com/tbabej/taskwiki.git
synced 2025-08-19 06:43:06 +02:00
completion: Fix omni completion of non-ascii tasks
vim uses bytes as column offsets, so we need to work with encoded strings instead.
This commit is contained in:
parent
679e564194
commit
4c7cc5f551
2 changed files with 11 additions and 2 deletions
|
@ -125,8 +125,9 @@ class Completion():
|
||||||
|
|
||||||
def omni_modstring_findstart(self, line):
|
def omni_modstring_findstart(self, line):
|
||||||
m = re.search(regexp.GENERIC_TASK, line)
|
m = re.search(regexp.GENERIC_TASK, line)
|
||||||
if m and not m.group('uuid') and ' -- ' in line:
|
bline = line.encode("utf-8") # omni findstart needs byte offset
|
||||||
return line.rfind(' ') + 1
|
if m and not m.group('uuid') and b' -- ' in bline:
|
||||||
|
return bline.rfind(b' ') + 1
|
||||||
else:
|
else:
|
||||||
return -1
|
return -1
|
||||||
|
|
||||||
|
|
|
@ -102,6 +102,14 @@ class TestCompletionIntegOmni(IntegrationTest):
|
||||||
self.client.eval('0') # wait for command completion
|
self.client.eval('0') # wait for command completion
|
||||||
self.command("w", regex="written$", lines=1)
|
self.command("w", regex="written$", lines=1)
|
||||||
|
|
||||||
|
self.client.feedkeys('otest task ☺ -- pro\\<C-X>\\<C-O>A\\<C-X>\\<C-O>\\<Esc>')
|
||||||
|
self.client.eval('0') # wait for command completion
|
||||||
|
self.command("w", regex="written$", lines=1)
|
||||||
|
|
||||||
task = self.tw.tasks.pending()[1]
|
task = self.tw.tasks.pending()[1]
|
||||||
assert task['description'] == 'test task 2'
|
assert task['description'] == 'test task 2'
|
||||||
assert task['project'] == 'ABC'
|
assert task['project'] == 'ABC'
|
||||||
|
|
||||||
|
task = self.tw.tasks.pending()[2]
|
||||||
|
assert task['description'] == 'test task ☺'
|
||||||
|
assert task['project'] == 'ABC'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue