Currently in SciTE there seems to be almost no support for code folding in shell scripts (.sh). The only things which can be folded are comments starting with # and function bodies(?) surrounded by braces. It would be very helpful if things like if, while, elif could also be folded.
I'm to blame for a lot of the Bash/shell highlighting updates.
Anyway, I would welcome anyone who wishes to contribute a patch for this feature request.
Currently I cannot promise any updates on any timeline, but I will put this on my list.
A rather simple fix is to enable folding for
if
(fi
),case
(esac
) anddo
(done
).Looks good to me, I just have a few small code improvement suggestsions, see the alternative diff attached (based on yours).
if (styleNext != style)
as a canonical way of meaning if style changes, instead of repeating the style ID.Apart from that, an extra improvement would be folding on
else
and}{
but that can easily be a second step.I'll leave the improvement patch in both of your good hands. I am busy with other stuff and will be lurking for a few months yet, so have fun guys. :-)
looks good than my patch. But
wordlen < sizeof(word)
need change towordlen < sizeof(word) - 1
, otherwise buffer overrun atword[wordlen] = '\0';
.Last edit: Zufu Liu 2018-09-02
Oops, you're of course right. Updated patch (using
(wordlen + 1) < sizeof(word)
) attached.Committed as [54561e].
Related
Commit: [54561e]