summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSriram Murali <sriram87@gmail.com>2013-10-16 17:08:55 +0000
committerSriram Murali <sriram87@gmail.com>2013-10-16 17:08:55 +0000
commit1aeda01c441cd696e7fac21a238564f9a7987eb0 (patch)
treeef7c70183b4a7e60c2feee56d2b67e0f963de8e1
parentb34186ae386e9fbe46e4c4bc87f5dfbbbeda2ffc (diff)
downloadbcm5719-llvm-1aeda01c441cd696e7fac21a238564f9a7987eb0.tar.gz
bcm5719-llvm-1aeda01c441cd696e7fac21a238564f9a7987eb0.zip
lui: enable tab completion in command window
llvm-svn: 192814
-rw-r--r--lldb/utils/lui/commandwin.py23
1 files changed, 21 insertions, 2 deletions
diff --git a/lldb/utils/lui/commandwin.py b/lldb/utils/lui/commandwin.py
index a137cb09752..2eb2082c6c8 100644
--- a/lldb/utils/lui/commandwin.py
+++ b/lldb/utils/lui/commandwin.py
@@ -10,6 +10,7 @@
import cui
import curses
import lldb
+from itertools import islice
class History(object):
def __init__(self):
@@ -52,7 +53,7 @@ class CommandWin(cui.TitledWin):
def __init__(self, driver, x, y, w, h):
super(CommandWin, self).__init__(x, y, w, h, "Commands")
self.command = ""
-
+ self.data = ""
driver.setSize(w, h)
self.win.scrollok(1)
@@ -63,7 +64,23 @@ class CommandWin(cui.TitledWin):
def enterCallback(content):
self.handleCommand(content)
def tabCompleteCallback(content):
- pass # TODO: implement
+ self.data = content
+ matches = lldb.SBStringList()
+ commandinterpreter = self.getCommandInterpreter()
+ commandinterpreter.HandleCompletion(self.data, self.el.index, 0, -1, matches)
+ if matches.GetSize() == 2:
+ self.el.content += matches.GetStringAtIndex(0)
+ self.el.index = len(self.el.content)
+ self.el.draw()
+ else:
+ self.win.move(self.el.starty, self.el.startx)
+ self.win.scroll(1)
+ self.win.addstr("Available Completions:")
+ self.win.scroll(1)
+ for m in islice(matches, 1, None):
+ self.win.addstr(self.win.getyx()[0], 0, m)
+ self.win.scroll(1)
+ self.el.draw()
self.startline = self.win.getmaxyx()[0]-2
@@ -100,3 +117,5 @@ class CommandWin(cui.TitledWin):
return
self.el.handleEvent(event)
+ def getCommandInterpreter(self):
+ return self.driver.getCommandInterpreter()
OpenPOWER on IntegriCloud