Closed micha closed 11 years ago
This looks right to me. I'll pull it down and test it out a bit soon (probably tomorrow). Thanks for putting this patch together!
Nit pick: I don't like the name of the op. For one thing, it's not a carriage return AND a line break, it's just a \n. If the patch works, I'll merge it and tweak the keyword myself. Any suggestions for a better name? I was thinking maybe :break
or :hardbreak
. Could also go with :hard
and rename :line
to :soft
.
On a similar note: Is there any reason to emit to ever emit a \r
? I'm not sure I care about Windows, since most Windows software works either way...
Yeah, the :crlf
name was chosen because it's short and it's a sort of traditional name for "line break" that programmers would be familiar with. I was trying to avoid confusing/vague/long names like :force-line
. However, I particularly enjoy the :hard
and :soft
nomenclature. That's nicely descriptive, short, and they even have the same number of characters. Totally into that. As for the \r
, I don't have much experience with what Windows does so I'm afraid I can't help there.
If you want I can add this op to the test harness.
For a brief name either :br (for break and consistent with HTML BR) or :nl (for newline) would be good. If those are too weird because of brevity then I think I like :break best. I think :hard and :soft are too odd and say anything about lines. If you want the names to coordinate then :newline is a pretty good mate for :line (yes you have to be told the difference but once you are it makes pretty good sense).
But going back to :br, aligning the formatting names with HTML should be a good guide everywhere, especially since you work with CSS. Some tools and browsers have non-standard
As for what characters are emitted, that should use whatever the Java line.separator property is. I don't know if Clojure core keeps that handy somewhere (I don't see it in the API).
As discussed in IRC, :break
it is. New patch LGTM. Thanks!
The :break op forces a newline regardless of whether the line fits or not. The current tabstop is preserved.