[Idle-dev] CVS: idle EditorWindow.py,1.29,1.30

Kurt B. Kaiser kbk@users.sourceforge.net
Sun, 15 Sep 2002 14:31:32 -0700


Update of /cvsroot/idlefork/idle
In directory usw-pr-cvs1:/tmp/cvs-serv29560

Modified Files:
	EditorWindow.py 
Log Message:
Merge Py Idle's changes to AutoIndent.py into EditorWindow.py since
EditorWindow has incorporated AutoIndent

Rev 1.17
classifyws():  Fix a "/" to work under -Qnew (as well as without it).
Bugfix candidate!

Rev 1.18 
(Already merged)

Rev 1.19
smart_backspace_event():  remove now-pointless int() call.
Bugfix candidate:  the current state of AutoIdent.py should be in 2.2.1.

Rev 1.20
Apply diff2.txt from SF patch http://www.python.org/sf/572113
(with one small bugfix in bgen/bgen/scantools.py)
This replaces string module functions with string methods
for the stuff in the Tools directory. Several uses of
string.letters etc. are still remaining.


Index: EditorWindow.py
===================================================================
RCS file: /cvsroot/idlefork/idle/EditorWindow.py,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -r1.29 -r1.30
*** EditorWindow.py	14 Sep 2002 02:40:17 -0000	1.29
--- EditorWindow.py	15 Sep 2002 21:31:30 -0000	1.30
***************
*** 1,5 ****
  import sys
  import os
- import string
  import re
  import imp
--- 1,4 ----
***************
*** 914,919 ****
          # Ick.  It may require *inserting* spaces if we back up over a
          # tab character!  This is written to be clear, not fast.
!         expand, tabwidth = string.expandtabs, self.tabwidth
!         have = len(expand(chars, tabwidth))
          assert have > 0
          want = ((have - 1) // self.indentwidth) * self.indentwidth
--- 913,918 ----
          # Ick.  It may require *inserting* spaces if we back up over a
          # tab character!  This is written to be clear, not fast.
!         tabwidth = self.tabwidth
!         have = len(chars.expandtabs(tabwidth))
          assert have > 0
          want = ((have - 1) // self.indentwidth) * self.indentwidth
***************
*** 922,926 ****
              chars = chars[:-1]
              ncharsdeleted = ncharsdeleted + 1
!             have = len(expand(chars, tabwidth))
              if have <= want or chars[-1] not in " \t":
                  break
--- 921,925 ----
              chars = chars[:-1]
              ncharsdeleted = ncharsdeleted + 1
!             have = len(chars.expandtabs(tabwidth))
              if have <= want or chars[-1] not in " \t":
                  break
***************
*** 956,961 ****
                      pad = '\t'
                  else:
!                     effective = len(string.expandtabs(prefix,
!                                                       self.tabwidth))
                      n = self.indentwidth
                      pad = ' ' * (n - effective % n)
--- 955,959 ----
                      pad = '\t'
                  else:
!                     effective = len(prefix.expandtabs(self.tabwidth))
                      n = self.indentwidth
                      pad = ' ' * (n - effective % n)
***************
*** 1122,1126 ****
          tabwidth = self._asktabwidth()
          for pos in range(len(lines)):
!             lines[pos] = string.expandtabs(lines[pos], tabwidth)
          self.set_region(head, tail, chars, lines)
  
--- 1120,1124 ----
          tabwidth = self._asktabwidth()
          for pos in range(len(lines)):
!             lines[pos] = lines[pos].expandtabs(tabwidth)
          self.set_region(head, tail, chars, lines)
  
***************
*** 1163,1172 ****
              tail = text.index("insert lineend +1c")
          chars = text.get(head, tail)
!         lines = string.split(chars, "\n")
          return head, tail, chars, lines
  
      def set_region(self, head, tail, chars, lines):
          text = self.text
!         newchars = string.join(lines, "\n")
          if newchars == chars:
              text.bell()
--- 1161,1170 ----
              tail = text.index("insert lineend +1c")
          chars = text.get(head, tail)
!         lines = chars.split("\n")
          return head, tail, chars, lines
  
      def set_region(self, head, tail, chars, lines):
          text = self.text
!         newchars = "\n".join(lines)
          if newchars == chars:
              text.bell()