I've made an attempt at the ansi code parsing. Colors are hard coded. e2_output_print was modified, but don't know if this is the correct place... The example shows egrep coloring its search terms. Egrep uses GREP_COLOR set to the ansi sequence number to define the color. ANSI sequences basically give up to 4 attributes: bold, blink, color, background. A configuration pane would be needed to map a color (and background) number (0-255) to a gtk color. So the text generating tool can specify a color (as a number), but emelfm2 would define what that exact color would be. On Thu, May 17, 2012 at 7:36 AM, <tpgww@xxxxxxxxxxx> wrote: > On Tue, 15 May 2012 09:14:34 -0500 > Adam Krolnik <adam.krolnik@xxxxxxxxxxxxxxx> wrote: > > > > > One always has to weigh the implementation costs. But one has to also > consider the beneficial aspects. > > > > I've used coloring in two major ways on xterm. > > o print a bar in red/blue to indicate the end of the output and the > exit status. > > This mostly shows the end of the command so that searching backward > in the buffer has a easy to > > recognize termination point. Secondly, the exit status is apparent. > Thus my processing is now truncated > > and thus faster. > > This sort of thing already happens in the e2 output pane. > > > > o highlight my search pattern from egrep. - This also makes reviewing > the results faster due to the > > pattern I searched for being highlighted. I now can do pattern > matching based on color rather than > > have to read all the text of each line to scan for what I'm looking > for - again, speeding my processing. > > Being able to double click on the filename from egrep in emelfm2 to > edit a file, is again a time savings. > > You remind me - long ago I considered adapting the find plugin to show a > matching line as well as the file path. Then forgot about it. > > > > > I've recently setup an alias to vim to pipe color results into so that I > can work with them. Using the > > xterm.vim syntax setup, from Andy Spencer, it converts the ansi escape > colored sequences into vim syntax > > highlighting. Thus I get the patterns highlighted. It simply translates > the color specified in the escape > > sequence to a highlight color name xtermColorN (where N is the color > number from the escape sequence.) > > [my alias is: alias le 'gvim "+set syntax=xterm" -'; This assumes you > already have vim setup for colors, etc. > > And Andy's xterm syntax setup does not set the guifg colors, so if you > use gvim, you won't get color until you > > set that in his script.] > > > > This feature could simply start as a compile time option, only > supporting ANSI escape sequences. > > It appears that GTK does support adding text with color components > > Yes, that's how e2 shows in its output pane red text for error messages > and green (or red) text for command-completion-status messages. > > > , so the transfer could simply lookup > > the desired colors from a configuration color table. > > Not so simple, in practice. > > > > > So yes the time to implement the feature may not be trivial, but the > value is there. There are so many > > features in emelfm2 that took time to implement, but overall make it a > great tool - customizable buttons, > > mouse buttons, click on output pane filenames, etc. All make it faster > for the user to complete the job > > they are doing. > > Implementation time/effort is not an issue, really. In fact, some of the > work for this sort of capability was done, long ago, but abandoned because > I'm more interested to preserve the application's speed, size, minimal > dependencies, no wheel-reinvention, reliability, etc etc - overall, I might > call it "good value". > > Could perhaps just get it going as a build-time define, tell Liviu and you > about it, and the rest of us can get on with our lives ... > > Regards > Tom > > > -- > Users can unsubscribe from the list by sending email to > emelfm2-request@xxxxxxxxxxxxx with 'unsubscribe' in the subject field or > by logging into the web interface. > -- Adam Krolnik
Attachment:
emelfm2-ansi.jpg
Description: JPEG image