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

Turn buffer list into a tree #854

Closed
Ambrevar opened this issue Jul 18, 2020 · 3 comments
Closed

Turn buffer list into a tree #854

Ambrevar opened this issue Jul 18, 2020 · 3 comments
Labels

Comments

@Ambrevar
Copy link
Member

Ambrevar commented Jul 18, 2020

In commit 793bb39 I fixed yet another bug related to buffer switching. Our current structure holding the list of buffers is brittle.

I believe this is because we are conflating 2 independent buffer switching features: by access time and by order. On top of this, our current code is very stateful which makes it hard to debug.

We should have 3 commands:

  • "left" buffer.
  • "right" buffer
  • next most recent buffer.

Note that Firefox recently acquired an option to change the behaviour of C-tab exactly like the above.

We already store the last-access time so the implementation of "next most recent buffer" is trivial (we could even simplify our code). However, we don't store the relative "position" of the buffers.

I remember someone mentioned we stored our buffers in a tree to preserve the information of which is the parent buffer (e.g. when opening a link in a new buffer). I cannot find the issue, feel free to share it if you can find it back.

To implement the "left" and "right" command, we need to flatten the tree in a way that's "do what I mean". I'd say "append flat left branch and flat right branch" (recursive algorithm).

When deleting a parent buffer, I think we need to move the oldest child in place of the parent.

With a tree, we would also have the possibility to show the tree of all buffers in an IBuffer-like buffer. See #565.

@bhankas
Copy link

bhankas commented May 25, 2021

If I'm understanding correctly, this is about making buffer list and switching more aware of last opened/switched times.

Or does this mean something more like "Tree Style Tabs" extension for Firefox? I would personally vote for TST. TST in traditional FF is beneficial because it uses vertical space for tab lists and so it is easier to identify and select. This is beneficial in Nyxt as a persistent bird's eye view for currently open buffers.

But even more benefit is for tracking train of thought. It is like the global history tree, but for current state of all open buffers. It helps me track which tab belongs to which group/subgroup.

So, if this issue is for former, I will open new issue for latter, otherwise very happy that this is already on high prior.

@Ambrevar
Copy link
Member Author

This is about the implementation details to finally get to "tree style tabs".
The actual tree display is discussed in #565.

Note that this issue is a bit old and now that we've got the Global History Tree, we incidentally also have tree-like relationships between buffers. We just need to leverage this in our code base.

@Ambrevar
Copy link
Member Author

Done!

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

No branches or pull requests

2 participants