-
-
Notifications
You must be signed in to change notification settings - Fork 29
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
feat: add line count to folded text overlay #129
Conversation
ts-fold.el
Outdated
(line-count (and ts-fold-linecount-show (count-lines beg end)))) | ||
(cond | ||
((and summary line-count) | ||
(format "%s %s" summary (format ts-fold-linecount-replacement line-count))) |
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.
The variable summary
would truncate on its own, so I assumed this could be:
;; <S> This is the summary text... ... (2 lines) ...
and not
;; <S> This is the summary text... (2 lines) ...
I can see the same result from your screenshots. Is this intentional? 🤔
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.
I'm not sure what you mean here? The first example is what the behavior is--the summary truncates on its own and then the line count display is shown afterwards.
- Use line-count instead of linecount - Set `ts-fold-line-count-show` to `nil` by default - Use `ts-fold--truncate-string-ellipsis` in `ts-fold-line-count-replacement` default value - Remove extraneous code
Thanks for taking a look at this and providing feedback! |
((and summary line-count) | ||
(format "%s %s" summary (format ts-fold-line-count-format line-count))) | ||
((and summary (not line-count)) | ||
(format "%s %s" summary (ts-fold--truncate-string-ellipsis))) |
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.
I have removed the logic here since the summary handles truncation independently.
I've changed the logic a little; can you see if it works? Thanks! |
README.md
Outdated
- `ts-fold-line-count-replacement` | ||
- `ts-fold-line-count-format` |
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.
Ha! Funny thing is I had originally named this variable with the format
ending but changed it to end with replacement
after seeing the variable named ts-fold-replacement
in this commit (where it was removed).
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.
Yeah, the "replacement" variable was intentionally used to replace the content (fold range). In this case, we want the "format". :)
Sorry for the confusion, and thanks for being aware of this! 🚀
It works great! Thank you for taking the time to deal with this PR. |
Thank you for your contribution! 🚀 🥳 |
Description
Add a configurable line count to the folded text overlay.
Following are some screenshots of what it looks like.
Default setting
Using horizontal ellipsis unicode character
With lines text and horizontal ellipsis unicode character