getFoldWidgetRange(row) returns undefined for YAML when called on rows not at the start of a fold region
- Lenguaje dominante
- JavaScript
- Estrellas
- 27.1k
- Forks
- 5.3k
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
### Describe the bug
The getFoldWidgetRange(row) function behaves inconsistently between YAML and XML. For YAML, it only returns a valid fold range if called on the first line of the fold region. For XML, the function correctly returns the entire fold region even when called on lines within the fold.
### Expected Behavior
Calling getFoldWidgetRange(row) on any line within a fold region should return the full fold region, regardless of whether the line is the first, middle, or last line of that region. Behavior should be consistent across file types, including YAML and XML.
### Current Behavior
In YAML code, getFoldWidgetRange(row) returns undefined when called on a row that is not the first line of the fold region. This inconsistent behavior does not occur in XML files, where the same function correctly identifies the full fold range for any line within the folded structure.
### Reproduction Steps
1. Create a YAML code snippet with nested elements, such as:
```
catalog:
things:
element:
- name: stuff
type: junk
version: '0.0'
textstuff: There's some stuff about this junk
textstuff: There's some more stuff about this junk
- name: extrastuff
type: extrajunk
```
2. Call getFoldWidgetRange(3) → returns expected fold region.
3. Call getFoldWidgetRange(4) → still returns expected fold region.
4. Call getFoldWidgetRange(5) → returns undefined.
5. Repeat the same test with the equivalent XML structure:
```
There's some stuff about this junk
There's some more stuff about this junk
```
Observe that getFoldWidgetRange(row) works correctly for any line within the fold region in XML.
### Possible Solution
_No response_
### Additional Information/Context
using files from package 17.10.25 src-min-noconflict
Same behavior when I used the same source as the demo: v1.42.0
Able to reproduce in Windows/Chrome and Linux/Safari
### Ace Version / Browser / OS / Keyboard layout
using files from package 17.10.25 src-min-noconflict / Chrome / Windows 11
Guía de contribución
Evaluación
Este issue todavía no se ha evaluado.