2 May 2012 15:18
Shbang not detected after loading session and switching tab
Martin Panter <vadmium.gg <at> gmail.com>
2012-05-02 13:18:42 GMT
2012-05-02 13:18:42 GMT
Hi This issue has been bugging me for a while. It was happening in 3.0.2 and 3.0.3 Arch Linux packages and still in a 3.1.0 package I compiled myself, but I think it may be a regression because I’m pretty sure it used to work better. I have Scite set up to automatically load the previous tabs (session) when it starts. When it has loaded the tabs, the initial selected tab is a file with an extension that selects the syntax highlighting (e.g. SciTEIO.cxx). When I change to a tab that is meant to be using a shebang to select the syntax highlighting language (e.g. filename "filefs" beginning with "#! /usr/bin/env python2"; I have set up shbang.python2=py), there is no highlighting. However opening the file manually rather than via session loading automatically selects Python highlighting, and it also works if the shebang file is initially selected when Scite loads (rather than switching tabs). I did a bit of digging and came up with the attached stab-in-the-dark change which seems to fix the issue for me. There is a "language" variable which was still holding its value (e.g. "cpp") from the previous tab when SciTEBase::CompleteOpen() is invoked, which means that it doesn’t bother calling DiscoverLanguage() to read the shebang line. It looks like "language" is meant to be initialised in the ReadProperties() function, so I just moved the call up so ReadProperties() gets called before DiscoverLanguage(). The code is a bit too complicated for me to say, without spending ages studying it, if it’s a good fix and doesn’t break anything. I would appreciate if someone with more knowledge of the code could take a(Continue reading)
RSS Feed