-
Notifications
You must be signed in to change notification settings - Fork 10
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
Support multiple box-drawing sets #11
Comments
Concerning the implementation I'd say:
I'll se if I have some time to look further into that. [1] : note that as far as I understand, the use of unicode characters for corners and such is not utf-8 specific, but rather unicode (vs ascii) specific (utf-8 is simply one among many encoding for unicode code points). |
I think it's doable, but with some effort. The immediate idea that springs to mind is that I'd love to have this feature but it's some work and I'm busy with many projects. Side note: same goes for tree display, btw, not just boxes. |
Yes, the box drawings are Unicode code points. But when printing, the program has to actually emit bytes to represent those code points. It does have to pick an encoding. I guess that |
In #19 we got nice unicode boxes, but it didn't add a customizable set of box edges. The main function is: type display_conn_basic = {
mutable left: bool;
mutable right: bool;
mutable top: bool;
mutable bottom: bool;
}
type display_connections = {
mutable nontree: display_conn_basic;
mutable tree: display_conn_basic;
}
(* … *)
let disp_conn_char conn =
match conn.left, conn.right, conn.top, conn.bottom with
| false, false, false, false -> ""
| true, false, false, false -> ""
| false, true, false, false -> ""
| false, false, true, false -> ""
| false, false, false, true -> ""
| true, true, false, false -> "─"
| true, false, true, false -> "┘"
| true, false, false, true -> "┐"
| false, true, true, false -> "└"
| false, true, false, true -> "┌"
| false, false, true, true -> "│"
| true, true, true, false -> "┴"
| true, true, false, true -> "┬"
| true, false, true, true -> "┤"
| false, true, true, true -> "├"
| true, true, true, true -> "┼" so I imagine we could allow the user to provide such a function if they wished to change the display? |
I think this is not worth it as a global setting, but would make sense as a frame style setting, with a small number of styles that are not too hard to reproduce across the main (planned) backends -- text, html, latex. For example: |
Currently, boxes are drawn with
'+'
,'-'
and'|'
. Support for unicode's box-drawing characters would be good as they are designed to match up more precisely than the ASCII options currently available.The box-drawing characters also include more specific joiners than
+
. There are angle joiners (e.g., ┌), three prongs joiners (e.g., ├), and the full joiner (┼). This would probably cause major changes to the code base.See https://www.fileformat.info/info/unicode/char/search.htm?q=box+drawings&preview=entity for a full list.
From a user interface perspective, I'd be content with something along the lines of
type drawings = ASCII | UTF8_LIGHT | UTF8_HEAVY
, but I could also seetype drawings = { hz: Uchar.t; vt: Uchar.t; join: Uchar.t; hzdown: Uchar.t; hzup: Uchar.t; … }
.The text was updated successfully, but these errors were encountered: