diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2014-02-27 17:11:23 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2014-02-27 17:11:23 -0300 |
commit | f2a190b0e91947c645698c568b8fd55c59da90a0 (patch) | |
tree | 7bf8983507aa4dc72da2b76796da085f572e223f /Process.c | |
parent | 61bd770689be132ffc64bc585d70721ffb0bb10e (diff) |
New logic for highlighting basenames with spaces
Diffstat (limited to 'Process.c')
-rw-r--r-- | Process.c | 18 |
1 files changed, 12 insertions, 6 deletions
@@ -165,6 +165,7 @@ typedef struct Process_ { #endif int exit_signal; + int basenameOffset; bool updated; #ifdef DEBUG @@ -404,14 +405,19 @@ static inline void Process_writeCommand(Process* this, int attr, int baseattr, R RichString_append(str, attr, this->comm); if (this->pl->highlightBaseName) { int finish = RichString_size(str) - 1; - int space = RichString_findChar(str, ' ', start); + int space = start + this->basenameOffset; if (space != -1) finish = space - 1; - for (;;) { - int slash = RichString_findChar(str, '/', start); - if (slash == -1 || slash > finish) - break; - start = slash + 1; + int colon = RichString_findChar(str, ':', start); + if (colon != -1 && colon < finish) { + finish = colon; + } else { + for (int i = finish - start; i > 0; i--) { + if (this->comm[i] == '/') { + start += i+1; + break; + } + } } RichString_setAttrn(str, baseattr, start, finish); } |