Changeset 1450

Show
Ignore:
Timestamp:
07/02/08 17:54:14 (5 months ago)
Author:
rob
Message:

Refs #18: Changed CTAGS to use line numbers to be able to jump to a file
* added BufferFrame?.findTabOrOpen to combine makeTabActive and open into a single convenience method
* added getNonInlineName for list actions so that they can have the ability to change their title when not an inlinelist
* added -n option to ctags so that it will use the line number as the address in the file

Location:
trunk/peppy
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/peppy/actions/__init__.py

    r1415 r1450  
    375375        return self.id2index[id] 
    376376     
     377    def getNonInlineName(self): 
     378        """When the list isn't an inline menu, get the name that should be used 
     379        as the indicator label for the menu. 
     380        """ 
     381        return _(self.name) 
     382     
    377383    def insertIntoMenu(self,menu,pos=None): 
    378384        self.cache.resetIndex() 
     
    393399            # Inline list should always use a localized name for the pop-right 
    394400            # indicator 
    395             self._insertMenu(menu, pos, child, _(self.name),True) 
     401            self._insertMenu(menu, pos, child, self.getNonInlineName(),True) 
    396402            self.topindex=pos 
    397403            pos=0 
  • trunk/peppy/frame.py

    r1435 r1450  
    694694            mode.showInitialPosition(url) 
    695695        return mode is not None 
     696     
     697    def findTabOrOpen(self, url): 
     698        """Find a tab that contains this URL, otherwise open a new tab""" 
     699        if not self.makeTabActive(url): 
     700            self.open(url) 
    696701 
    697702    def open(self, url, modecls=None, mode_to_replace=None, force_new_tab=False, created_from_url=None): 
  • trunk/peppy/plugins/error_log.py

    r1439 r1450  
    237237     
    238238    def open(self, url): 
    239         if not self.major.frame.makeTabActive(url): 
    240             self.major.frame.open(url) 
     239        self.major.frame.findTabOrOpen(url) 
    241240 
    242241class ErrorLogPlugin(IPeppyPlugin): 
  • trunk/peppy/plugins/project.py

    r1443 r1450  
    159159    menumax = 20 
    160160 
     161    def isEnabled(self): 
     162        return bool(self.mode.project_info) and hasattr(self, 'tags') and bool(self.tags) 
     163 
     164    def getNonInlineName(self): 
     165        lookup = self.mode.check_spelling[0] 
     166        dprint(lookup) 
     167        return lookup or "ctags unavailable" 
     168 
    161169    def getItems(self): 
    162170        # Because this is a popup action, we can save stuff to this object. 
     
    171179        return [_('No suggestions')] 
    172180     
    173     def isEnabled(self): 
    174         return bool(self.mode.project_info) and hasattr(self, 'tags') and bool(self.tags) 
    175  
    176     def action(self, index=-1, multiplier=1): 
    177         dprint(self.tags[index]) 
     181    def action(self, index=-1, multiplier=1): 
     182        file = self.tags[index][0] 
     183        addr = self.tags[index][1] 
     184        dprint("opening %s at line %s" % (file, addr)) 
     185        try: 
     186            line = int(addr) 
     187            file = "%s#%d" % (file, line) 
     188        except: 
     189            pass 
     190        self.frame.findTabOrOpen(file) 
    178191 
    179192 
     
    348361        PathParam('ctags_command', 'exuberant-ctags', 'Path to ctags command', fullwidth=True), 
    349362        PathParam('ctags_tag_file_name', 'tags', 'name of the generated tags file', fullwidth=True), 
    350         StrParam('ctags_args', '-R ', 'extra arguments for the ctags command', fullwidth=True), 
     363        StrParam('ctags_args', '-R -n', 'extra arguments for the ctags command', fullwidth=True), 
    351364        ) 
    352365