-
Notifications
You must be signed in to change notification settings - Fork 33
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
Paragraph command not respecting leading non-content formatting characters #63
Comments
Hmm. This is in the category of "historical accident". There was a brief time when the Paragraph command tried to do what you indicated above, and it usually worked out alright. But there were lots of corner cases -- paragraphs that had nothing to do with programming or that contained comment-like characters that weren't comments at all -- which prompted us to revert back to a "dumber but consistent" behavior. Looks like the docs didn't make the transition. I would like to have a comment-aware paragraphing option, but not at the expense of breaking normal text. Ne is supposed to be a Nice Editor, where unexpectedly mangling your text is decidedly Not Nice. I hope to revisit this issue some day. |
Thanks, Todd. Glad to hear it may be revisited in the future. Super useful feature, IMO, even if it were strictly limited to a subset of prefixes (like "> ", "// ", "# ") or to even just one prefix ("> ") to start with. Maybe it would be possible for the user to set a default pref that says, "consider only the following strings as formatting prefixes when reflowing text with Paragraph: ...", if that simplifies and tightens things up. Also, not sure if this is a corner case you were thinking about trying to solve, but I see that in code, lines of code usually directly follow comment lines (with no empty line between them). I could see how making Paragraph smart enough to handle that corner case would be complicated, and I would not expect Paragraph to try and figure that out. Paragraph works on paragraphs (delineated by blank lines). That is, I'd be happy to and expect to change:
to
before hitting |
It occurs to me that I could also use the ne Through command, and have a small shell script do this. I'll give that a try. |
Given this paragraph:
I'd expect
[p
to give me:but instead it gives me:
I see the same problem with
//
,*
,#
, and so on. Works fine if the leading / left-hand-side characters are only spaces.This is with ne v3.1.2 running on a fully updated Debian "Testing".
The docs for paragraph indicate ne should support this smart Paragraph behaviour, and I thought it got this feature years ago.
I think it's an extremely useful and necessary feature. I write lots of code comments (prefixed with
//
or#
) and markdown blockquoted paragraphs (prefixed with>
) --- it would be painful if ne couldn't Paragraph them while preserving the left-hand-side prefixins.Actually, I'd expect that for any series of lines, ne should be able to identify if every line starts with the same prefix (whatever it may be --- different programming languages may use different commenting/quoting/whatever styles), and preserve that pattern when Paragraphing it. For example, I'd expect ne to be able to correctly Paragraph:
I'm not sure why ne would be limited to special-cases like
//
and>
.The text was updated successfully, but these errors were encountered: