[Konsole-devel] Fwd: copying tab characters under konsole
Arkadiusz Miskiewicz
arekm at maven.pl
Sun Aug 3 17:01:58 UTC 2008
On Sunday 03 August 2008, Arkadiusz Miskiewicz wrote:
> Unfortunately mouse still copies spaces not tabs :/
>
> Still trying...
Another try.
This time it works, if current char is ' ' then I'm replacing it with '\t'.
I hope that replacing chars == '\0 is safe. Then in while() are reminder
characters until tabstop are set to '\0', too.
In terminal \t is visible as \t. I mean it looks like 8 spaces but can be
mouse-selected as one integral part (so you can't mark individual
"spaces"). After mouse copy && paste to kwriter tab is nicely copied.
Now the question is what I did wrong/broke or what can be wrong
with this fix?
--- 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 18:53:49.831397834 +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'))
+ 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