commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gnue/forms/src GFDisplayHandler.py


From: Jason Cater
Subject: gnue/forms/src GFDisplayHandler.py
Date: Fri, 12 Apr 2002 12:09:55 -0400

CVSROOT:        /cvsroot/gnue
Module name:    gnue
Changes by:     Jason Cater <address@hidden>    02/04/12 12:09:54

Modified files:
        forms/src      : GFDisplayHandler.py 

Log message:
        fix for cr/lf on win32 (without actually storing cr/lf in the database)

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/GFDisplayHandler.py.diff?tr1=1.18&tr2=1.19&r1=text&r2=text

Patches:
Index: gnue/forms/src/GFDisplayHandler.py
diff -c gnue/forms/src/GFDisplayHandler.py:1.18 
gnue/forms/src/GFDisplayHandler.py:1.19
*** gnue/forms/src/GFDisplayHandler.py:1.18     Sun Mar 31 14:27:45 2002
--- gnue/forms/src/GFDisplayHandler.py  Fri Apr 12 12:09:54 2002
***************
*** 70,76 ****
  
  
    def generateRefreshEvent(self):
!     self.dispatchEvent(GFEvent('updateEntryEditor',
             object = self.entry,
             display=self.display,
             cursor=self.cursor,
--- 70,85 ----
  
  
    def generateRefreshEvent(self):
!     # TODO: this should probably actually happen in UIwxpython!
!     if self.handleCR:
!       self.dispatchEvent(GFEvent('updateEntryEditor',
!            object = self.entry,
!            display=self.display, # string.replace(self.display,'\n','\r\n'),
!            cursor=self.cursor + 
len(string.split(self.display[:self.cursor+1],'\n'))-1,
!            selection=self.getSelectionArea(),
!          ))
!     else:
!       self.dispatchEvent(GFEvent('updateEntryEditor',
             object = self.entry,
             display=self.display,
             cursor=self.cursor,
***************
*** 78,84 ****
           ))
  
  
- 
    #####################
    #
    # Editing methods
--- 87,92 ----
***************
*** 170,181 ****
        self.selection1 = self.cursor
        self.selection2 = self.selection1 + 1
  
!     # if we want to add a newline and are under windows
!     # replace it with \13\10
! 
!     if event.text == '\n' and sys.platform == 'win32':
!       event.text = chr(13) + chr(10)
!       value = event.text
  
      if self.selection1 != None:
        # If text is selected, then we will replace
--- 178,188 ----
        self.selection1 = self.cursor
        self.selection2 = self.selection1 + 1
  
! ##    # win: if we want to add a newline and are under windows
! ##    # replace it with \13\10
! ##    if event.text == '\n' and sys.platform == 'win32':
! ##      event.text = chr(13) + chr(10)
! ##      value = event.text
  
      if self.selection1 != None:
        # If text is selected, then we will replace
***************
*** 220,228 ****
      if self.cursor != precurs:
        event.overstrike = 1
        event.text = ""
!       # win: if deleting a new line, delete both of its characters       
!       if ord(self.work[self.cursor]) == 13 and sys.platform == 'win32':
!         self.addText(event)
        
        self.addText(event)
  
--- 227,235 ----
      if self.cursor != precurs:
        event.overstrike = 1
        event.text = ""
! ##      # win: if deleting a new line, delete both of its characters
! ##      if ord(self.work[self.cursor]) == 13 and sys.platform == 'win32':
! ##        self.addText(event)
        
        self.addText(event)
  
***************
*** 230,238 ****
    def delete(self, event):
      event.overstrike = 1
      event.text = ""
!     # win: if deleting a new line, delete both of its characters 
!     if self.cursor < len(self.work) and ord(self.work[self.cursor]) == 13 and 
sys.platform == 'win32':
!       self.addText(event)
      
      self.addText(event)
  
--- 237,245 ----
    def delete(self, event):
      event.overstrike = 1
      event.text = ""
! ##    # win: if deleting a new line, delete both of its characters
! ##    if self.cursor < len(self.work) and ord(self.work[self.cursor]) == 13 
and sys.platform == 'win32':
! ##      self.addText(event)
      
      self.addText(event)
  
***************
*** 259,267 ****
  
      if self.cursor > 0:
        self.cursor -= 1
!       # win: step over both of newline's characters
!       if ord(self.work[self.cursor]) == 10 and sys.platform == 'win32':
!         self.cursor -= 1
  
    def moveCursorRight(self, event, selecting=0):
      if not selecting:
--- 266,274 ----
  
      if self.cursor > 0:
        self.cursor -= 1
! ##      # win: step over both of newline's characters
! ##      if ord(self.work[self.cursor]) == 10 and sys.platform == 'win32':
! ##        self.cursor -= 1
  
    def moveCursorRight(self, event, selecting=0):
      if not selecting:
***************
*** 269,277 ****
  
      if self.cursor < len(self.display):
        self.cursor += 1
!       # win: step over both of newline's characters      
!       if ord(self.work[self.cursor-1]) == 13 and sys.platform == 'win32':
!         self.cursor += 1        
  
  
    def moveCursorToEnd(self, event, selecting=0):
--- 276,284 ----
  
      if self.cursor < len(self.display):
        self.cursor += 1
! ##      # win: step over both of newline's characters
! ##      if ord(self.work[self.cursor-1]) == 13 and sys.platform == 'win32':
! ##        self.cursor += 1        
  
  
    def moveCursorToEnd(self, event, selecting=0):
***************
*** 396,401 ****
--- 403,412 ----
      self.selection1 = None    # Start of highlight
      self.selection2 = None    # End of highlight
      self.cursor = 0           # Cursor position
+ 
+     # TODO: replace w/an event that asks the
+     # TODO: UIdriver if this should happen!
+     self.handleCR = sys.platform == "win32"
  
      # Needs to be set by the child classes
      self.formatter = formatter



reply via email to

[Prev in Thread] Current Thread [Next in Thread]