Skip to content
This repository was archived by the owner on Aug 27, 2025. It is now read-only.
This repository was archived by the owner on Aug 27, 2025. It is now read-only.

Integrate in the ANSI Escapes in the Eclipse Console plugin #47

Closed

Description

@mihnita

This is to implement the "Make the console ANSI compliant" feature request (112948)

Activity

  1. mihnita commented on Jun 30, 2022

    @mihnita
    ContributorAuthor

    This will bring in the plugin from https://github.com/mihnita/ansi-econsole

    The initial work was tracked by mihnita/ansi-econsole#70
    That issue addressed licensing, and the big picture plan (copy, merging several comments):

    1. As a zeroth step we could consider to take the relevant projects as they are and commit them to the target repository referencing the originating repository-URL and commit-id a second commit could then the changes suggested by Christoph.
      This way we should trace 100% of the changes.
      Contributed code should be "copied" without the history if migrating code to eclipse.
    2. We choose a project for the code to host this (https://github.com/eclipse-platform/eclipse.platform.debug seems suitable as it already contains the console stuff)
    3. You fork that repository, put your bundles in and transform to the eclipse namespace, this should include AnsiConFeature, AnsiConsole and AnsiConTest
    4. integrate them in the build and make sure it succeeds (let us know if you need any help with that!)
    5. You open a PR to merge your code (link this issue as well)
    6. the we will open a CQ for approval as your contribution is >1000 LOC and contains content not only created by you
    7. It hopefully will be approved, we can merge and further proceed / decide / integrate, I think a first step would be to include this then in the usual EPPs gather feedback and fix bugs and then we might change the "standard" console to have ANSI on by default.
  2. mickaelistria commented on Jun 30, 2022

    @mickaelistria
    Contributor

    From Platform POV, I don't think we'll merge in code that create new plugins for that feature. Code should be directly integrated into the existing org.eclipse.ui.console plugin and tests in the existing org.eclipse.debug.tests; a new feature is not necessary.

  3. mihnita commented on Jun 30, 2022

    @mihnita
    ContributorAuthor

    This was the proposal from laeubi to mihnita/ansi-econsole#70 (comment):
    "A separate plugin would make sense here, we can move the code around later if desired, but that way one can 'opt-in' for a while to include ANSI or not."

    I have no opinion, you guys know better. Whatever you decide, I'll do.

    Maybe it is just a bad naming of the issue?
    Feel free to change it, if the current one is confusing.

  4. laeubi commented on Jun 30, 2022

    @laeubi
    Contributor

    @mickaelistria the idea was that the EPP can choose if ANSI should be used / activated or not. If later we decide that it should be the default, code code be moved around without a problem I think.

  5. mickaelistria commented on Jun 30, 2022

    @mickaelistria
    Contributor

    the idea was that the EPP can choose if ANSI should be used / activated or not.

    That can be covered by a preference; and this preference already exists in the contributed code, so I don't think we need more isolation to have ability to control enablement.

    If later we decide that it should be the default, code code be moved around without a problem I think.

    It's more work overall, scattered in several places, and doesn't deliver the value to all users (not everyone uses EPP).
    Here we're talking about ~30 internal classes, the move may not be too hard. I think it will bring the best ROI by fully integrating it directly in org.eclipse.ui.console.

  6. SarikaSinha commented on Jun 30, 2022

    @SarikaSinha
    Member

    the idea was that the EPP can choose if ANSI should be used / activated or not.

    That can be covered by a preference; and this preference already exists in the contributed code, so I don't think we need more isolation to have ability to control enablement.

    If later we decide that it should be the default, code code be moved around without a problem I think.

    It's more work overall, scattered in several places, and doesn't deliver the value to all users (not everyone uses EPP). Here we're talking about ~30 internal classes, the move may not be too hard. I think it will bring the best ROI by fully integrating it directly in org.eclipse.ui.console.

    Yes, a separate package in org.eclipse.ui.console will be enough for isolation.

  7. HannesWell commented on Jun 30, 2022

    @HannesWell
    Member

    the idea was that the EPP can choose if ANSI should be used / activated or not.

    That can be covered by a preference; and this preference already exists in the contributed code, so I don't think we need more isolation to have ability to control enablement.

    If later we decide that it should be the default, code code be moved around without a problem I think.

    It's more work overall, scattered in several places, and doesn't deliver the value to all users (not everyone uses EPP). Here we're talking about ~30 internal classes, the move may not be too hard. I think it will bring the best ROI by fully integrating it directly in org.eclipse.ui.console.

    Mickael's arguments are reasonable for me.
    And given that in the end the goal is to have it integrated tightly, adding it directly to suitable Eclipse plug-ins seams reasonable and save one step leter. Furthermore the ANSI-Console is a mature and long lasting project so I don't expect many problems with it and we are relatively early in the release cycle and therefore have a lot of time to find the ingeration issues.

    I suggest for the very first commit you copy the required class to suitable existing plugins but with the same packages as they are now (and add the URL+commitID of the original). In a second commit you rename the packages to match the names of the other packages in those plug-ins (i.e. org.eclipse...) and then in a third commit 'connect' the new classes with the existing console infra-structure. E.g. add the new preference-entries/pages, remove now unused/invalid elements, fix compile errors etc.

  8. laeubi commented on Jun 30, 2022

    @laeubi
    Contributor

    I don't think we need to "record" all this intermediate steps at all if we not plan to merge these three commits as is. So maybe just copy and adjust the code in one commit would be perfectly fine.

  9. mickaelistria commented on Jun 30, 2022

    @mickaelistria
    Contributor

    I don't think we need to "record" all this intermediate steps at all if we not plan to merge these three commits as is. So maybe just copy and adjust the code in one commit would be perfectly fine.

    +1

  10. HannesWell commented on Jun 30, 2022

    @HannesWell
    Member

    I don't think we need to "record" all this intermediate steps at all if we not plan to merge these three commits as is. So maybe just copy and adjust the code in one commit would be perfectly fine.

    Since it is done anyway I think it wouldn't be bad to hit commit in between, but of course it also can be done as one commit.

  11. mihnita commented on Jul 5, 2022

    @mihnita
    ContributorAuthor

    Some items that I thought about and I don't want to be lost.
    Might open issues for some of them?
    Or if there is a place for documentation.

    But for now:

    • Big limitation: because it implements LineStyleListener, all it can do is take one line of text and return styles.
      It means it can't change anything, no cursor positioning, no screen erase, scrolling, etc.

    • Known bugs

      1. Performance (especially related to the console buffer)
        Console hang issue and slow performance on Windows mihnita/ansi-econsole#66
      2. The color in the C/C++ Build Console does not always work
        Changing C/C++ output text color breaks ansi-econsole mihnita/ansi-econsole#79
      3. Missing escapes once in a while. New in Eclipse 2022-06.
        Escape code ignore sometimes mihnita/ansi-econsole#80
    • TODOs

      1. Add tests
        where: under org.eclipse.debug.tests.console
        how: ???
      2. Commands added in the right click after may be Word Wrap
        TBD what commands. Just enable / disable? Or also copy with / without escapes?
      3. Performance tests & warnings: should we keep them? => Removed
        Should we also change the Eclipse defaults?
      4. Remove "stderr" option? Make it non-optional.
        Works pretty well, no complaints, not bugs.
      5. Add test for the Eclipse Ansi Console in the Ansi Console Plugin.
        Detect the duplication and instruct the users to unistall the plugin.
      6. Some re-org, to make things more like the rest of Eclipse.
        For example move some of the declarations from org.eclipse.ui.console/plugin.xml to org.eclipse.debug.ui/plugin.xml
      7. "Branding" (?) (change "Ansi Console" in UI, maybe class names?)
    • Things I would like to contribute to Eclipse itself:

      • Apply the "hack" that fixes the RTF for both Mac and Linux and Win
        See AnsiClipboardUtils, ESCAPE_SEQUENCE_REGEX_RTF_FIX_SRC & ESCAPE_SEQUENCE_REGEX_RTF_FIX_TRG.
      • HTML in clipboard
      • Performance for documents with many positions, especially when the console buffered is trimmed.
  12. laeubi commented on Jul 5, 2022

    @laeubi
    Contributor

    @mihnita I think once the console it integrated in eclipse it is perfectly valid to migrate the issues here.

  13. mihnita commented on Aug 4, 2022

    @mihnita
    ContributorAuthor

    Testing: I probably need some help to decide how to do it.
    This is a lot about look. How to test that the output looks good?

    Ideas:

    1. Output, then for each line in the StylesText save the List<StyleRange> and compare against some golden files
    2. Output, then copy to clipboard, save the result to a file and compare against some golden files
    3. Screenshots, compare against some golden files

    None of these is perfect.

    For all options: the output can only capture the line ranges still in the control. The lines that are pushed out (because of the small buffer) are not captured.
    And some of the bugs fixed (both functionality and performance) show exactly when the buffer is small.
    So there is no way that I know of to test that.

    Option 2 depends on how the styles are mapped to the clipboard format. Right now the only clipboard format supported is RTF. Any changes in the RTFWriter would break these tests,

    Neither 1 nor 2 don't really capture the visual rendering.

    Option 3 is the method I use for my standalone plugin.
    But requires some plugin to do the screen capture of the widget and save to images.
    It is half-manual (a loop running a small test, capture, clear screen)
    And requires exact match of the configuration: same OS, same font versions, some theme / font / font size, some size of the console widget.


    TLDR: I need some help from someone more familiar with good testing practices for Eclipse.

  14. added this to the 4.25 M3 milestone on Aug 4, 2022
  15. added
    enhancement
    noteworthy
    on Aug 4, 2022
  16. SarikaSinha commented on Aug 4, 2022

    @SarikaSinha
    Member

    This should be included for 4.25 M3 N&N item.
    [email protected]:eclipse-platform/www.eclipse.org-eclipse-news.git
    @mihnita please create a PR to describe the feature in N&N.

  17. mihnita commented on Aug 5, 2022

    @mihnita
    ContributorAuthor

    @SarikaSinha : PR created, eclipse-platform/www.eclipse.org-eclipse-news#49

    Not sure if you are added as reviewer automatically or not.
    Better safe than sorry.

  18. SarikaSinha commented on Aug 5, 2022

    @SarikaSinha
    Member
  19. mihnita commented on Aug 5, 2022

    @mihnita
    ContributorAuthor

    Thanks, will do
    M.

  20. laeubi commented on Aug 8, 2022

    @laeubi
    Contributor

    Some usability problems are reported here: #57

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementnoteworthy

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions