-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Conversation
… not correctly updated after deleting lines above a folded region.
Tagging @swmitra |
handled case in xml type files where the start of a collapsible region can span two lines.
I've looked a bit at this. I've noticed a small issue: if collapse a folded region and then expand it, the code folding triangles are not updated until you move the cursor. I think this is a minimal fix to solve the issue, but the right fix seems to me that we should update all the code of the code folding addon of CodeMirror. |
@ficristo I will have a go at adding some more tests. Could you clarify what you mean by 'update all the code of the code folding addon of CodeMirror'? |
If I'm not mistaken, the |
Ah yes - better a different PR. There are lots of subtle differences, mainly to do with the ability to persist and restore fold states. |
… range of different file types.
…ather/brackets into Code-folding-issue-12456
Changes ready for another review. |
}); | ||
|
||
if (force === "fold") { | ||
delete range.cleared; | ||
cm._lineFolds[pos.line] = range; | ||
// in some cases such as in xml style files, the start of line folds can span multiple lines | ||
// render a gutter marker for both the beginning and end of the line |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use capital letter at the start of a sentence. This needs some dots too.
@thehogfather thank you a lot! |
…folding-issue-12456
If the newlines I mentioned are necessary as the globals to make testing easier, then is fine to leave them. |
@thehogfather could you take a look at the test failures? So now when a tag span on multiple lines you have two code folding triangles. I'm not an UI / UX expert so I'm not sure is actually a good or bad idea. /cc @marcelgerber |
@ficristo regarding the folding triangles, I think this is fine. A better design might be to hide the opening tag when the range is collapsed or to only show the fold triangles at the start of the folded/foldable range (so in your example we dont show line 25 as foldable - only line 29). This is however a little tricky - would need a rewrite of the xml-range finder. We are currently using whatever version is from code-mirror. The same workaround is present in code-mirror. I think it is ok as it doesn't reduce functionality nor does it put the editor in an unusable state. |
I still see some test failures on the latest commit. |
…folding-issue-12456
@ficristo would you kindly point out the failing test if possible? I typically run the extension test as opposed to 'All tests' so I might have missed something. I've just run the tests again and all are passing. Note that the last commits need a full reload of brackets so that the changes in code mirror are reflected in the tests. |
@redmunds interesting idea - I'd however question what happens to the fold mark in the gutter when either of the collapsed ranges in the editor is clicked. They should probably be treated as two independent ranges (as displayed in the editor) and marked as such in the gutter with two fold triangles when open. |
Since the behaviour match the CodeMirror one I'm going to take this as is and I'll open a new issue to discuss more the UI / UX. @thehogfather can you squash a bit the commits? |
@ficristo not sure how much more I can squash this. I have tried without much success. Maybe whoever merges on github can use the Squash and merge button? Alternatively I would probably create a new PR with all the changes if that is preferable. |
@thehogfather thank you. |
Addresses issue where code folding triangles in the gutter were sometimes not correctly updated after deleting lines above a folded region.