Sublime Forum

Active window not being updated on view selection. Build 3200 Linux

#1

I have 2 open projects and when I click on a view in the non-active window, the sublime.active_window().id() is still reporting the previous windows id. I have to click in the console area to get the new window’s id to become the active one. If i reboot sublime, it works as expected for awhile, but will always go back to this behaviour.

Not sure on how to reproduce this, but i’ve debugged this with a plugin mapped to F11 as follows:

Hotkey F11

class test_plugin2(sublime_plugin.TextCommand):
def run( self, edit ):

    w = sublime.active_window()
    v = w.active_view()
    print("W id = %u v id = %u" % (w.id(), v.id()) )
1 Like

3.2: Linux save_on_focus_lost setting still partially broken
3.2: Linux save_on_focus_lost setting still partially broken
#2

@wbond

I have reproduced this bug on Linux Mint 17 Qiana, Cinnamon 64-bit 2.2.16, based on Ubuntu 14.04.5 LTS, Trusty Tahr.

As mentioned in the 3.2: Linux save_on_focus_lost setting still partially broken thread I think the problems in that thread and this are related.

I experience the same problem exactly as described by hey_blinken. But I also noticed another aspect to it. Usually only the ST window which has the focus shows a blinking cursor. But when switching to the window which reports the incorrect window id I noticed that a blinking cursor was present in BOTH windows - as if both windows had the current focus. This is a strong indication that the 2 threads are both reporting different aspects of the same problem.

Also earlier I created a new buffer/view using keys and nothing happened. I repeated the key presses several times to apparently no effect. Later I noticed that the new buffers/views had been created in a different window. This is entirely consistent with an incorrect window id being reported. I should mention that the creation of the new buffers was done by a plugin I wrote - it is in this gist but it just uses the API’s new_file() method with the sublime.active_window(). When the new buffers were opened in another window it was an existing window and not one that was created by the plugin (different keys). As usual after restarting ST I was again able to open a new buffer in the active window.

@hey_blinken Could you re-start ST and then test for the problem every 10 mins or so to get a more accurate idea of how long it takes for the problem to re-emerge. The problems re-emerge for me after 1 to 3 hours.

@hey_blinken Could you post your version of Linux as well please.

Hope this helps.

EDIT: The About dialog causing the focus to be auto-changed from one ST window to another one as reported here is, of course, also consistent with an incorrect window id being reported.

0 Likes

#3

I’m using ubuntu 14.04. I’ll try and get some stats on how quickly I get it to happen.

1 Like

#4

@hey_blinken - So you are using Ubuntu 14.04 and I’m using Linux Mint 17 which is built on Ubuntu 14.04. There have been no other responses in this thread or in the related thread which I started - I think if ST Linux users in general were having these and related problems there would have been a mass of me too responses by now and the issue would have been raised during the last few dev releases as well.

It seems likely that when ST moved to GTK3 in dev build 3181 a small aspect of window handling became incompatible with Ubuntu 14.04 based systems.

@wbond - Would you agree with that analysis?

Ubuntu 14.04 is a little old - time to bite the bullet and get around to that long-put-off upgrade.

0 Likes

3.2: Linux save_on_focus_lost setting still partially broken
#5

I have not looked into this, but this seems like the type of thing that should be posted at https://github.com/SublimeTextIssues/Core/issues.

1 Like

#6

@hey_blinken In case you’re not reading the other thread

I’ve reverted to build 3176 until I can spare the time to do a full system upgrade. I suggest you do the same. Post here if you’re not sure how to get a copy of 3176 and install it safely.

0 Likes

#7

@mattst if you have some instructions, that would be helpful.

0 Likes

#8

No problem.

  1. You need to get a copy of sublime-text_build-3176_amd64.deb.

It is probably already stored on your system in the apt cache directory, so just copy it to whatever directory you want (or run the dpkg command in that directory):

/var/cache/apt/archives/sublime-text_build-3176_amd64.deb

If not you can download it from Sublime HQ using wget with the following command, or by pasting the url below into a web browser and saving the file.

wget 'https://download.sublimetext.com/sublime-text_build-3176_amd64.deb'
  1. Quit Sublime Text if it is running.

  2. Use the dpkg install utility to install it with the following command.

    sudo dpkg -i sublime-text_build-3176_amd64.deb

Don’t worry that using dpkg will interfere with the usual apt-get method of installing, it doesn’t. apt-get is a wrapper which in fact just calls dpkg automatically. apt-get is generally preferable to use because it automates the downloading of the .deb file and installs any package dependencies that are needed for you, but that doesn’t matter because Sublime Text does not have any dependencies.

Hope this helps.

0 Likes

#9

@wbond If Sublime HQ were to leave the last few ST versions on your apt server - say the most recent 3 stable and all dev releases since the last stable version - then the above process could be simplified to the rather more convenient one-liner:

sudo apt-get install sublime-text=3176

Thanks.

P.S. Apologies if I’ve over used @wbond recently.

0 Likes