« Return to Thread: Reorder tabs or buffers

Re: Reorder tabs or buffers

by Jeremy Maitin-Shepard-2 :: Rate this Message:

Reply to Author | View in Thread

Daniel Clemente <dcl441-bugs@...> writes:

>   Hi, I would like to move a tab (from new-tabs.js) one position to the left or
> to the right. Maybe it's easier to change the order of the buffers, not the
> tabs, so that C-x b (switch_to_buffer) shows also the new order.

>   With my limited knowledge of Conkeror internals, I did this first proof of
> concept. The right solution is probably much easier. Feel free to change this
> code, to ignore it, to include a corrected version in Conkeror, or to send me
> critiques about what I did wrong.

This could be done entirely within the tab bar module as you do it now,
and you could simply have the tab bar redefine the key commands for
moving to the next or previous buffer to respect that order.  However,
that is probably not the best approach.

Note that the buffer_list variable is currently used to maintain the
order of most recent use of the buffers such that the most recently
accessed buffer can be provided as a default for certain commands like
switch-to-buffer.  That order is never displayed, and is modified only
by bury-buffer and by switching buffers.

Currently the "canonical" buffer ordering is the order in which the
buffers were created (and represented by the order of xul:browser nodes
in the chrome document).  If you want to be able to reorder buffers, I
believe the correct approach is to create a new array of buffers like
buffer_list, add appropriate code to keep that updated and functions for
rearranging buffers, add appropriate hooks to notify modules like the
tab bar about buffer rearrangement, add code to the tab bar to handle
buffer rearrangement, and add key commands or perhaps mouse commands to
the tab bar to perform buffer rearrangement.

Note that an additional buffer list as an array is needed because it is
not possible to rearrange xul:browser nodes in the chrome document once
they are added to it.  (Any attempt to do so will result in the "state"
of the corresponding buffer being lost, the state being the current page
loaded and all of the history.)

Nick was also interested in implementing this, so you may want to try to
coordinate with him.

--
Jeremy Maitin-Shepard
_______________________________________________
Conkeror mailing list
Conkeror@...
https://www.mozdev.org/mailman/listinfo/conkeror

 « Return to Thread: Reorder tabs or buffers