commit-gnue
[Top][All Lists]
Advanced

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

[gnue] r8070 - in trunk/gnue-forms/src: input/displayHandlers uidrivers/


From: btami
Subject: [gnue] r8070 - in trunk/gnue-forms/src: input/displayHandlers uidrivers/win32/widgets
Date: Wed, 19 Oct 2005 06:31:59 -0500 (CDT)

Author: btami
Date: 2005-10-19 06:31:59 -0500 (Wed, 19 Oct 2005)
New Revision: 8070

Modified:
   trunk/gnue-forms/src/input/displayHandlers/Cursor.py
   trunk/gnue-forms/src/uidrivers/win32/widgets/_base.py
Log:
fixed multiline edit newline handling in win32 ui

Modified: trunk/gnue-forms/src/input/displayHandlers/Cursor.py
===================================================================
--- trunk/gnue-forms/src/input/displayHandlers/Cursor.py        2005-10-19 
01:46:46 UTC (rev 8069)
+++ trunk/gnue-forms/src/input/displayHandlers/Cursor.py        2005-10-19 
11:31:59 UTC (rev 8070)
@@ -146,9 +146,9 @@
     """
     assert gDebug (5, "generateRefreshEvent on %s '%s' %s" % \
         (self, self.display, self.entry))
+    # TODO: this should probably actually happen in UIwxpython!
     
-    # TODO: this should probably actually happen in UIwxpython!
-    if (self.handleCR and type(self.display)=='str'):
+    if (self.handleCR and type(self.display)=='str'):
       self.dispatchEvent(events.Event('updateEntryEditor',
            object = self.field,
            display=self.display,
@@ -252,7 +252,6 @@
     """
     Handles the adding of new text 
     """
-    
     # Skip if this display handler isn't the one currently being edited
     if not self.editing:
       assert gDebug(5, 
@@ -372,7 +371,7 @@
     """
     if gConfigForms('EnterIsNewLine') and \
        hasattr(self.entry, 'Char__height') and \
-       self.entry.Char__height > 1:
+       self.entry.Char__height > 1:
       event.text = '\n'
       self._addText(event)
       event.drop()
@@ -386,7 +385,7 @@
     Delete backwards one character
     
     @param event: The GFEvent making the request
-    """
+    """
     if not self.editing:
       assert gDebug(5, 
         "Entry %s: Received request to backspace but not in edit mode" % 
@@ -399,15 +398,23 @@
       self._delete(event)
       return
 
-    precurs = self._cursor
+    precurs = self._cursor
     self._moveCursorLeft(event)
 
     if self._cursor != precurs:
       event.overstrike = True
       event.text = ""
 
-      self._addText(event)
+      self._addText(event)
 
+    if sys.platform == "win32":
+      if self._cursor > 0 and self.work[self._cursor-1] == "\r":
+        self._moveCursorLeft(event)
+        
+        event.overstrike = True
+        event.text = ""
+        self._addText(event)
+
   def _delete(self, event):
     """
     Delete forward one character
@@ -432,7 +439,7 @@
     @param event: The GFEvent making the request
     @param selecting: Boolean indicating if text should be selected 
                       as part of the cursor move
-    """
+    """
     if not selecting:
       self._selection1 = None
 
@@ -447,7 +454,7 @@
     @param event: The GFEvent making the request
     @param selecting: Boolean indicating if text should be selected 
                       as part of the cursor move
-    """
+    """
     if not selecting:
       self._selection1 = None
 

Modified: trunk/gnue-forms/src/uidrivers/win32/widgets/_base.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/win32/widgets/_base.py       2005-10-19 
01:46:46 UTC (rev 8069)
+++ trunk/gnue-forms/src/uidrivers/win32/widgets/_base.py       2005-10-19 
11:31:59 UTC (rev 8070)
@@ -283,8 +283,7 @@
       win32gui.SendMessage(hwnd, win32con.EM_SCROLLCARET, 0, 0)
 
       if gfObject._type == 'GFEntry':
-        if gfObject.style == 'dropdown' or gfObject.style == 'listbox' or \
-           command == 'NEWLINE':
+        if gfObject.style == 'dropdown' or gfObject.style == 'listbox':
           return win32gui.CallWindowProc(self._oldWndProc, hwnd, msg, wParam, 
lParam)
       
     elif msg == win32con.WM_COMMAND:
@@ -495,8 +494,10 @@
         else:
           win32gui.SendMessage(self._hwnd, win32con.LB_SETCURSEL, 0, 0)
       else:
-        if hasattr(gfObject,'Char__height') and gfObject.Char__height > 1:
-          corrvalue = '\r\n'.join (value.splitlines ())
+        if hasattr(gfObject,'Char__height') and gfObject.Char__height > 1:
+          corrvalue = '\r\n'.join (value.splitlines ())
+          if len(value) and value[-1] == '\n':
+            corrvalue += '\r\n'
           win32gui.SetWindowText(self._hwnd, corrvalue)
         else:
           win32gui.SetWindowText(self._hwnd, str(value))





reply via email to

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