It looks that the code folding feature misinterprets the bind event if it has an event in the format: <<event>>. It interprets the whole script after the "<<" characters as one block. Screen capture of the issue: ![bad](https://cloud.githubusercontent.com/assets/4330744/20103419/3ba1a8cc-a5ca-11...)
<< characters removed: ![good](https://cloud.githubusercontent.com/assets/4330744/20103429/4417f93e-a5ca-11...)
It looks, that if a non-whitespace character is between the <<>>, then the error shows up: ![nochar](https://cloud.githubusercontent.com/assets/4330744/20103807/bb9e6e88-a5cb-11...) ![char](https://cloud.githubusercontent.com/assets/4330744/20103812/bf39667e-a5cb-11...)
Folding is provided by the editing widget we use from the Scintilla project, please report the problem [there](https://sourceforge.net/p/scintilla/bugs/) and post the issue no here for tracking.
Reported to scintilla with id: [#1882](http://sourceforge.net/p/scintilla/bugs/1882/) .
.
The problem is caused by the often used "[exec magic](http://wiki.tcl.tk/812)" in the beginning of the file. This looks like this:
`#!/bin/bash` `# the next line restarts using wish ` `exec wish "$0" "$@"`
So Geany thinks, it is a bash script. And I think it is OK this way...
Oh. Yeah Geany read shebangs and use those over the extension to determine the file type. In your example it's indeed impractical because there is actually 2 different syntax in the same file, but I'm afraid it's a little too complex to deal with, as it measn actually understanding what the shell script *does*.
Also, the `env` technique mentioned in your link is really better unless it actually has a drawback for you, because it's simpler, spawns a simpler intermediate program (`env` is a lot lighter than `sh` -- let alone `bash`), and is common in other languages too, like Python (which commonly uses `#!/usr/bin/env python`). And it won't confuse tools parsing the shebang line either, because they will either not know about the language `env` uses, or they will understand the construct and read the name of the next argument (so here that would be `wish`) and base a guess on that.
Then I will switch over to the `env` method. It is better for everyone. Thank You for the information!
Closed #1295.
github-comments@lists.geany.org