GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Crash when print ANSI escape code to color output text · Issue #915 · bpython/bpython

Crash when print ANSI escape code to color output text #915

New issue
Copy link
New issue
Copy link
Closed
Closed
Crash when print ANSI escape code to color output text#915
Copy link
Labels
bug

Description

@arian-deimling
arian-deimling
opened on Sep 25, 2021
Issue body actions

Tried printing out an ANSI escape sequence that changes the color of terminal output to red (see: https://en.wikipedia.org/wiki/ANSI_escape_code#Colors), and it crashed. If I don't pass the end='' parameter to the print function, it works fine; looks like bpython was expecting the cursor to advance but only changing the color doesn't do that.

~ % bpython
bpython version 0.21 on top of Python 3.8.2 /Library/Developer/CommandLineTools/usr/bin/python3
>>> print('\033[91m', end='')

Traceback (most recent call last):
  File "/Users/arian/Library/Python/3.8/bin/bpython", line 8, in <module>
    sys.exit(main())
  File "/Users/arian/Library/Python/3.8/lib/python/site-packages/bpython/curtsies.py", line 201, in main
    exit_value = repl.mainloop(True, paste)
  File "/Users/arian/Library/Python/3.8/lib/python/site-packages/bpython/curtsies.py", line 121, in mainloop
    self.process_event_and_paint(e)
  File "/Users/arian/Library/Python/3.8/lib/python/site-packages/bpython/curtsies.py", line 95, in process_event_and_paint
    array, cursor_pos = self.paint()
  File "/Users/arian/Library/Python/3.8/lib/python/site-packages/bpython/curtsiesfrontend/repl.py", line 1610, in paint
    assert cursor_row >= 0 and cursor_column >= 0, (
AssertionError: (-1, 74, 9, 0, 0)
Reacted by Mehedi Hasan

Activity

  1. sebastinas
    added
    bug
    on Sep 25, 2021
  2. arian-deimling commented on Sep 25, 2021

    @arian-deimling
    arian-deimling
    on Sep 25, 2021
    ContributorAuthor
    More actions

    Can I work on this or are you going to?

  3. arian-deimling commented on Oct 2, 2021

    @arian-deimling
    arian-deimling
    on Oct 2, 2021
    ContributorAuthor
    More actions

    Duplicate of #900.

  4. arian-deimling
    closed this as completedon Oct 2, 2021
  5. thomasballinger commented on Oct 7, 2021

    @thomasballinger
    thomasballinger
    on Oct 7, 2021
    Member
    More actions

    @arian-deimling late to reply, but you're welcome to look. I suspect https://github.com/bpython/curtsies/blob/main/curtsies/escseqparse.py may be useful to look at, and that we may need to special case printing what we're going to treat as printing nothing.

  6. arian-deimling commented on Oct 7, 2021

    @arian-deimling
    arian-deimling
    on Oct 7, 2021
    ContributorAuthor
    More actions

    @thomasballinger I'd be happy to look at this over the weekend. Do you want me to work on this or is there anything else that's more pressing?

  7. thomasballinger commented on Oct 7, 2021

    @thomasballinger
    thomasballinger
    on Oct 7, 2021
    Member
    More actions

    This bug might even be the most pressing bug right now? It's been an issue for a long time though, so it's not urgent. It looks pretty involved, decisions made here about how we handle operationally blank output lines may have far-reaching effects.

    I'm starting on some mypy types, that's a potential thing to work on if that's fun. In the autocompletion vein, you could take a look at #889 or #897 or similar. I'm interested in #826, which is related to the escape codes issue.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.