bpython / curtsies

Curses-like terminal wrapper with a display based on compositing 2d arrays of text.
MIT License
228 stars 52 forks source link

Incorrect error message for "a[0,0:5] = yellow('Hello') #181

Open merriam opened 5 months ago

merriam commented 5 months ago

Forgetting the [] but using a formatted string, e.g., 'a[0, 0:5] = yellow("Hello") gives:

  TypeError: sequence item 0: expected str instance, FmtStr found

Should give:

  ValueError: You cannot replace a multi column slice with a
            formatted string (FmtStr), please use a list [] with strings for the
            contents of each row

Likely fix, add to formatstringarray.py/setitem(), about line 157:

    if slicesize(colslice) > 1 and isinstance(value, FmtStr):
        raise ValueError(
            """You cannot replace a multi column slice with a
            formatted string (FmtStr), please use a list [] with strings for the
            contents of each row"""
        )