Skip to content
This repository has been archived by the owner on Jan 13, 2022. It is now read-only.

Commit

Permalink
Merge branch 'autocomplete_optimizations' of http://github.com/whatth…
Browse files Browse the repository at this point in the history
…ejeff/phpsh into stufffromgithub
  • Loading branch information
adonohue committed Sep 15, 2010
2 parents 199591e + 04c45a7 commit 1f8ad48
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/__init__.py
Expand Up @@ -4,6 +4,7 @@

from subprocess import Popen, PIPE
from threading import Thread
from bisect import bisect
import ansicolor as clr
import cmd_util as cu
import ctags
Expand Down Expand Up @@ -500,9 +501,11 @@ def tab_complete(text, state):
return None
if state == 0:
self.autocomplete_cache = []
for identifier in self.autocomplete_identifiers:
if identifier.startswith(text):
self.autocomplete_cache.append(identifier)
pos = bisect(self.autocomplete_identifiers, text)

while self.autocomplete_identifiers[pos].startswith(text):
self.autocomplete_cache.append(self.autocomplete_identifiers[pos])
pos = pos + 1

if self.function_signatures.has_key(text):
for sig in self.function_signatures[text]:
Expand Down Expand Up @@ -707,7 +710,7 @@ def php_open(self):
p_line = self.p.stdout.readline().rstrip()
if p_line == "#end_autocomplete_identifiers":
break
self.autocomplete_identifiers.append(p_line)
self.autocomplete_identifiers.insert(bisect(self.autocomplete_identifiers, p_line), p_line)

def wait_for_comm_finish(self, defer_output=False):
try:
Expand Down

0 comments on commit 1f8ad48

Please sign in to comment.