patchGNU Octave - Patches: patch #9024, Colour-coded output text

 
 

patch #9024: Colour-coded output text

Submitted by:  Lachlan Andrew <lachlan>
Submitted on:  Fri 10 Jun 2016 09:22:05 AM UTC  
 
Category: Core : new featurePriority: 5 - Normal
Status: NonePrivacy: Public
Assigned to: Lachlan Andrew <lachlan>Open/Closed: Open

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

(Jump to the original submission Jump to the original submission)

Sun 26 Jun 2016 07:05:05 AM UTC, comment #16:

Yes, the command window widget implementations are entirely different for Windows and Unix.

I would like to merge them into one and handle I/O in a completely different way, probably such that any pager will have to be built-in to Octave instead of using an external program. I don't think that limitation will cause a lot of trouble for most users. AFAIK, Matlab can't do 'system ("emacs")'.

I don't know what this would mean for color-coded output, but I expect that it would allow us to do a better job.

But the main reasons that I want to make this change are that I think it will allow better interrupt and event handling and it will simplify maintenance by having one implementation of the command window.

John W. Eaton <jwe>
Project Administrator
Sun 26 Jun 2016 12:27:20 AM UTC, comment #15:

Thanks, Philip.

The command window is completely different in posix and windows. I'm not sure why it has to be; they just forked from different applications (Konsole for posix and cygwin for Windows). I think that it would be good to try to port Konsole to Windows, because it also has some support for hyperlinks. (I'm currently working on hyperlinking error messages to open the editor at the right position.)

The big advantage of using escape sequences is that the pager will set the colours each time it redraws the screen to go backwards or forwards. I don't think that is possible if the mechanism to set the colour is not based on the character stream itself. Having said that, the reason for having a new class rather than just storing a list of escape sequences is to allow that sort of flexibility, if it turns out to be necessary.

Lachlan Andrew <lachlan>
Project MemberIn charge of this item.
Sat 25 Jun 2016 09:34:20 PM UTC, comment #14:

GUI screenshot attached. More or less similar results with the CLI.

Yes I think on Windows in the GUI ANSI sequences aren't recognized/processed.

I'll try Linux later on - rebuilding w/o patches from a fresh clone from before John's doc changes followed by cross-building + installing needs due attention and it's almost midnight here :-)

Like you I fail to see how any of the patches I included could affect the color cset.
In libgui/src/ you might follow the sources to see if there are specific Windows clauses that could give a clue. AFAIU the GUI terminal on Windows is different than the one on *nix.
Maybe ANSI sequences should be dropped in favor of the way terminal font colors are set in the terminal preferences tab? I suppose JWE prefers identical code paths for as much OSes as possible.

(file #37577)

Philip Nienhuis <philipnienhuis>
Project Member
Sat 25 Jun 2016 12:11:58 PM UTC, comment #13:

For Windows, can you see what happens (with or without the patch) with the code

It should turn the text red. If it doesn't, then the Windows terminal doesn't accept ANSI escape sequences, and I have no idea how to change the colours.

The Linux case is puzzling. If you put

in your .octaverc? It should output the appropriate character whenever the system would normally try to change colour.

Although none of the patches you have should affect the compile error, it is possible that one is affecting the behaviour. Could you try it on a the default head?

Lachlan Andrew <lachlan>
Project MemberIn charge of this item.
Fri 24 Jun 2016 10:23:31 PM UTC, comment #12:

After JWE pushed a fix to mxe-octave I can build again for Windows.

Intriguingly, the patch does nothing on Windows. I don't know the cause, but the fonts remain black :-Z

Philip Nienhuis <philipnienhuis>
Project Member
Thu 23 Jun 2016 07:24:33 PM UTC, comment #11:

I really have no idea what could cause that error.
Nor do I ....
But I have updated my mxe-octave tree (three times in fact, due to other cross-build errors) and at least dev Octave gets built for 32-bits now (64-bits pending).

I tried your 1st patch on Linux and have some comments:

- After starting Octave, all text is black.

- After deliberately typing garbage the error message is shown in red and only then the prompt changes to blue.

- Then, after "1 / 0" (w/o quotes) the error message is in black, cursor in blue

- after a valid statement the cursor changes back to black.

Conclusion: overall it works but there are some small glitches.

To repeat myself (comment #3): I like the idea.

(cross-building now)

Philip Nienhuis <philipnienhuis>
Project Member
Wed 22 Jun 2016 09:44:10 AM UTC, comment #10:

Here's an updated patch reflecting the change to docstring format.

It doesn't address Philip's concerns about MXE. I really have no idea what could cause that error.

(file #37542)

Lachlan Andrew <lachlan>
Project MemberIn charge of this item.
Sat 18 Jun 2016 09:50:08 AM UTC, comment #9:

Yes, this time I did use the latest tip (now two days old). I haven't checked those patches, but I don't think they should cause the problem you see. It is related to something JWE did a few weeks ago, introducing the "octave::" namespace.

The function should be defined in oct-env.h, which is included at about line 32 of pager.cc. Does your oct-env.h have "namespace octave" at line 60, or thereabouts?

You can also check that, for example, kpse.cc uses the same octave::sys::env::getenv().

Does the new MXE build without this patch?

Lachlan Andrew <lachlan>
Project MemberIn charge of this item.
Fri 17 Jun 2016 07:34:08 PM UTC, comment #8:

bug 4149 should be bug 47149

Philip Nienhuis <philipnienhuis>
Project Member
Fri 17 Jun 2016 07:33:18 PM UTC, comment #7:

Here are some errors that came up:

- 1 hunk FAILED in cmd-edit.h (was easy to fix)

then:

Did you use the latest tip?

I do and have these latest patches/csets applied from:
- patch 8656
- bug 36372
- bug 46632
- bug 4149
- bug 47414
- patch 8956
- and patch 9024

Philip Nienhuis <philipnienhuis>
Project Member
Fri 17 Jun 2016 04:00:37 PM UTC, comment #6:

Ah so you beat me (I got only ~10 patches at a time) :-)

I'll give it a try.
I'm afraid it is time to renew my mxe-octave build tree (3 months old) so it'll be while.

Philip Nienhuis <philipnienhuis>
Project Member
Wed 15 Jun 2016 03:20:54 PM UTC, comment #5:

Sorry about the messy patch. I have about 30 patches on my system, and some of them conflicted with this.

I think I've fixed the problems that were causing those errors.

Now let's see what new errors come up :)

(file #37489)

Lachlan Andrew <lachlan>
Project MemberIn charge of this item.
Tue 14 Jun 2016 11:42:23 PM UTC, comment #4:

OK, I'll look into those errors. Thanks for giving it a test run.

Lachlan Andrew <lachlan>
Project MemberIn charge of this item.
Tue 14 Jun 2016 05:54:15 PM UTC, comment #3:

Symlinking pager.h in liboctave/util from lininterp/corefcn (a dirty hack) + fixing the FAILED hunk made the build continue and it works on Mageia-5.
I can say that I like the result.

Too bad it doesn't cross-build with mxe-octave (with pager.h copied into liboctave/util):

Philip Nienhuis <philipnienhuis>
Project Member
Mon 13 Jun 2016 07:45:34 PM UTC, comment #2:

I get this with tip of June 13:

Note that there was also a FAILED hunk in error.cc

Philip Nienhuis <philipnienhuis>
Project Member
Mon 13 Jun 2016 09:53:48 AM UTC, comment #1:

Note the patch accidentally has tabs in it. I'll remove them from the next version, but will wait for feedback first.

Lachlan Andrew <lachlan>
Project MemberIn charge of this item.
Fri 10 Jun 2016 09:22:05 AM UTC, original submission:

This patch colour-codes the console output to make errors stand out.

It divides output into five "contexts":

1. User output (default)
2. Errors (red)
3. Warnings (brown)
4. The command line (blue)
5. "system" output, such as the line at which a breakpoint occurs.
(green)

Each context is started by a user-definable ANSI escape sequence, which could optionally be set to, for example, underline or bold. The sequences are not limited to ANSI sequences, but other sequences may not be passed through the "less" pager.

This may be considered eye-candy, but I find that it helps me parse a screenful of text.

Lachlan Andrew <lachlan>
Project MemberIn charge of this item.

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by jwe (Posted a comment)
  • -unavailable- added by lachlan (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 07 Jul 2016 01:36:38 AM UTClachlanCategoryNone=>Core : new feature
    Sat 25 Jun 2016 09:34:20 PM UTCphilipnienhuisAttached File-=>Added Octave_terminal_colors.png, #37577
    Wed 22 Jun 2016 09:44:10 AM UTClachlanAttached File-=>Added patch_coloured_font_context.v2.cset, #37542
    Wed 15 Jun 2016 03:20:54 PM UTClachlanAttached File-=>Added patch_coloured_font_context.v1.cset, #37489
    Fri 10 Jun 2016 09:22:05 AM UTClachlanAttached File-=>Added patch_coloured_font_context.cset, #37446

    Back to the top


    Powered by Savane 3.1-cleanup1