|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
Reorder tabs or buffersHi, 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. -- Daniel // This tries to move the current tab 1 position to the left // It is just a proof of concept but it's not usable: the tab is moved, but buffer_next() and buffer_previous() still use the old order. In addition it only works the first time. C-x b is not affected // 16.m4.2009 Daniel Clemente function test_move_tab_left(window) { // Get the tab bar var tabbar = window.tab_bar; tabbar.update_multiple_attribute(); //¿? var bcurrent=window.buffers.current; var index = window.buffers.selected_index; if (index==0) {return;} var bprevious=window.buffers.get_buffer(index-1); // remove it from its position tabbar.element.removeChild(bcurrent.tab); // and place it before the tab which was at our left tabbar.element.insertBefore(bcurrent.tab,bprevious.tab); // Renumber the tabs. for (var i = 0; i < tabbar.element.childNodes.length; i++) { tabbar.element.childNodes[i].childNodes[0].value = i + 1; } // TODO: make sure that the "next" buffer for each tab points to really the tab at the right, so that next_buffer/previous_buffer work // we changed the tabs, not the buffers // TODO: maybe change the internal buffer ordering too // this doesn't seem to work: C-x b doesn't show this var bs=window.buffers; var bl=bs.buffer_list; // I delete [bprevious,bcurrent] and I put [bcurrent,previous] bl.splice(index-1,2, bcurrent,bprevious); // still focus the original tab bs.current=bcurrent; // debug (to know that it ended) window.minibuffer.show(bl.length); return true; } interactive("test-move-tab-left", "Tries to move the current tab one position to the left. But FAILS", function(I) {test_move_tab_left(I.window); }); define_key(content_buffer_normal_keymap, "M-c", "test-move-tab-left"); _______________________________________________ Conkeror mailing list Conkeror@... https://www.mozdev.org/mailman/listinfo/conkeror |
|
|
Re: Reorder tabs or buffersDaniel 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 |
|
|
|
|
|
Re: Reorder tabs or buffersEl dj, abr 16 2009, Jeremy Maitin-Shepard va escriure:
> 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. Since this seems not trivial, I have filed a bug about this wish: http://bugs.conkeror.org/issue151 I don't plan to work on this in the near future, but maybe later, when I have more practice with Conkeror. Thanks for explaining the direction to follow. --Daniel _______________________________________________ Conkeror mailing list Conkeror@... https://www.mozdev.org/mailman/listinfo/conkeror |
| Free embeddable forum powered by Nabble | Forum Help |