[Konsole-devel] Fwd: copying tab characters under konsole

Arkadiusz Miskiewicz arekm at maven.pl
Sun Aug 3 17:25:40 UTC 2008


On Sunday 03 August 2008, Arkadiusz Miskiewicz wrote:

> Now the question is what I did wrong/broke or what can be wrong
> with this fix?

Small update to avoid doing if c == '\0' { c = '\0' } which is not needed.

--- kdebase-3.5.9/konsole/konsole/TEScreen.cpp	2006-10-01 19:32:08.000000000 +0200
+++ kdebase-3.5.9/konsole/konsole/TEScreen.cpp	2008-08-03 19:16:25.505012119 +0200
@@ -661,7 +661,17 @@
   if (n == 0) n = 1;
   while((n > 0) && (cuX < columns-1))
   {
-    cursorRight(1); while((cuX < columns-1) && !tabstops[cuX]) cursorRight(1);
+    bool smartTab = false;
+    if (image[loc(cuX,cuY)].c == ' ' || image[loc(cuX,cuY)].c == 0) {
+        smartTab = true;
+        image[loc(cuX,cuY)].c = '\t';
+    }
+    cursorRight(1);
+    while((cuX < columns-1) && !tabstops[cuX]) {
+            if (smartTab && image[loc(cuX,cuY)].c == ' ')
+                image[loc(cuX,cuY)].c = '\0';
+	    cursorRight(1);
+    }
     n--;
   }
 }


-- 
Arkadiusz Miśkiewicz        PLD/Linux Team
arekm / maven.pl            http://ftp.pld-linux.org/



More information about the konsole-devel mailing list