-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clean up text drawer compression issues #8588
Conversation
…ra into show_barrier_label
…ra into show_barrier_label
…ra into show_barrier_label
Thank you for opening a new pull request. Before your PR can be merged it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient. While you're waiting, please feel free to review other open PRs. While only a subset of people are authorized to approve pull requests for merging, everyone is encouraged to review open pull requests. Doing reviews helps reduce the burden on the core team and helps make the project's code better for everyone. One or more of the the following people are requested to review this:
|
Pull Request Test Coverage Report for Build 2982196345
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Edwin! One minor comment about the tests, but I think the new behaviour is probably a pretty reasonable default.
" ┌──────┐", | ||
"q_0: |0>┤ my h ├", | ||
" └──┬───┘", | ||
"q_1: |0>───■────", | ||
" my ch ", | ||
" ║ ", | ||
" c: 0 ═══■════", | ||
" 0x1 ", | ||
" ┌──────┐ ", | ||
"q_0: |0>──┤ my h ├─", | ||
" └──┬───┘ ", | ||
"q_1: |0>─────■─────", | ||
" my ctrl-h ", | ||
" ║ ", | ||
" c: 0 ═════■═════", | ||
" 0x1 ", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we revert this test case? The behaviour that appears with this PR and this test is probably something we want to make a positive decision on, and potentially test both it and your new form (with the space not aligned).
For clarity: with this PR, the original test produces
┌──────┐
q_0: |0>┤ my h ├
└──┬───┘
q_1: |0>───■────
my║ch
c: 0 ═══■════
0x1
instead. I feel like that (^) behaviour is probably actually suitable for vertical_compression=medium
- it compresses vertically when there's a "space" so nothing visible gets erased, whereas "high" always compresses and "low" never does.
Perhaps leave the test as-is, and add your new one as a separate case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ha, I was hoping nobody would notice that. It works visually either way and it's probably a pretty rare case. I'll add the old test back with the new one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks! Would you mind adding a short bugfix release note? Sorry - I missed that it wasn't there first time round apparently.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks for the changes!
Summary
Fixes several problems with
vertical_compression
in the text circuit drawer.Details and comments
There is an option for the text circuit drawer called
vertical_compression
that allows a user to choose how much vertical spacing there is between the horizontal lines. If'high
is chosen, then only 1 line will display between a pair of wires and in certain cases it's possible characters will overwrite other characters or drawing elements. Iflow
is chosen, 2 lines will be used between every pair of lines and no overwriting will occur.If
medium
, which is the default, is chosen, the compression starts out the same ashigh
, but the drawer then tries to detect areas where overwriting would occur and expands the vertical to 2 lines where that would happen. The detection of these areas was not working consistently.low
compression was also causing connections between a gate and a control to be broken. Finally there were areas where connections for conditional gates were breaking. These drawings show 2 of the problems followed by a corrected drawing.