can now complete with NOTHING in the node
This commit is contained in:
parent
cbcec6a798
commit
a96188385f
2 changed files with 10 additions and 8 deletions
|
@ -930,13 +930,18 @@ class Core(object):
|
|||
if jid.resource or jid.full.endswith('/'):
|
||||
# we are writing the resource: complete the node
|
||||
if not the_input.last_completion:
|
||||
items = self.xmpp.plugin['xep_0030'].getItems(jid.server)['disco_items'].getItems()
|
||||
response = self.xmpp.plugin['xep_0030'].getItems(jid.server)
|
||||
log.debug('HEY: %s\n' % response)
|
||||
if response:
|
||||
items = response['disco_items'].getItems()
|
||||
else:
|
||||
return True
|
||||
items = ['%s/%s' % (tup[0], jid.resource) for tup in items]
|
||||
for i in range(len(jid.server) + 2 + len(jid.resource)):
|
||||
log.debug('allo')
|
||||
the_input.key_backspace()
|
||||
else:
|
||||
items = []
|
||||
log.debug('%s\n' % items)
|
||||
the_input.auto_completion(items, '')
|
||||
else:
|
||||
# we are writing the server: complete the server
|
||||
|
|
|
@ -832,15 +832,12 @@ class Input(Win):
|
|||
"""
|
||||
(y, x) = self._win.getyx()
|
||||
if not self.last_completion:
|
||||
# begin is the begining of the nick we want to complete
|
||||
# if self.text.strip() != '' and\
|
||||
# not self.text.endswith(after):
|
||||
if self.text.strip():
|
||||
# begin is the begining of the word we want to complete
|
||||
if self.text.strip() and not self.text.endswith(' '):
|
||||
begin = self.text.split()[-1].lower()
|
||||
else:
|
||||
begin = ''
|
||||
# else:
|
||||
# begin = ''
|
||||
log.debug('BEGIN: [%s]\n' % begin)
|
||||
hit_list = [] # list of matching nicks
|
||||
for word in word_list:
|
||||
if word.lower().startswith(begin):
|
||||
|
|
Loading…
Reference in a new issue