fregante / GhostText

👻 Use your text editor to write in your browser. Everything you type in the editor will be instantly updated in the browser (and vice versa).
https://GhostText.fregante.com
MIT License
3.28k stars 117 forks source link

Multiple windows and tabs #95

Closed Kristinita closed 3 years ago

Kristinita commented 7 years ago

1. Summary

When I work use GhostText, many windows open for me.

2. Expected behavior

Only one new window open, when I use GhostText.

3. Actual behavior

Multiple windows:

Multiple windows

4. Settings

My User/GhostText.sublime-settings:

{
    "new_window_on_connect": true
}

5. Steps to reproduce

The problem is reproduced for me in a version of Sublime Text without plugins and user settings.

I click to Ghost button in Firefox → I select textarea element → one new Sublime Text window and one tab in current Sublime Text window open for me.

If I click to Ghost button in Firefox again 2 times and select textarea element again, 3 new windows and one new tab in current window open for me.

6. Environment

Operating system and version: Windows 10 Enterprise LTSB 64-bit EN Sublime Text: Build 3126 Firefox: 51.0.1 (64-bit) GhostText for Firefox: 1.2.4.1 GhostText for Sublime Text: 1.0.13

Thanks.

fregante commented 7 years ago

Thanks! Yes, that's definitely an issue here: https://github.com/GhostText/GhostText/blob/master/browser/scripts/content.js#L153

In short, GT-browser's focus events listeners are not cleaned up, so they pile up and are called all at once later.

PRs welcome.

svenXY commented 7 years ago

same here with linux and firefox or chrome and gvim

Sebastinator commented 7 years ago

Having similar issues with: Firefox 53.0.3 Sublime 3 GhostText Extension 17.6.1.407

Normally works perfectly on fresh start, but after that it stuffs up by displaying multiple instances in Sublime text editor. The number seems to be adding up such that on the 5th attempt, 5 instances will open. I also noticed that if I close any of the instances on Sublime, then the instance that was actively working, stops working. In other words, in order to sync with the browser, all the useless instances must be kept open.

Kristinita commented 6 years ago

1. Status

At April 2018 bug doesn't reproduce for me. 1 tab open as expected.

2. Successful environment

3. Possibly reason of problem

I sure that is the problem of my browser:

In the past, I move all my profile from Pale Moon to Firefox → I have this and some another bugs.

Now I install the newest Firefox Quantum → move to new Firefox only some profile settings → bugs don't reproduced.

@Sebastinator, @svenXY, can I close this issue?

Thanks.

fregante commented 6 years ago

The bug still exists.

  1. Activate GhostText
  2. Activate GhostText
  3. Activate GhostText
  4. Click on textarea
  5. See 3 tabs open

The bug is verified in https://github.com/GhostText/GhostText/issues/95#issuecomment-277861014

fregante commented 5 years ago

Try this out! https://github.com/GhostText/GhostText/pull/122