From: Marcus Eggenberger Date: Wed, 6 Feb 2008 13:17:54 +0000 (+0000) Subject: made the check for lineseperators OS independent X-Git-Tag: 0.2.0-alpha1~107 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=1bd0b3710fe361c778bc5b5a726353e205d16eaf made the check for lineseperators OS independent --- diff --git a/src/uisupport/inputline.cpp b/src/uisupport/inputline.cpp index 7d863fe0..fe84cecf 100644 --- a/src/uisupport/inputline.cpp +++ b/src/uisupport/inputline.cpp @@ -81,12 +81,30 @@ void InputLine::on_returnPressed() { } 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(); - 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); } + } + diff --git a/version.inc b/version.inc index 533e953f..96c2078c 100644 --- a/version.inc +++ b/version.inc @@ -5,7 +5,7 @@ quasselVersion = "0.2.0-pre"; quasselDate = "2008-02-06"; - quasselBuild = 472; + quasselBuild = 473; //! Minimum client build number the core needs clientBuildNeeded = 464;