Visidata: [dev 2.0+] disp_rstatus_fmt causes halting exception on GraphSheet

Created on 2 Nov 2020  路  6Comments  路  Source: saulpw/visidata

Small description
I modified the disp_rstatus_fmt to provide information I require when working with sheets, however when using GraphSheet vd crashes with the following exception. I currently have to use ^g to see the same information as I would be able to see using this disp_rstatus_fmt.

options.disp_rstatus_fmt = ' {sheet.cursorRowIndex}/{sheet.nRows}[{sheet.nSelectedRows}] {sheet.rowtype} '

AttributeError: 'GraphSheet' object has no attribute 'cursorRowIndex'

Expected result
GraphSheet to load

FWIW, I was also attempting to make a % counter in disp_rstatus_fmt however I get some odd other exceptions (this isn't really an issue so I haven't opened a separate bug, however this was my original use-case).

bug fixed

All 6 comments

To add, I also can't do something like this:
options.disp_rstatus_fmt = ' {sheet.cursorRowIndex or ""}/{sheet.nRows}[{sheet.nSelectedRows}] {sheet.rowtype} '

Exception
AttributeError: 'JsonSheet' object has no attribute 'cursorRowIndex or ""'

I'll give this a go!

Now on develop. =)

Also you might want to set the option on TableSheet instead of globally (use TableSheet.class_options). Then you could add another one specifically for GraphSheet with different information.

Thanks both

Just to make sure, should this silently fail on GraphSheet if I used the following? Just reading the docs makes me think it should fail silently, as it _should_ be able to be set globally? </pedantic>

vd.options.disp_rstatus_fmt = ' {sheet.cursorRowIndex}/{sheet.nRows}[{sheet.nSelectedRows}] {sheet.rowtype} '?

It will substitute the {} that will not work with GraphSheet with '' silently.

Was this page helpful?
0 / 5 - 0 ratings