Reviewed by John.
authordarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 30 Aug 2004 22:58:27 +0000 (22:58 +0000)
committerdarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 30 Aug 2004 22:58:27 +0000 (22:58 +0000)
        - fixed <rdar://problem/3528538> can paste a Return character into the Search field at amazon.com, other browsers won't

        * kwq/KWQTextField.mm: (-[KWQTextFieldController controlTextDidChange:]):
        Truncate text before the first line break.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@7408 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog-2005-08-23
WebCore/kwq/KWQTextField.mm

index 1f287a90d66443b7e305cd763d5f90f90bc1a30d..0d89f9179c42a7f5700211f52b30ad2f1da6a43d 100644 (file)
@@ -1,3 +1,12 @@
+2004-08-30  Darin Adler  <darin@apple.com>
+
+        Reviewed by John.
+
+        - fixed <rdar://problem/3528538> can paste a Return character into the Search field at amazon.com, other browsers won't
+
+        * kwq/KWQTextField.mm: (-[KWQTextFieldController controlTextDidChange:]):
+        Truncate text before the first line break.
+
 2004-08-30  Darin Adler  <darin@apple.com>
 
         * kwq/KWQTextCodec.mm: (KWQTextDecoder::convertOneChunkUsingTEC):
index bd0d8655b0a93a144fe4a254c5bc125c48ea24e2..8c674b86b9198fbe6d2b8cb69b1dc483cea281d0 100644 (file)
     if (KWQKHTMLPart::handleKeyboardOptionTabInView(field))
         return;
     
+    // If someone puts a CR or LF in, truncate up to that character.
+    NSString *string = [field stringValue];
+    NSRange newline = [string rangeOfCharacterFromSet:[NSCharacterSet characterSetWithCharactersInString:@"\r\n"]];
+    if (newline.location != NSNotFound)
+        [field setStringValue:[string substringToIndex:newline.location]];
+
     WebCoreBridge *bridge = KWQKHTMLPart::bridgeForWidget(widget);
     [bridge controlTextDidChange:notification];