made the check for lineseperators OS independent
authorMarcus Eggenberger <egs@quassel-irc.org>
Wed, 6 Feb 2008 13:17:54 +0000 (13:17 +0000)
committerMarcus Eggenberger <egs@quassel-irc.org>
Wed, 6 Feb 2008 13:17:54 +0000 (13:17 +0000)
src/uisupport/inputline.cpp
version.inc

index 7d863fe..fe84cec 100644 (file)
@@ -81,12 +81,30 @@ void InputLine::on_returnPressed() {
 }
 
 void InputLine::on_textChanged(QString newText) {
 }
 
 void InputLine::on_textChanged(QString newText) {
-  if(newText.contains('\n')) {
+  QStringList lineSeperators;
+  lineSeperators << QString("\r\n")
+                << QString('\n')
+                << QString('\r');
+  
+  QString lineSep;
+  foreach(QString seperator, lineSeperators) {
+    if(newText.contains(seperator)) {
+      lineSep = seperator;
+      break;
+    }
+  }
+
+  if(lineSep.isEmpty())
+    return;
+  
+  if(newText.contains(lineSep)) {
     clear();
     clear();
-    QString line = newText.section('\n', 0, 0);
-    QString remainder = newText.section('\n', 1);
+    QString line = newText.section(lineSep, 0, 0);
+    QString remainder = newText.section(lineSep, 1);
     insert(line);
     emit returnPressed();
     insert(remainder);
   }
     insert(line);
     emit returnPressed();
     insert(remainder);
   }
+  
 }
 }
+
index 533e953..96c2078 100644 (file)
@@ -5,7 +5,7 @@
 
   quasselVersion = "0.2.0-pre";
   quasselDate = "2008-02-06";
 
   quasselVersion = "0.2.0-pre";
   quasselDate = "2008-02-06";
-  quasselBuild = 472;
+  quasselBuild = 473;
 
   //! Minimum client build number the core needs
   clientBuildNeeded = 464;
 
   //! Minimum client build number the core needs
   clientBuildNeeded = 464;