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

[SheetsSheet] sorting list of sheets jumps away from SheetsSheet #518

Closed
geekscrapy opened this issue Apr 22, 2020 · 13 comments
Closed

[SheetsSheet] sorting list of sheets jumps away from SheetsSheet #518

geekscrapy opened this issue Apr 22, 2020 · 13 comments

Comments

@geekscrapy
Copy link
Contributor

I've found the the sorting keys do not work as expected on the Shift+S (sheetsIndex) sheet.

I was expecting to be able to sort by name (as the default selected column) however [ opens a sheet. In my case it's the same sheet all the time irrelevant of the order.
I've also found that this isn't consistent. Sometimes [ does sort as expected, and ] opens a sheet.

To be honest I'm unsure what is going to happen each time when I hit [ or ] on that sheet

To replicate, open a couple of sheets/files, hit Shift+S, and click [ or ] to test

@geekscrapy geekscrapy added the bug label Apr 22, 2020
@anjakefala
Copy link
Collaborator

anjakefala commented Apr 22, 2020

Hi @geekscrapy!

Believe it or not, there is no bug. ^^;

Shift+S is actually the Sheets Sheet for the Sheets Stack, which is why you are seeing funky behaviour when you move rows around. This is the actual stack for your sheets. When play with a metasheet, you are directly affecting VisiData's understanding of the session.

Since the top sheet is the sheet at the top of the stack, that is the visible sheet. When you are viewing the Sheets Stack, that is always going to be the sheets row, representing the sheet you are viewing.

When you sort, occassionally you will bump another row to the top of the stack, and then you will jump to that row. I should make a page in the docs about this. I just noticed that it is not really spoken about in @jsvine's tutorial.

If you want to play with a Sheets Sheet like a regular sheet, you can "freeze" it with g'. If you want to check out a list of all of the precious loaded sheets that you had accessed in your session, type gS to open the Global Sheets (used to be the Sheets Graveyard). This is not representing the stack, and therefore is sort-able.

Something we may consider @saulpw, is giving that sheet the name sheets_stack. That may have made it less surprising that sorting had an affect.

@saulpw saulpw changed the title [v2.-4dev] [ and ] not consistent on S page [SheetsSheet] sorting list of sheets jumps away from SheetsSheet Apr 22, 2020
@anjakefala anjakefala added By Design and removed bug labels Oct 29, 2020
@klartext
Copy link

klartext commented Oct 29, 2020

If it's not becoming part of the documentation, I think there will be more issues with the same topic being opened over time ;-)
I opened one about one hour ago btw. And I was redirected to here by Anja, after she closed my issue...

@anjakefala
Copy link
Collaborator

Want to add it to our documentation @klartext? =) https://github.com/saulpw/visidata/blob/develop/docs/sheets.md

@anjakefala
Copy link
Collaborator

Or make an issue here to add it to this section? https://github.com/jsvine/intro-to-visidata/blob/master/docs/basics/understanding-sheets.rst

@klartext
Copy link

I let that task be reserved to the experts ;-)

@klartext
Copy link

klartext commented Oct 29, 2020

But I found some broken links in some of the docs and could report them.
Could do that during the next days I think.

@jsvine
Copy link
Contributor

jsvine commented Oct 30, 2020

Thanks for the reminder on this. I've added a note my tutorial re. sorting the Sheets Sheet, at the end of this subsection: https://jsvine.github.io/intro-to-visidata/basics/understanding-sheets/#how-to-use-the-sheets-sheet

I wonder though: What would the VisiData maintainers think about disabling sorting on the Sheets Sheet (rather than modifying the Sheet Sheet's behavior). Perhaps I'm thinking narrow-mindedly, but I can't see much of a use-case for sorting that metasheet, given the almost-always-unintended consequences.

@saulpw
Copy link
Owner

saulpw commented Oct 30, 2020

That's a really good point. But maybe we could just override it, so that it only sorted the rest of the elements. The thing is, do we want to do this for slide too? any others?

@jsvine
Copy link
Contributor

jsvine commented Oct 30, 2020

Ah, very interesting re. slide. My two cents on that (and potentially relevant to other commands):

  • Sliding feels much more intentional. Perhaps it's wishful thinking, but my instinct that people are much less likely to slide a row up to the first position than to accidentally (or out of simple curiosity) sort the sheet.

  • I do find sliding on the Sheets Sheet useful, e.g., to bring a sheet higher into the stack (or, perhaps more accurately, into my field of vision) for easier finding later. Or did you just mean overriding what happens when you try to slide a row into the first position?

@saulpw
Copy link
Owner

saulpw commented Nov 1, 2020

We can do either. For the sort, I think we'd have to do self.rows = [self.rows[0]] + sorted(self.rows[1:]) anyway, so maybe it makes sense to override slide in that special case only.

@klartext
Copy link

klartext commented Nov 1, 2020

The reason I tried to sort the sheets-sheet is to have a certain order of the documents.
If the filename reflects a certain order (for logfiles for example with date in the name, it's reflecting the timely order of the contents inside the files - and therefore inside the sheets), it may be convenient to sort the sheets, so that when going back to the sheets by closing the (new ordered) sheets sheet, the sheets can be viewed in the order that was created by sorting the filename-column of the sheets-sheet.
For fast browsing into the data-sheets one by one the right order ist nice for a quick overview - without the need of merging the data before.
So, IMO there is a good reason to use that intuitive approach for sorting the Sheets-Sheet.
The Sheets-Stack as it exists now under the name of Sheets-Sheet - if that thing does makes sense at all (what was it designed for? What are it's uses?), would need explanation (documentation) and maybe should be less easy to reach, or modified in the one or the other way, to avoid unexpected/unintuitive behaviour.
-> docs: "You can use this adavanced feature, which looks like a bug, but be careful..."

@saulpw
Copy link
Owner

saulpw commented Dec 7, 2020

Please note that this should be fixed in v2.1 and work "as expected" (instead of counterintuitively "by design").

@klartext
Copy link

Thank you!

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

No branches or pull requests

5 participants