Skip to content

[BUG] ANSI parsing not complete #833

@nahharris

Description

@nahharris

Describe the bug
I'm trying to render output from delta which contains ansi escape sequences. ansi::parse handles most sequences but not all of them

To Reproduce
Try to provide "simple" (if possible) code to reproduce the bug. If you can't simplify your code, a complete code is better than a simple, but incomplete one.

Expected behavior
Given:

ESC[34m───────────────────────────────────────────────────────────────ESC[0mESC[34m┐ESC[0m
ESC[34m134ESC[0m:ESC[38;5;231m ESC[38;5;81mintESC[38;5;231m ESC[38;5;149mamdgpu_vcn_sw_initESC[38;5;231m(ESC[38;5;81mstructESC[38;5;231m amdgpu_device ESC[38;5;203m*ESC[38;5;208madevESC[38;5;231m, ESC[38;5;81mintESC[38;5;231m ESC[38;5;208miESC[38;5;231m) ESC[0mESC[34m│ESC[0m
ESC[34m───────────────────────────────────────────────────────────────ESC[0mESC[34m┘ESC[0m
ESC[38;5;231m    ESC[38;5;81mintESC[38;5;231m r;ESC[0m

ESC[38;5;231m    mutex_init(ESC[38;5;203m&ESC[38;5;231madev->vcn.inst[i].vcn1_jpeg1_workaround);ESC[0m
ESC[48;5;52m    mutex_init(&adev->vcn.inst[i].ESC[48;5;124mvcn_pg_lockESC[48;5;52m);ESC[0mESC[48;5;52mESC[0KESC[0m
ESC[48;5;22;38;5;231m    mutex_init(ESC[38;5;203m&ESC[38;5;231madev->vcn.inst[i].ESC[48;5;28mdpg_lockESC[48;5;22m);ESC[0mESC[48;5;22mESC[0KESC[0m
ESC[38;5;231m    mutex_init(ESC[38;5;203m&ESC[38;5;231madev->vcn.inst[i].engine_reset_mutex);ESC[0m
ESC[38;5;231m    atomic_set(ESC[38;5;203m&ESC[38;5;231madev->vcn.inst[i].total_submission_cnt, ESC[38;5;141m0ESC[38;5;231m);ESC[0m
ESC[38;5;231m    INIT_DELAYED_WORK(ESC[38;5;203m&ESC[38;5;231madev->vcn.inst[i].idle_work, amdgpu_vcn_idle_work_handler);ESC[0m

I was expecting:

Image

Screenshots
I see:
Image

Environment

  • Operating system used: Ubuntu (WSL)
  • Backend used: crossterm
  • Current locale (run locale in a terminal): C.UFT-8
  • Cursive version (from crates.io, from git, ...): crates.io 0.21.1

Additional context
The more complex escape sequences that handle both foreground and background seem to be ignored. Also Cursor sequences [0K

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions