Anonymous avatar Anonymous committed 96ee9cc

Better normal text files indenting

Comments (0)

Files changed (5)

 * reST highlighting
 
 
+* What to do when the program has syntax errors for code assists @ 2
+
+
 * Show PyDoc
 
 
   * Showing modified file status
 
 
-* Enhancing auto-completion @ 6h
-
-  * What to do when the program has syntax errors
-  * Sorting proposals
+* Sorting code assist proposals @ 5h
 
 
 Remaining Stories

docs/workingon.txt

+Sorting code assist proposals @ 5h
+==================================
+
+
 Pre-Release Refactorings
 ========================
 
 * Eliminate FilteredPackage
 * Each PyPackage should have
 
-
   * The list of available children; derived from `__init__.py` or imports/froms
   * An import_name function that throws exception if the name cannot be found
 
         def select_prev(event):
             active = found.index(ACTIVE)
             if active - 1 >= 0:
+                found.select_clear(0, END)
+                found.selection_set(active - 1)
                 found.activate(active - 1)
                 found.see(active - 1)
         found.bind('<Control-p>', select_prev)
         def select_next(event):
             active = found.index(ACTIVE)
             if active + 1 < found.size():
+                found.select_clear(0, END)
+                found.selection_set(active + 1)
                 found.activate(active + 1)
                 found.see(active + 1)
         found.bind('<Control-n>', select_next)
         super(NormalIndenter, self).__init__(editor)
 
     def correct_indentation(self, lineno):
-        pass
+        prev_indents = 0
+        if lineno > 1:
+            prev_indents = self._count_line_indents(lineno - 1)
+        self._set_line_indents(lineno, prev_indents)
         
-    def entering_new_line(self, lineno):
-        pass
-
 
 class PythonCodeIndenter(TextIndenter):
     def __init__(self, editor):

ropetest/indentertest.py

         self.indenter.entering_new_line(4)
         self.assertEquals('def f():\n    print "hey"\n\n', self.editor.get_text())
 
-        
+    def test_indenting_a_line_like_the_previous_line(self):
+        self.editor.set_text('    line1\nline2')
+        indenter = NormalIndenter(self.editor)
+        indenter.correct_indentation(2)
+        self.assertEquals('    line1\n    line2', self.editor.get_text())
+
+    def test_indenting_the_first_line(self):
+        self.editor.set_text('    line1\n')
+        indenter = NormalIndenter(self.editor)
+        indenter.correct_indentation(1)
+        self.assertEquals('line1\n', self.editor.get_text())
+
+
 if __name__ == '__main__':
     unittest.main()
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.