(Translated by https://www.hiragana.jp/)
Swap open-vs-close tag order when converting Text to markup. by slaarti · Pull Request #3163 · Textualize/rich · GitHub
Skip to content
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

Swap open-vs-close tag order when converting Text to markup. #3163

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

slaarti
Copy link

@slaarti slaarti commented Oct 21, 2023

Type of changes

  • Bug fix
  • New feature
  • Documentation / docstrings
  • Tests
  • Other

Checklist

  • I've run the latest black with default args on new code.
  • I've updated CHANGELOG.md and CONTRIBUTORS.md where appropriate.
  • I've added tests for new code.
  • I accept that @willmcgugan may be pedantic in the code review.

Description

Fixes #3155.

(I'm torn on whether this is a pleasingly simple solution or a solution that's too simple to possibly be correct. Still, it makes the test pass while making some improvement on making sure existing tags get closed before new ones are opened. I made an attempt at a more sophisticated effort to more closely track tag opening order and it took things to la-la-land, so I abandoned that and am calling this good enough.)

I'm torn on whether this is a pleasingly simple solution or a solution
that's too simple to possibly be correct. Still, it makes the test pass,
so it'll do as a first cut while I decide if I want to make a second,
more complex run at it.

(Possibly track the order open-tags were rendered to ensure that
multiple close-tags at a given offset get popped off in reverse open-tag
order?)
@codecov-commenter
Copy link

codecov-commenter commented Nov 7, 2023

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (aabfd16) 98.30% compared to head (bc48fb6) 98.28%.
Report is 24 commits behind head on master.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3163      +/-   ##
==========================================
- Coverage   98.30%   98.28%   -0.03%     
==========================================
  Files          74       74              
  Lines        8038     8044       +6     
==========================================
+ Hits         7902     7906       +4     
- Misses        136      138       +2     
Flag Coverage Δでるた
unittests 98.28% <93.75%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δでるた
rich/align.py 100.00% <ø> (ø)
rich/console.py 98.04% <100.00%> (+<0.01%) ⬆️
rich/markdown.py 99.45% <100.00%> (ø)
rich/progress.py 92.92% <ø> (ø)
rich/syntax.py 98.19% <100.00%> (-0.29%) ⬇️
rich/text.py 99.01% <80.00%> (-0.17%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@willmcgugan
Copy link
Collaborator

Not convinced this is the solution. Suspect it will only work for the trivial case.

More tests might convince me...

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.

[BUG] Text markup property opens new span tags before closing old ones.
4 participants