Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edit fold names #39

Open
LuchoEskimo opened this issue Jul 25, 2017 · 4 comments
Open

Edit fold names #39

LuchoEskimo opened this issue Jul 25, 2017 · 4 comments

Comments

@LuchoEskimo
Copy link

I really like vimish-fold, but something annoys me: when a region is folded, I can't edit its first line. When the region is the last part of the buffer, it prevents me from adding a new line. Also, using command such as comment-dwim (which comments a region) isn't possible for the whole file: I get the message comment-region-default: Text is read-only. How could I edit fold names ?

@mrkkrp
Copy link
Collaborator

mrkkrp commented Jul 29, 2017

when a region is folded, I can't edit its first line

This is not its first line, it's like a hint of what the fold contains. To edit it you need to unfold it, which makes sense IMO, because you'll be able to see the whole text in normal form.

When the region is the last part of the buffer, it prevents me from adding a new line.

I can't reproduce it here. If I fold several last lines in a buffer, I still can position cursor after the fold and execute either newline or open-line. Maybe it's because my files always end with a newline?

Also, using command such as comment-dwim (which comments a region) isn't possible

This is same idea, you first unfold, then edit. I understand it may be annoying, but the read-only property is there for a reason. It would be too easy to end up with folds that look bad (i.e. fold overlay starts not from beginning of a line but somewhere in the middle) without it.

@LuchoEskimo
Copy link
Author

I now understand your vision of folds!
For the second issue, consider the following file

Fold 1
some text
Fold 2
some text

where lines 1 and 2 are folded together as well as lines 3 and 4. Then, folding all gives something looking like

| Fold 1                                                    2 lines
| Fold 2                                                    2 lines

Now if you want to add something between the two fold, you would naturally position the cursor at the beginning of line 3 (line with Fold 2) and hit <enter>. However, this can't be achieved because text is read-only. Then, you would position the cursor at the end of the first line, after the s of 2 lines, expecting to be able to press <enter> and be able to type text between the two folds: it doesn't work either.

This kind of edits of the name of a fold (that is, just inserting a line before or after a fold) couldn't mess up with the organisation of folds, so I think they should be allowed!

@mrkkrp
Copy link
Collaborator

mrkkrp commented Jul 31, 2017

Yes, I see the problem, but I don't know yet how to solve it.

@LuchoEskimo
Copy link
Author

Perfect, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants