Anonymous avatar Anonymous committed 591a3e6

deciding what to do about multi-byte characters and offsets

Comments (0)

Files changed (3)

docs/dev/issues.txt

 Unresolved Issues
 =================
 
-* files with multi-byte chars and ast.parse()
 * custom restructuring wildcard patterns and replacements
-* line-endings and offsets
 * not reimporting back imports after moving
 * importing compressed objectdb/history data?
 * not applying all commenting mechanisms always in codeassist
   extractor = ExtractVariable(myproject, resource, start, end)
 
 Where `start` and `end` are the offsets of the region to extract in
-resource.
+resource.  Be careful when calculating the offsets.  Dos line-endings
+and multi-byte characters are considered to be only one character.
+This is actually easier for IDEs, since most GUI libraries do that
+when calculating offsets.
 
 Next we need to perform the refactoring.  IDE's usually pop up a
 dialog for letting the user configure refactoring option like the name

rope/base/pyobjectsdef.py

 
     def __init__(self, pycore, source_code,
                  resource=None, force_errors=False):
-        if isinstance(source_code, unicode):
-            source_code = source_code.encode('utf-8')
         self.source_code = source_code
         try:
             ast_node = ast.parse(source_code.rstrip(' \t'))
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.