Commits

Anonymous committed 3373663

Stopping at capital letters in prev/next word

Comments (0)

Files changed (3)

docs/workingon.txt

 *** Next/prev word should stop at underlines and capitals; make it configurable ***
 
+* Handle MYClass style names
 
 --- Before 0.2 Release ---
 * GUI testing redux; make a ropefunctest direction; ? rename ropetest to ropeunittest
         current = str(self.text.index(INSERT))
         while self.text.compare(current, '!=', 'end-1c') and not self.text.get(current).isalnum():
             current = str(self.text.index(current + ' +1c'))
+        is_upper = self.text.get(current).isupper()
         while self.text.compare(current, '!=', 'end-1c'):
             current = str(self.text.index(current + ' +1c'))
-            if not self.text.get(current).isalnum():
+            if not self.text.get(current).isalnum() or self.text.get(current).isupper():
                 break
         return current
 
         current = str(self.text.index(INSERT))
         while self.text.compare(current, '!=', '1.0') and not self.text.get(current + ' -1c').isalnum():
             current = str(self.text.index(current + ' -1c'))
+        is_upper = self.text.get(current + ' -1c').isupper()
         while self.text.compare(current, '!=', '1.0') and self.text.get(current + ' -1c').isalnum():
             current = str(self.text.index(current + ' -1c'))
+            if  self.text.get(current).isupper():
+                break
         return current
 
     def prev_word(self):

ropetest/editortest.py

         self.editor.next_word()
         self.assertEquals(self.editor.get_index(6), self.editor.get_insert())
 
-    def test_next_word_stopping_at_underline_prev_word(self):
+    def test_prev_word_stopping_at_underline(self):
         self.editor.set_text('sample_text')
         self.editor.set_insert(self.editor.get_end())
         self.editor.prev_word()
         self.assertEquals(self.editor.get_index(7), self.editor.get_insert())
 
-    def testGoingToTheStart(self):
+    def test_next_word_stopping_at_capitals(self):
+        self.editor.set_text('sampleText')
+        self.editor.set_insert(self.editor.get_start())
+        self.editor.next_word()
+        self.assertEquals(self.editor.get_index(6), self.editor.get_insert())
+
+    def test_next_word_stopping_at_capitals2(self):
+        self.editor.set_text('sampleText')
+        self.editor.set_insert(self.editor.get_index(6))
+        self.editor.next_word()
+        self.assertEquals(self.editor.get_end(), self.editor.get_insert())
+
+    # TODO: handle this case
+    def xxx_test_next_word_stopping_at_capitals3(self):
+        self.editor.set_text('sampleMYText')
+        self.editor.set_insert(self.editor.get_index(6))
+        self.editor.next_word()
+        self.assertEquals(self.editor.get_index(8), self.editor.get_insert())
+
+    def test_prev_word_stopping_at_capitals(self):
+        self.editor.set_text('sampleText')
+        self.editor.set_insert(self.editor.get_end())
+        self.editor.prev_word()
+        self.assertEquals(self.editor.get_index(6), self.editor.get_insert())
+
+    def test_prev_word_stopping_at_capitals2(self):
+        self.editor.set_text('sampleText')
+        self.editor.set_insert(self.editor.get_index(7))
+        self.editor.prev_word()
+        self.assertEquals(self.editor.get_index(6), self.editor.get_insert())
+
+    def test_going_to_the_start(self):
         self.editor.set_insert(self.editor.get_index(3))
         self.editor.goto_start()
         self.assertEquals(self.editor.get_start(), self.editor.get_insert())
 
-    def testGoingToTheEnd(self):
+    def test_going_to_the_end(self):
         self.editor.set_insert(self.editor.get_index(3))
         self.editor.goto_end()
         self.assertEquals(self.editor.get_end(), self.editor.get_insert())