Closed lwandrebeck closed 9 years ago
This works like a charm (around 40% speedup on my system), and as indicated by @ferki probably fixes #328. I have a few style quibbles I'm annotating in the code but besides that, this looks good to merge!
OK, I’ll rename the var. I’ll take a look at merging tests too. I’m for now stuck with « ps e » which gets final term stuck. I’d bet that VARS=bla causes mess, but have yet to find why and where. Of course, the ps termlet executed (echo’d line being modified) in gnome-terminal runs fine, and I don’t get a single line. Of course, it runs fine under gdb. catching on the fly a running and stuck final term with gdb gives: 0x00000036ec077c7c in g_utf8strlen ( p=0x2a470d0 "0;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:.tar=01;31:.tgz=01;31:.arc=01;31:.arj=01;31:.taz=01;31:.lha=01;31:.lzh=01;31:.lzma=01;31:.tlz=01;31:.txz=01;31:.tzo=01;31:_.t7z=0", max=-1) at gutf8.c:234 234 p = g_utf8_next_char (p); (gdb) bt
at /home/lwandrebeck/projets/finalterm/src/TerminalOutput.vala:927
at /home/lwandrebeck/projets/finalterm/src/TerminalOutput.vala:768
at /home/lwandrebeck/projets/finalterm/src/TerminalView.vala:349
at /home/lwandrebeck/projets/finalterm/src/TerminalView.vala:330
at /home/lwandrebeck/projets/finalterm/src/Terminal.vala:118
and then gdb segfaults… Trying to dig…
Opened an issue for "ps e" case. See https://github.com/p-e-w/finalterm/issues/342 .
Have rewritten ps termlet. It’s now even faster (and more commented) than the first changes, runs in under half a second :) Hope coding style will be fine with you. Have tried several examples, without finding any bugs. What do you think of it ?
OK, here we are (I hope) : Cleaned up useless lines from previous local attempts. IFS stays as is. Using '\n' breaks output. ps j will display PPID before PID so we would « break » if we search only for 'PID' instead of ' PID'. PID is by default displayed without a leading space according to a quick look at procps sources. So I guess we may break at a very small uptime and no PID ≥ 1000 (can’t test as my netbook is in the 31k range), but I think it’s quite unlikely. So I’d vote to keep it as is.
Thank you, this looks and works great.
Merged! I have added your name to the about dialog credits.
My pleasure p-e-w :)
This might also fix #328.