[canvas- graph-] fix handling of label chars with screen width > 1 #2665
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR continues an audit to find uses of
len()
that should bedispwidth()
(on-screen width). Most of its changes are straightforward replacements oflen()
. All the changes todispwidth()
are necessary, and tested.One of the lines is also fixes a bug in logic:
visidata/visidata/canvas.py
Line 329 in 6b0a78a
Here the original intention was to move the label left, by the number of characters in the text. To place the label to the left of the (x,y) coordinates. I've corrected the calculation.
That one-line change only affects calls to
label()
/plotlabel()
where arow
argument is supplied. I believeCanvasSheet
andGraphSheet
are unaffected. OnlyGeoJSONMap
,PbfCanvas
, andShapeMap
are affected. With the fix, they will typically have their labels shifted left by 1-10 more screen columns.