sakachin2 / XE

SPF line Editor xe
26 stars 4 forks source link

how to colorize files in edit mode depending on the file extension #10

Open chuck-haatvedt opened 2 years ago

chuck-haatvedt commented 2 years ago

after years of using ISPF on the mainframe and then using SPF/SE on windows, I'm looking for a way to colorize COBOL files in the xe or gxe edit session.

is that possible with the Hybrid XE editor ?

if so, any information on how to do it would be greatly appreciated.

   Thanks,

Chuck Haatvedt

SaiSridhargithub commented 2 years ago

I use xe with highlight installed. Highlight is a syntax highlighter that provides a nice way to do different colors to the syntax. there is documentation in XE on how to install highlight. highlight should support COBOL. A little round about way but much easier way to achieve what you need. highlight is available for linux and should be available for other OS as well

chuck-haatvedt commented 2 years ago

I have highlight installed and working on Lubuntu 22.10 however I have a couple of questions.

is it possible to set the background color in the attribute list ?

for example for strings I would like to have them foreground black and background yellow..

another possible option I could use would be a reverse-video attribute.

on another note. is it possible to use --output-format xterm256 with gxe or xe ?

and if so are there different themes that need to be used for that ?

SaiSridhargithub commented 2 years ago

Glad you have highlight working. i have limited success on using color options on the highlight command at xesynl.cfg. what works for me is: SHCMDA= "/usr/bin/highlight -q --out-format=ansi"

I am on debian and ubuntu install but all behave the same. My best bet has been to use 0 option in ISPF and play with colors, using the color palette. It then changes color on the highlighted syntax too.

sakachin2 commented 2 years ago

xe only supports ansi format. The ansi format is supported by both Andre Simon's highlight and GNU's source-highlight. xe expected 0x1b[bg;fgm (bg:background color:41-->47, fg:forground color:31-->37) for the revers display, but 0x1b[07;fgm (07: is reverse attribute) was not expected. The next version will support this, but As a workaround, a method of replacing fg with bg by intermediate shell script is also conceivable. "s/[04;3([0-9])m/[30;4\1m/g" #1b[04;3xm--> 1b[4xm aviding to replace 1b[04;3x;4ym

I haven't confirmed the output of the reverse code in both highlighters. Since the output of Underline 0x1b[04m; has been confirmed, we will also add an option to reverse underline. In other words, when specified in xesynl.cfg and xesynw.cfg, the underline specification is treated as reverse. G_UNDERLINE=R #for wxe and gxe C_UNDERLINE=R #for cmdline xe

sakachin2 commented 1 year ago

Please try v1.29T.