Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code folding with Tcl language and bind command with <<event>> #1295

Closed
karakai opened this issue Nov 8, 2016 · 5 comments
Closed

Code folding with Tcl language and bind command with <<event>> #1295

karakai opened this issue Nov 8, 2016 · 5 comments

Comments

@karakai
Copy link

karakai commented Nov 8, 2016

It looks that the code folding feature misinterprets the bind event if it has an event in the format: <>.
It interprets the whole script after the "<<" characters as one block.
The Geany version is: 1.28
Screen capture of the issue:
bad

<< characters removed:
good

It looks, that if a non-whitespace character is between the <<>>, then the error shows up:
nochar
char

@elextr
Copy link
Member

elextr commented Nov 9, 2016

Folding is provided by the editing widget we use from the Scintilla project, please report the problem there and post the issue no here for tracking.

@karakai
Copy link
Author

karakai commented Nov 9, 2016

Reported to scintilla with id: #1882 .

.

@karakai
Copy link
Author

karakai commented Nov 9, 2016

The problem is caused by the often used "exec magic" 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...

@b4n
Copy link
Member

b4n commented Nov 9, 2016

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.

@karakai
Copy link
Author

karakai commented Nov 9, 2016

Then I will switch over to the env method. It is better for everyone.
Thank You for the information!

@b4n b4n closed this as completed Nov 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants