From 254804917dcee7444a9e3df156417737914c5dcf Mon Sep 17 00:00:00 2001
From: Marco Biasini <marco.biasini@unibas.ch>
Date: Sun, 20 Feb 2011 12:57:29 +0100
Subject: [PATCH] fix for BZDNG-213

---
 modules/gui/src/python_shell/python_shell_widget.cc | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/modules/gui/src/python_shell/python_shell_widget.cc b/modules/gui/src/python_shell/python_shell_widget.cc
index 16d1d4ac2..f64692410 100644
--- a/modules/gui/src/python_shell/python_shell_widget.cc
+++ b/modules/gui/src/python_shell/python_shell_widget.cc
@@ -42,7 +42,7 @@
 #include <QScrollBar>
 #include <QDirModel>
 #include <QStringList>
-
+#include <QDebug>
 
 /*
  Authors: Marco Biasini, Andreas Schenk
@@ -469,7 +469,7 @@ void PythonShellWidget::OnHistoryDownStateEntered()
 void PythonShellWidget::OnExecuteStateEntered()
 {
   QTextCursor cursor=textCursor();
-  cursor.movePosition(QTextCursor::EndOfLine, QTextCursor::MoveAnchor);
+  cursor.movePosition(QTextCursor::End, QTextCursor::MoveAnchor);
   setTextCursor(cursor);
   set_block_type_(block_edit_start_,textCursor().block(),BLOCKTYPE_CODE);
   insertPlainText(QString(QChar::ParagraphSeparator));
@@ -791,7 +791,10 @@ QString PythonShellWidget::GetCommand()
   QTextCursor cursor(block_edit_start_);
   cursor.movePosition(QTextCursor::End, QTextCursor::KeepAnchor);
   QString text= cursor.selectedText();
-  text.replace(QChar::LineSeparator,"\n");
+  // replace LineSeparator with an empty string, they are used by Qt to 
+  // designate soft line wraps
+  text.replace(QChar::LineSeparator,"");
+  // a real line end
   text.replace(QChar::ParagraphSeparator,"\n");
   return text;
 }
-- 
GitLab