Anonymous avatar Anonymous committed 8656351

Handled narrowed regions

Comments (0)

Files changed (2)

  Done
 ======
 
+- handling narrowed regions : December 21, 2007
+
 > Public Release 0.4 : December 19, 2007
 
 - supporting emacs 21 : December 18, 2007

ropemacs/__init__.py

     def _get_offset(self):
         return lisp.point() - 1
 
+    def _get_text(self):
+        end = lisp.buffer_size() + 1
+        return lisp.buffer_substring_no_properties(1, end)
+
     @interactive
     def goto_definition(self):
         self._check_project()
         resource, offset = self._get_location()
         definition = codeassist.get_definition_location(
-            self.project, lisp.buffer_string(), offset, resource)
+            self.project, self._get_text(), offset, resource)
         if tuple(definition) != (None, None):
             lisp.push_mark()
             self._goto_location(definition)
         self._check_project()
         resource, offset = self._get_location()
         docs = codeassist.get_doc(
-            self.project, lisp.buffer_string(), offset, resource)
+            self.project, self._get_text(), offset, resource)
         buffer = lisputils.make_buffer('*rope-pydoc*', docs, empty_goto=False)
         lisp.local_set_key('q', lisp.bury_buffer)
 
                 arg = len(names)
             common_start = self._calculate_prefix(names[:arg])
             lisp.insert(common_start[self._get_offset() - starting_offset:])
-        source = lisp.buffer_string()
+        source = self._get_text()
         offset = self._get_offset()
         starting = source[starting_offset:offset]
         prompt = 'Completion for %s: ' % starting
     @rawprefixed
     def lucky_assist(self, prefix):
         starting_offset, names = self._calculate_proposals()
-        source = lisp.buffer_string()
+        source = self._get_text()
         offset = self._get_offset()
         starting = source[starting_offset:offset]
         selected = 0
     def _calculate_proposals(self):
         self._check_project()
         resource, offset = self._get_location()
-        source = lisp.buffer_string()
+        source = self._get_text()
         maxfixes = lisp['rope-code-assist-max-fixes'].value()
         proposals = codeassist.code_assist(self.project, source, offset,
                                            resource, maxfixes=maxfixes)
         names = []
         for file in files:
             names.append('<'.join(reversed(file.path.split('/'))))
-        source = lisp.buffer_string()
+        source = self._get_text()
         result = lisputils.ask_values('Rope Find File: ', names, exact=True)
         path = '/'.join(reversed(result.split('<')))
         file = self.project.get_file(path)
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.