Commits

Ali Gholami Rudi  committed 6ac5d86

Fixed problems with removing search status text

  • Participants
  • Parent commits ad9e3aa

Comments (0)

Files changed (7)

File docs/dev/issues.txt

 * Better `WordRangeFinder`
 
 
+Distributing Refactorings
+=========================
+
+When a library performs a refactoring, user code breaks.  There is
+noway of fixing that since library developers cannot access user code.
+One way for solve this might be writing scripts that can be used by
+users of the library to repeat the refactoring in their own projects.
+
+We can add a ``record_refactorings`` option to project config.  If
+`True` refactorings will be saved in the
+``.ropeproject/refactorings`` file.
+
+Issues:
+
+* Should users use the new version of the library or the old one?
+* Should the library be changed in parallel if using the old version?
+* What if there are more than one refactoring?
+* Refactorings are not the only cause for API changes
+* The outcome of the same refactoring might differ
+* Some refactorings are not important
+
+Arguments passed to refactorings:
+
+* Resources
+* ArgumentChangers
+
+Examples::
+
+  rename('rope.base.project.Project', 'NewProject', docs=True)
+  move_module('rope.ide', 'ropeide')
+  inline('rope.base.libutils.path_to_resource')
+  change_signature('mod.f', [ArgumentRemover(2)])
+
+Or::
+
+  def perform(project):
+      resource, offset = resource_and_offset(project,
+                                             'rope.base.project.Project')
+      renamer = Rename(project, resource, offset)
+      project.do(renamer.get_changes('NewProject', docs=True))
+
+
 Insert Before In Restructurings
 ===============================
 

File docs/dev/workingon.txt

 Small Stories
 =============
 
+* Problems when performing moves
+* Not moving relative to absolute imports when moving
+* Moving x to x.y when there an element x.y already exists
+
 * Refactor codeanalyze
 * Adding an option to inline not to remove the definition
 * Renaming ``rope.py`` to ``ropeide.py`` and ``~/.rope`` to

File rope/__init__.py

 """rope, a python refactoring library"""
 
 INFO = __doc__
-VERSION = '0.6.1'
+VERSION = '0.6.2'
 COPYRIGHT = """\
 Copyright (C) 2006-2007 Ali Gholami Rudi
 

File rope/ide/codeassist.py

     def __init__(self, template):
         self.template = template
 
-    var_pattern = re.compile(r'((?<=[^\$])|^)\${(?P<variable>[a-zA-Z][\w]*)}')
+    var_pattern = re.compile(r'((?<=[^\$])|^)\${(?P<variable>\w+)}')
 
     def variables(self):
         """Get template variables

File rope/refactor/inline.py

         self.pyname = codeanalyze.get_pyname_at(self.pycore, resource, offset)
         self.name = codeanalyze.get_name_at(resource, offset)
 
-    def _check_exceptional_conditions(self):
-        pass
-
-    def get_changes(self):
+    def get_changes(self, task_handle=taskhandle.NullTaskHandle()):
         """Get the changes this refactoring makes"""
 
     def get_kind(self):

File rope/ui/editor.py

         self.text.bind('<Any-KeyPress>', self._search_handler)
         self.text.bind('<BackSpace>', backspace, '+')
         self.text.bind('<FocusOut>', lambda event: self._focus_went_out())
+        self.text.bind('<Destroy>', lambda event: self._focus_went_out(False))
 
     def center_line(self):
         mid = self._get_center_line()
             start, end = end, start
         return start, end
 
-    def _focus_went_out(self):
+    def _focus_went_out(self, save=True):
         if self.searcher.is_searching():
-            self.searcher.end_searching()
+            self.searcher.end_searching(save)
 
     def goto_line(self, lineno, colno=0):
         self.text.mark_set(INSERT, '%d.%d' % (lineno, colno))

File rope/ui/searcher.py

+from rope.ui import statusbar
+
+
+
 class SearchingState(object):
 
     def append_keyword(self, searcher, postfix):
         self.searching_state = ForwardSearching()
         self.current_match = Match(self.starting_index, self.starting_index)
         self.status_text = None
-        if self.editor.status_bar_manager:
-            self.status_text = self.editor.status_bar_manager.\
-                               create_status('search')
+        manager = self.editor.status_bar_manager
+        if manager:
+            try:
+                self.status_text = manager.create_status('search')
+            except statusbar.StatusBarException:
+                self.status_text = manager.get_status('search')
             self.status_text.set_width(35)
         self.update_status_text()
 
         self.editor.highlight_match(self.current_match)
         self.failing = False
 
-    def end_searching(self):
+    def end_searching(self, save=True):
         self.history = self.keyword
-        self.current_match = Match(self.editor.get_insert(),
-                                   self.editor.get_insert())
+        if save:
+            self.current_match = Match(self.editor.get_insert(),
+                                       self.editor.get_insert())
         self._finish_searching()
 
     def is_searching(self):