Skip to content

Conversation

@nnako
Copy link
Contributor

@nnako nnako commented Sep 19, 2021

until now, only the SELECT GRAPHIC RENDITION following a CONTROL SEQUENCE INTRODUCER was implemented in order to render an invoming ANSI ART sequence. Considering standard ANSI ART (in former times widely used in BBSes), the result after rendering the respective incoming character streams looked like this:

01_render_ansi_art__original

after integrating this commit (pull request) any forward cursor movements specified within the input ansi art character stream will be rendered correctly, as seen here:

02_render_ansi_art__new

the code for testing could look like this:

from prompt_toolkit import print_formatted_text
from prompt_toolkit.formatted_text import HTML, FormattedText, ANSI

print = print_formatted_text

print(ANSI(
'''
\x1b[0m
\x1b[61C\x1b[1m▄\x1b[0m
\x1b[19C\x1b[1;30m▄\x1b[0m\x1b[41C▄
\x1b[19C\x1b[1;30m▄\x1b[0m\x1b[41C\x1b[1;30m▀\x1b[0m
\x1b[19C\x1b[1;30m▀\x1b[0m\x1b[14C\x1b[1;34m▄\x1b[0;34m▄\x1b[1m \x1b[0m\x1b[24C▒
\x1b[19C\x1b[1;30m█\x1b[0m\x1b[9C\x1b[34m▄▀▀\x1b[1m▀▀\x1b[36m▄▄\x1b[0;34m▀▄\x1b[1m          \x1b[0m  \x1b[34m▄\x1b[1m▄▀▀\x1b[0;34m▀▄\x1b[1m  \x1b[0m\x1b[3C░
\x1b[12C\x1b[1;30m   ▄ ▄▄ ▄▄▄▄▄▄\x1b[0;34m ▄▀\x1b[1m \x1b[36m▄▀▀\x1b[46m▒▓█\x1b[40m▀\x1b[30m▄▄▄\x1b[0;34m▀▀\x1b[1;36m▄▄▄▄▄\x1b[34m▀\x1b[30m▄\x1b[0;34m▀\x1b[36m▄▄\x1b[1;46m░▒▓\x1b[40m▄\x1b[0;34m▀\x1b[1;30m▄▄▄\x1b[0m▄\x1b[1;30m ▄\x1b[0m▄\x1b[1;30m \x1b[0m▄▄\x1b[1;30m \x1b[37m▄▄\x1b[0m
\x1b[19C\x1b[1;30m▄\x1b[0m\x1b[6C\x1b[34m█\x1b[1m \x1b[0;36m▄\x1b[1;46m░▒\x1b[0m\x1b[3C\x1b[36m▄▄\x1b[37m \x1b[34m  \x1b[36m▄\x1b[1;46m▓\x1b[40m▀▀▀\x1b[46m▓█\x1b[0m  \x1b[36m▄\x1b[1;46m░\x1b[0;36m▀▀▀\x1b[1;46m▓█\x1b[40m▀\x1b[0;34m▄\x1b[37m\x1b[4C\x1b[1;30m▄\x1b[0m
\x1b[19C\x1b[1;30m█\x1b[0m\x1b[5C\x1b[1;34m█ \x1b[0;36m▄\x1b[1;46m░░\x1b[0;36m█▀██\x1b[1;30;46m░░\x1b[0;36m█\x1b[37m \x1b[1;36;46m░▒\x1b[0m\x1b[4C\x1b[1;36;46m▒\x1b[40m▀\x1b[0m \x1b[36m██\x1b[37m\x1b[4C\x1b[1;36m▀\x1b[34m▄▀\x1b[0m\x1b[5C\x1b[1;30m█\x1b[0m
\x1b[19C\x1b[1;30m█\x1b[0m \x1b[34m \x1b[37m  \x1b[34m▄\x1b[1m▄▀\x1b[0m \x1b[36m▀▀\x1b[37m  \x1b[1;30;46m░░░\x1b[0;36m▀\x1b[37m \x1b[1;30;46m░░\x1b[0;36m█\x1b[1;30mRV\x1b[0;36m▄\x1b[1;30;46m░\x1b[36m░\x1b[30;40m \x1b[0;36m█\x1b[1;30;46m░\x1b[0;36m█▄\x1b[37m\x1b[4C\x1b[1;30m■\x1b[0;34m█\x1b[37m\x1b[5C\x1b[1;30m█\x1b[0m
\x1b[10C\x1b[1m▄▄\x1b[30m \x1b[0m▄▄\x1b[1;30m \x1b[0m▄\x1b[1;30m▄\x1b[0m▄▄\x1b[1;30m▄▄▄\x1b[0;34m█\x1b[37m \x1b[1;30m▄▄\x1b[46m▓▒░\x1b[0;36m▄\x1b[1;30;46m░\x1b[0;36m▀\x1b[37m \x1b[1;34m▄\x1b[0;34m▄\x1b[37m \x1b[1;30;46m░▒▓▓\x1b[40m▄\x1b[46m░▒▓\x1b[40m▀\x1b[0m \x1b[36m█\x1b[1;30;46m░\x1b[0;36m█\x1b[1;30;46m░▒▓\x1b[40m▀ \x1b[34m■\x1b[30m▄▄▄▄ ▄▄ ▄\x1b[0m
\x1b[23C\x1b[34m▀\x1b[1m▄\x1b[0m \x1b[1;30m▀▀\x1b[0;36m▀▀\x1b[37m \x1b[1;34m▄\x1b[0;34m▄\x1b[1m▀\x1b[33mSAC\x1b[0;34m▄\x1b[1;30m▀▀\x1b[0;34m▄▄\x1b[1;30m▀▀\x1b[34m▄▄\x1b[0;34m▄\x1b[37m \x1b[36m▀▀\x1b[1;30m▀▀\x1b[0;34m▄\x1b[1m▄▀\x1b[0m
\x1b[19C░\x1b[4C\x1b[34m \x1b[1m▀▀\x1b[0;34m▀▀▀▀     \x1b[37m  \x1b[34m▀▀\x1b[37m  \x1b[1;34m▀▀\x1b[0m\x1b[3C\x1b[34m▀▀▀▀▀\x1b[37m\x1b[9C\x1b[1;30m█\x1b[0m
\x1b[19C▒\x1b[41C\x1b[1;30m█\x1b[0m
\x1b[19C\x1b[1;30m▄\x1b[0m\x1b[41C\x1b[1;30m▄\x1b[0m
\x1b[19C▀\x1b[41C\x1b[1;30m▀\x1b[0m
\x1b[19C\x1b[1m▀\x1b[0m\x1b[41C\x1b[1;30m▀\x1b[0m
\x1b[0m
'''
))

@nnako
Copy link
Contributor Author

nnako commented Oct 4, 2021

Hi folks,

unfortunately, I am new to this project and new to the processes necessary for a successful acceptance of a pull request. two weeks ago, my initial pull request was checked by automatic means. unfortunately with some style errors which I tried to correct by adding another commit. in the meantime, until now, some test was executed again. possibly still with errors, but I can not figure out where the problem is. do I have to change something? do I have to wait for something to happen? have I done something wrong in general? do I have to hand in only one and not two subsequent commits for the processes to work well?...

I would highly appreciate any hints, for me to become able to contribute to this project on a regular basis. as I am interested in promoting certain aspects of this project. so, please, can somebody help me figuring out how to get this done?

Thanks.

@jonathanslenders
Copy link
Member

Hi @nnako,

Sorry for the late reply. I've been rather busy recently.
It looks like I have to approve the GitHub actions workflow for new contributors.

Basically, before code can be merged, it should be formatted with black and isort + pass mypy and pytest. Looks like there are still some formatting issues. Can you apply "black"? Thanks!

@nnako
Copy link
Contributor Author

nnako commented Oct 29, 2021

Hi @jonathanslenders ,

sorry. Somehow I didn't see you already responded... my bad.

Unfortunately, I don't seem to be much familiar with the development workflows within this project. So, I still can not really see, what I am expected to do next in order to further promote my pull request.

Here are some thoughts:

  • I didn't optimize the prevailing code structure even though there would have been potential for that. For a pull request to be promoted, am I really obliged to refactor old code that happens to exist within the scope of my own contributions?

  • from the current test "details" mentioned within the check list, I can not see what to next do on a practical level. Unfortunately, the error messages don't say anything useful for me as a developer. The "failed" tests state would reformat prompt_toolkit/formatted_text/ansi.py . Ok. but where do I find the requirement? Which part in my code triggered the test failure? The "canceled" test does not say anything at all. Just Error: The operation was canceled.

Is there any further description about the application of black and other conditions for contibuting successfully? Something like a general contribution guide? I will try my best.

Thanks anyway.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants