nyxt
nyxt copied to clipboard
switch-buffer-next does not cycle over no-save buffers
Currently we flatten the buffer tree following the inter-buffer relationships from the Global History Tree.
Problem: we didn't take into account that some buffers like no-save buffers may not belong to the same global history tree! Some buffers may not even have any history at all.
Fix suggestion: go throught the list of buffers and fetch their global history, then flatten each buffer tree one after the other. For buffers without buffer tree, list them in order of appearance at then end.
Thoughts?
Yes, that sounds most intuitive!
OK, I'll send a patch later then.
I could not reproduce, it looks like we do take multiple histories into account. Or am I missing something?
Anyways, I've spotted a bug in how we call get-data
. This API is broken :( Until we rewrite the data-storage library, I've sent a fix with 14b0abc6c031050cfb814b8b84d828fa87c09956, should be good for now.
Explanation: in buffer-siblings
, we do handle all "top level owners", so all buffers that don't have a creator.
We also compute the owner of a BUFFER from the current-buffer history. So if BUFFER has another history, the owner won't be found and will be considered a top-level buffer.
This may not be the right code nor the right behaviour, but it allows for cycling through all buffers it seems, which is good enough considering all the other buffer switching options that we have.
We can fine-tune this in the future when the data-storage library is rewritten.