Commits

Ali Gholami Rudi  committed 591a3e6

deciding what to do about multi-byte characters and offsets

  • Participants
  • Parent commits 7aec5eb

Comments (0)

Files changed (3)

File 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

File docs/library.txt

   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

File 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'))