Created attachment 126956 [details] A minimal test case for bug SUMMARY Code folding seems to be broken in Kile. For example, \begin{document} will catch the first \end section as the end of the document. Supposedly, structures such as : % BEGIN something . . . % END something should be foldable, but are not (according to this: https://tex.stackexchange.com/questions/306546/code-folding-in-kile ). % BEGIN and % END are highlighted in blue, but no folding is possible; there will not be any folding notes available. I can not find any official documentation describing such feature, however it would be immensely useful to be able to fold structure of the document away. Also, it would be very useful to e able to fold away the preamble (part before \begin{document}. This is not possible at the moment. A minimal test case / file is attached. STEPS TO REPRODUCE 1. a) Add any section after \begin{document} with \end{whatever} 1. b) add a comment with % BEGIN something and later a comment % END something OBSERVED RESULT 1. a) observe clicking > (arrow / triangle) next to \begin{document} will fold until \end{whatever} 1. b) No folding node will be added at % BEGIN EXPECTED RESULT 1. a) Clicking folding note at \begin{document} should fold until \end{document}. It should not fold prematurely at \end{whatever} 1. a) % BEGIN ... % END should be usable and cause folding nodes to appear. SOFTWARE/OS VERSIONS Linux/KDE Plasma: 5.18-2 (available in About System) KDE Frameworks 5.67.0 Qt 5.14.1 (käännetty versiolla 5.14.1) xcb-ikkunointijärjestelmä ADDITIONAL INFORMATION Kile 2.9.93
Comment on attachment 126956 [details] A minimal test case for bug >\documentclass[a4paper,10pt]{article} > >\usepackage{ucs} >\usepackage[utf8]{inputenc} >\usepackage[finnish]{babel} >\usepackage{fontenc} > >\usepackage[dvips]{hyperref} > >\author{} >\date{22.3.2020} > >\begin{document} > \begin{abstract} > > \end{abstract} > >% BEGIN something >Here are some text describiing a new theorem. In the equation >\begin{equation} > E = mc^2 >\end{equation} >we have a solution for energy-mass equivalence. > >% END something > >% some comment BEGIN >Some text here >% some comment END >% END > >\end{document}
Sorry for the noise (previous comment was not meant to be). I noticed as sending this bug, there is a workaround: add something (anything except space) between % and BEGIN and % and END. Anything, say, another % will suffice. Then Kile will be able to fold the blocks in question.
Proposed patch: https://phabricator.kde.org/D29521
Git commit 0b6c88cfc16780cbbe8ccc1a9f5b0a796365a069 by Christoph Cullmann, on behalf of Nibaldo González. Committed on 09/05/2020 at 11:10. Pushed by cullmann into branch 'master'. LaTeX: fix folding in \end{...} and in regions markers BEGIN-END Summary: ## Fix folding in \end{...} In `\end{...}` the folding region "block" is terminated twice, which causes a folding error. {F8299444} ## Add folding in regions BEGIN/END Add code folding in the rules of the region markers BEGIN/END. The context "FindComments" is created with the rules of comments. Reviewers: #framework_syntax_highlighting, dhaumann, cullmann Reviewed By: #framework_syntax_highlighting, cullmann Subscribers: kwrite-devel, kde-frameworks-devel Tags: #kate, #frameworks Differential Revision: https://phabricator.kde.org/D29521 M +3 -3 autotests/folding/example.rmd.fold M +54 -30 autotests/folding/highlight.tex.fold M +24 -0 autotests/html/highlight.tex.html M +24 -0 autotests/input/highlight.tex M +24 -0 autotests/reference/highlight.tex.ref M +36 -35 data/syntax/latex.xml https://commits.kde.org/syntax-highlighting/0b6c88cfc16780cbbe8ccc1a9f5b0a796365a069
Fixed in KDE Frameworks 5.71.0, available on Sat June 13, 2020.