changeset 13630:36377bdd91f7

Solved decoding issue for first unicode characters, like backspace and bell.
author Jacob Dawid <jacob.dawid@googlemail.com>
date Thu, 18 Aug 2011 23:51:50 +0200
parents 1686eae6d2e9
children 9ad313bcee2d
files gui/src/OctaveTerminal.cpp
diffstat 1 files changed, 19 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/gui/src/OctaveTerminal.cpp	Thu Aug 18 22:54:58 2011 +0200
+++ b/gui/src/OctaveTerminal.cpp	Thu Aug 18 23:51:50 2011 +0200
@@ -199,7 +199,25 @@
 {
   QTextCursor tc = textCursor ();
   tc.movePosition (QTextCursor::End);
-  tc.insertText (data);
+
+  // Decode data into cursor actions.
+  foreach(QChar character, data)
+    {
+      unsigned short unicode = character.unicode ();
+      switch (unicode)
+        {
+          case 0: // Null
+            break;
+          case 7: // Bell
+            break;
+          case 8: // Backspace
+            tc.deletePreviousChar ();
+            break;
+          default:
+            tc.insertText (character);
+            break;
+        }
+    }
   setTextCursor (tc);
 
   if (verticalScrollBar ())