diff --git a/chrome/content/vimperator/settings.js b/chrome/content/vimperator/settings.js index 57a75bb2..8abae88a 100644 --- a/chrome/content/vimperator/settings.js +++ b/chrome/content/vimperator/settings.js @@ -329,6 +329,29 @@ var g_settings = [/*{{{*/ "", null ] + + // TODO: make more performant and then enable + /*,[ + ["numbertabs", "nt"], + ["numbertabs", "nt"], + "Turns tab numbering on or off", + "If you want to see a number on each tab turn this on", + "boolean", + null, + function(value) { set_pref("numbertabs", value); set_tabnumbers(value); }, + function() { return get_pref("numbertabs"); }, + false, + null + ], + + function set_tabnumbers(value) + { + if(value==false) + vimperator.tabs.updateTitles(true); + vimperator.tabs.updateTitles(false); + } +*/ + ]/*}}}*/ // return null, if the cmd cannot be found in our g_settings array, or diff --git a/chrome/content/vimperator/vimperator.js b/chrome/content/vimperator/vimperator.js index 41960b88..7d0049f0 100644 --- a/chrome/content/vimperator/vimperator.js +++ b/chrome/content/vimperator/vimperator.js @@ -1228,5 +1228,42 @@ function Tabs() } getBrowser().mTabContainer.selectedIndex = index; } + + + /* XXX: disabled until we find a better way where to update the titles, right now + * it has O(n^2) complexity on firefox start when we load 50 tabs + * (c) by hrist + + window.addEventListener("TabMove", function() { vimperator.statusline.updateTabCount(); vimperator.tabs.updateTitles(); }, false); + window.addEventListener("TabOpen", function() { vimperator.statusline.updateTabCount(); vimperator.tabs.updateTitles(); }, false); + window.addEventListener("TabClose", function() { vimperator.statusline.updateTabCount(); vimperator.tabs.updateTitles(); }, false); + + this.updateTitles = function(forceclear) + { + for(var i=0;i < vimperator.tabs.count();i++) + { + var old_title = getBrowser().mTabContainer.childNodes[i].getAttribute("label"); + var split_title = old_title.match(/^(\d+:\s+)(.*)/); + if(forceclear) + { + for(var i=0;i