Skip to content

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

Open

Description

@moreati

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

Activity

  1. moreati commented on Jul 5, 2018

    @moreati
    Author

    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
    
  2. thomasballinger commented on Jul 7, 2018

    @thomasballinger
    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?

  3. moreati commented on Jul 7, 2018

    @moreati
    Author

    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.

  4. thomasballinger commented on Jul 7, 2018

    @thomasballinger
    Member

    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).

  5. moreati commented on Jul 9, 2018

    @moreati
    Author

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

  6. thomasballinger commented on Jul 11, 2018

    @thomasballinger
    Member

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

  7. changed the title [-]FSArray background colour is only rendered[/-] [+]Readme incorrectly shows FSArray background colour rendered over full array[/+] on Jul 11, 2018
  8. moreati commented on Jul 11, 2018

    @moreati
    Author

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions