This repository has been archived by the owner on Mar 31, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
Fix wrong line width calculation in max_width for colored text #147
Merged
jpiper
merged 2 commits into
kennethreitz:master
from
wkentaro:fix-max-width-for-colored-text
Aug 25, 2015
Merged
Fix wrong line width calculation in max_width for colored text #147
jpiper
merged 2 commits into
kennethreitz:master
from
wkentaro:fix-max-width-for-colored-text
Aug 25, 2015
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Before
After
|
Please review this and hope to be merged. |
This is necessary to fix a display problem in https://github.com/kennethreitz/legit . |
wkentaro
force-pushed
the
fix-max-width-for-colored-text
branch
2 times, most recently
from
August 7, 2015 05:31
0b4805d
to
c7fe858
Compare
With this, the display of before
After
|
wkentaro
force-pushed
the
fix-max-width-for-colored-text
branch
from
August 8, 2015 02:27
c7fe858
to
68114d5
Compare
wkentaro
force-pushed
the
fix-max-width-for-colored-text
branch
from
August 16, 2015 03:23
12dde66
to
c7ac904
Compare
wkentaro
changed the title
Fix wrong line width calculation in max_width for colored text
[WIP] Fix wrong line width calculation in max_width for colored text
Aug 16, 2015
wkentaro
force-pushed
the
fix-max-width-for-colored-text
branch
from
August 16, 2015 05:48
c7ac904
to
3071a0a
Compare
@@ -56,18 +53,18 @@ def max_width(string, cols, separator='\n'): | |||
_row_i = 0 | |||
|
|||
for word in row: | |||
if (len(_row[_row_i]) + len(word)) < (cols + offset): | |||
if (len(clean(_row[_row_i])) + len(word)) <= cols: |
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.
This <=
is because max should include the biggest number.
wkentaro
changed the title
[WIP] Fix wrong line width calculation in max_width for colored text
Fix wrong line width calculation in max_width for colored text
Aug 16, 2015
wkentaro
changed the title
Fix wrong line width calculation in max_width for colored text
[WIP] Fix wrong line width calculation in max_width for colored text
Aug 25, 2015
wkentaro
force-pushed
the
fix-max-width-for-colored-text
branch
from
August 25, 2015 15:56
3659d12
to
30648d1
Compare
wkentaro
force-pushed
the
fix-max-width-for-colored-text
branch
from
August 25, 2015 15:58
30648d1
to
d0a5237
Compare
strip spaces at each line's end, to get correct formatted output. |
wkentaro
changed the title
[WIP] Fix wrong line width calculation in max_width for colored text
Fix wrong line width calculation in max_width for colored text
Aug 25, 2015
Done. |
jpiper
added a commit
that referenced
this pull request
Aug 25, 2015
Fix wrong line width calculation in max_width for colored text
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
issue: #146
related to: frostming/legit#168