Opened 3 years ago

Closed 3 years ago

#29202 closed enhancement (fixed)

character art: avoid repeated additions

Reported by: Markus Wageringel Owned by:
Priority: minor Milestone: sage-9.1
Component: refactoring Keywords: ascii_art, unicode_art
Cc: Merged in:
Authors: Markus Wageringel Reviewers: Vincent Delecroix
Report Upstream: N/A Work issues:
Branch: 0c7b677 (Commits, GitHub, GitLab) Commit: 0c7b677ed98945baee1b1ad191eb8bb3264e4605
Dependencies: Stopgaps:

Status badges


This ticket rewrites some constructions of ASCII and unicode art to avoid repeatedly adding character art elements, but to concatenate multiple character art elements in one go instead which is more efficient.

In and, this also removes some breakpoints that seemed to be unintended. This might stem from misunderstanding that adding two character art elements always creates a breakpoint in between. (Arguably, this is a bad default.)

sage: R = NonCommutativeSymmetricFunctions(QQ).R()
sage: Partitions.options(diagram_str="#", convention="french")
sage: a = ascii_art(tensor((R[1,2], R[3,1,2]))); a
R   # R
 #     ###
 ##      #
sage: a._breakpoints
[0, 3, 6]       # before (in particular the 0 is undesirable, the 3 unnecessary)
[6]             # after

Moreover, this ticket fixes the default implementation of _unicode_art_ in SageObject (which is based on _ascii_art_) to preserve the ascii art element's breakpoints and baseline.

Change History (3)

comment:1 Changed 3 years ago by Markus Wageringel

Authors: Markus Wageringel
Branch: u/gh-mwageringel/29202
Commit: 0c7b677ed98945baee1b1ad191eb8bb3264e4605
Keywords: ascii_art unicode_art added
Status: newneeds_review

New commits:

0c7b67729202: avoid repeated character art addition

comment:2 Changed 3 years ago by Vincent Delecroix

Reviewers: Vincent Delecroix
Status: needs_reviewpositive_review

comment:3 Changed 3 years ago by Volker Braun

Branch: u/gh-mwageringel/292020c7b677ed98945baee1b1ad191eb8bb3264e4605
Resolution: fixed
Status: positive_reviewclosed
Note: See TracTickets for help on using tickets.