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

Readme incorrectly shows FSArray background colour rendered over full array #117

Open
moreati opened this issue Jul 5, 2018 · 7 comments
Labels

Comments

@moreati
Copy link

moreati commented Jul 5, 2018

I was recreating the screenshots in readme.md, but I found that the rendering didn't match the existing screenshots. The background color of the FSArray is not being rendered, only the background color of an text shows.

image

For comparison, here is what is currently shown in readme.md
image

@moreati
Copy link
Author

moreati commented Jul 5, 2018

Code for copy and paste

>>> from curtsies import fmtstr
>>> red_on_blue = fmtstr('hello', 'red', 'on_blue')
>>> blue_on_red = fmtstr('there', fg='blue', bg='red')
>>> green = fmtstr('!', 'green')
>>> full = red_on_blue + ' ' + blue_on_red + green
>>> full
on_blue(red('hello'))+' '+on_red(blue('there'))+green('!')
>>> str(full)
'\x1b[31m\x1b[44mhello\x1b[49m\x1b[39m \x1b[34m\x1b[41mthere\x1b[49m\x1b[39m\x1b[32m!\x1b[39m'
>>> print(full)
hello there!
>>> from curtsies import FSArray
>>> a = FSArray(3, 14, bg='blue')
>>> from curtsies import FSArray, fmtstr
>>> a = FSArray(3, 14, bg='blue')
>>> a[0:2, 5:11] = fmtstr('hey', 'on_blue') + ' ' + fmtstr('yo', 'on_red'), fmtstr('qwe qw')
>>> a.dumb_display()
     hey yo
     qwe qw

>>> from curtsies import fsarray
>>> a = fsarray(['hey', 'there'], bg='cyan')
>>> a.dumb_display()
hey
there

@thomasballinger
Copy link
Member

Whoa that's a big change huh! We could track down the regression, I'd guess it's something to do with the way fsarrays store formatting? Maybe that's something we got rid of?

Do you have a workaround that work for you now?

@moreati
Copy link
Author

moreati commented Jul 7, 2018

I'll have a go at bisecting it.

Do you have a workaround that work for you now?

Yes, I'm writing space characters where needed.

@thomasballinger
Copy link
Member

thomasballinger commented Jul 7, 2018

This might have been by design, and it's just the readme we should change. Arrays by default being spaces or rendering as all spaces isn't desirable in some cases, e.g. when rendering exactly a terminal-sized rect printing these characters would force a lot more line wraps when resizing the terminal smaller that would otherwise be necessary (I bet this is why it was changed).

@moreati
Copy link
Author

moreati commented Jul 9, 2018

FTR the change of behavior was introduced by 8cf4240 in Nov 2013

@thomasballinger
Copy link
Member

Thanks for finding this. I think we should call this works as intended and say the bug is with the docs.

@thomasballinger thomasballinger changed the title FSArray background colour is only rendered Readme incorrectly shows FSArray background colour rendered over full array Jul 11, 2018
@moreati
Copy link
Author

moreati commented Jul 11, 2018

I'll submit a PR documenting it then

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants