Bug 426377

Summary: code folding with "null record" in Ada folds the rest of the file completely
Product: [Frameworks and Libraries] frameworks-syntax-highlighting Reporter: Mario Blunk <mario.blunk>
Component: syntaxAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: christoph, justin.zobel, mario.blunk, walter.von.entferndt
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: wrong folded "null record"

Description Mario Blunk 2020-09-10 15:48:23 UTC
SUMMARY
Code folding on "null record" does not work properly.

OBSERVED RESULT
If code is folded at a line like

type thing is null record;

then everything after that line down to the end of the file is folded.

EXPECTED RESULT
A fold should not be allowed instead.

SOFTWARE/OS VERSIONS
Linux/Xfce: 4.14
KDE Plasma Version: none
KDE Frameworks Version: none
Qt Version: 5.15.0

ADDITIONAL INFORMATION
Comment 1 Mario Blunk 2020-09-10 15:49:10 UTC
Created attachment 131545 [details]
wrong folded "null record"
Comment 2 Justin Zobel 2020-11-13 05:51:06 UTC
Can you please supply the relevant code for testing purposes?
Comment 3 Mario Blunk 2020-11-13 21:00:42 UTC
(In reply to Justin Zobel from comment #2)
> Can you please supply the relevant code for testing purposes?

Hi Justin,
thanks for your work. Please find some examples on null-records here:
https://github.com/Blunk-electronic/ada_training/blob/master/src/records_3/records_3.adb

Best,
Mario
Comment 4 Justin Zobel 2020-11-13 21:49:35 UTC
Information supplied, moving back to reported status for investigation.
Comment 5 Justin Zobel 2020-11-14 00:05:22 UTC
Thanks Mario, I can confirm this folds from null record; to the end of the file.
Comment 6 Bug Janitor Service 2023-07-13 00:28:43 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/syntax-highlighting/-/merge_requests/503
Comment 7 Christoph Cullmann 2023-07-14 21:31:49 UTC
Git commit a22703c25934b7d1ff30e6b1dde47d94d1e2e19e by Christoph Cullmann, on behalf of Jonathan Poelen.
Committed on 14/07/2023 at 21:31.
Pushed by cullmann into branch 'master'.

ADA: fix folding on "null record" ; add digit separator, based numeral and keywords

- fix folding on `null record`

```ada
type Car is record -- beginRegion=RecordRegion
  -- .....
end record -- endRegion=RecordRegion
type Null_Record is null record;
-- Before                ~~~~~~ beginRegion=RecordRegion
-- After                 ~~~~~~ no region
```

- new highlight: Base, Exponent

```ada
   3#011201#e3
-- ^ Base
--   ^ Decimal
--         ^ Base
--          ^ Exponent

   3#0112401#e3
-- ^ Base
--   ^ Decimal
--       ^ Normal Text (4 is not valid in base 3)
```

A  +164  -0    autotests/folding/test.adb.fold
A  +171  -0    autotests/html/test.adb.dark.html
A  +171  -0    autotests/html/test.adb.html
A  +164  -0    autotests/input/test.adb
A  +164  -0    autotests/reference/test.adb.ref
M  +167  -24   data/syntax/ada.xml

https://invent.kde.org/frameworks/syntax-highlighting/-/commit/a22703c25934b7d1ff30e6b1dde47d94d1e2e19e