Martin Panter | 2 May 2012 15:18
Picon

Shbang not detected after loading session and switching tab

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)

Neil Hodgson | 6 May 2012 02:49

Re: Shbang not detected after loading session and switching tab

Martin Panter:

> 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. …

> 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.

   Yes, it is complex. ReadProperties is a fairly heavy call so is avoided when possible. However, this change
moves the call so should be OK. Committed.

   Neil

--

-- 
You received this message because you are subscribed to the Google Groups "scite-interest" group.
To post to this group, send email to scite-interest <at> googlegroups.com.
To unsubscribe from this group, send email to scite-interest+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/scite-interest?hl=en.


Gmane