5digits / dactyl

Pentadactyl and other related Gecko extensions
Other
468 stars 98 forks source link

Pentadactyl always opens new child tabs in Tree Style Tab since updating to Fx44 #140

Closed symmetryrtemmys closed 8 years ago

symmetryrtemmys commented 8 years ago

Hello,

With the latest versions of both TST and Pentadactyl installed, every new tab is opened as a child tab of the current one. The only situation in which this is not the case is when opening several tabs with the same command, e.g. :tabopen google.com | duckduckgo.com

It also opens child tabs when using QuickMarks, and when using hints.

There is an identical bug for Vimperator, and there is an open issue on TST's Github here. Google Translate was somewhat helpful, but I am not sure if a solution has been found

piroor commented 8 years ago

Self translation.

By recent changes of TST, now the strategy was changed. Old TST opened new tabs as independent by default, and only intentionally attached tabs became children of the current tab. However, now new tabs with relatedToCurrent or referrerURI option are opened as children of the current tab, and only intentionally rejected tabs become independent tabs.

If Vimperator (and Pentadactly) opens a new tab via BrowserOpenTab() or something, they are tracked by TST and new tabs will be opened as independent at bottom of the tab bar. However, because Vimperator calls a lower API gBrowser.loadOneTab() with relatedToCurrent option, TST opens those tabs as children of the current tab.

So, there are some choices:

  1. I make TST's condition more harder to open new tabs as children.
  2. TST injects some codes into Vimperator's internal function to open new independent tabs.
  3. Vimperator calls TST's API to open new independent tabs.

Currently I have no better idea about the 1st choice. The 3rd choice depends on Vimperator's author's will. The 2nd choice seems most realistic solution, but it is risky because such injection will be broken by future changes in Vimperator itself.

I need a cool idea for the 1st choice, because many other addons can have same compatibility issues like this.

oddRaven commented 8 years ago

I have this problem as well. What is the reason for this change in strategy?

piroor commented 8 years ago

I have this problem as well. What is the reason for this change in strategy?

Because I got many requests to open child tabs from other addons like this and I had to write special codes to inject API call for each addon again and again. Such injection is troublesome, because redefined functions can be broken easily from variables defined with const - they can't be accessed from other namespaces anymore, so I hoped that I reduce such dangerous codes from TST as possible as I can. I don't want to inject my custom codes into Vimperator's function.

piroor commented 8 years ago

After the commit https://github.com/piroor/treestyletab/commit/0bfedf7480e5dab008a5de2e52a96bcadc9a597f TST detects new "possibly child" tabs more strictly. It is the 1st solution I told at https://github.com/5digits/dactyl/issues/140#issuecomment-184127678 and I hope that it solves this problem.

symmetryrtemmys commented 8 years ago

Problem solved! This also opens up new potential Pentadactyl/Vimperator commands for hooking into TST and opening child tabs with a keyboard shortcut - say, ^t, perhaps.

Thank you piroor!

oddRaven commented 8 years ago

Working again for me too now.

FLHerne commented 8 years ago

And for me. Thanks! @symmetryrtemmys 'ntnn' already wrote that, plugins/contrib/treestyletabs.js has a :tabchildopen along with many other useful commands. :-)

polyzen commented 8 years ago

@symmetryrtemmys, issue resolved? Please close :)

symmetryrtemmys commented 8 years ago

@polyzen apologies! :)

phanimahesh commented 8 years ago

@symmetryrtemmys None needed. :)

@polyzen seems to have gone on a spree and requested all possibly outdated issues to be closed.