Browse Source

wxGUI/prompt: fix 'ctrl+space'

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@40137 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 15 năm trước cách đây
mục cha
commit
43c80eb016
1 tập tin đã thay đổi với 7 bổ sung15 xóa
  1. 7 15
      gui/wxpython/gui_modules/prompt.py

+ 7 - 15
gui/wxpython/gui_modules/prompt.py

@@ -717,12 +717,6 @@ class GPromptSTC(GPrompt, wx.stc.StyledTextCtrl):
         @todo event.ControlDown() for manual autocomplete
         """
         # keycodes used: "." = 46, "=" = 61, "," = 44 
-        line = ''
-        entry = ''
-        usage = ''
-        cmdtype = ''
-        cmdname = ''
-        cmd = ''
         
         if event.GetKeyCode() == 46 and not event.ShiftDown():
             # GRASS command autocomplete when '.' is pressed after 'r', 'v', 'i', 'g', 'db', or 'd'
@@ -802,16 +796,15 @@ class GPromptSTC(GPrompt, wx.stc.StyledTextCtrl):
             elif event.GetKeyCode() == wx.WXK_SPACE and event.ControlDown():
                 # manual autocompletion
                 # map entries without arguments (as in r.info [mapname]) use ctrl-shift
-                
-                maplist = []
+                cmdtype = self.GetTextLeft().split('.')[0]
                 if cmdtype=='r' or cmdtype=='i':
-                    self.maptype = 'rast'
+                    self.promptType = 'raster'
                 elif cmdtype=='v':
-                    self.maptype = 'vect'
+                    self.promptType = 'vector'
                 elif cmdtype=='r3':
-                    self.maptype = 'rast3d'
-                    
-            if self.promptType and self.promptType in ('raster', 'vector'):
+                    self.promptType = 'raster3d'
+                
+            if self.promptType and self.promptType in ('raster', 'raster3d', 'vector'):
                 self.autoCompList = self.mapList[self.promptType]
                 self.AutoCompShow(lenEntered = 0, itemList = ' '.join(self.autoCompList))
             
@@ -886,10 +879,9 @@ class GPromptSTC(GPrompt, wx.stc.StyledTextCtrl):
         
     def GetTextLeft(self):
         """!Returns all text left of the caret"""
-        entry = ''
         pos = self.GetCurrentPos()
         self.HomeExtend()
-        entry = self.GetSelectedText().strip()
+        entry = self.GetSelectedText()
         self.SetCurrentPos(pos)
         
         return entry