11 ms·
Possibly a new way of drawing boxes in the terminal
- singularity2001 4y agoI'd rather see proper image display as a standard feature in all terminals
- quechimba 4y agoI made a responsive progress bar this way a few weeks ago: https://youtu.be/hzts6D2Dc2s https://youtu.be/hzts6D2Dc2s
- alrlroipsp 4y ago
- dixie_land 4y agoTook me a while to understand how he was able to "push" the lines to top/bottom/left/right of a character until I re-read the article, biggest take away for me: > Unicode contains one eighth vertical and horizontal blocks which are fantastic for displaying terminal progress bars with apparently higher "resolution" that a single character.
- deleted 4y ago[deleted]
- nuancebydefault 4y agoThe thing is, if you draw boxes in a terminal, you are targeting users that don't care too much about graphical user experience ie. users who feel comfortable and happy with a CLI interface. Users who care about colour bleeding don't even try such things in a terminal.
- PeterWhittaker 4y agoAlternatively, you need a controlled interface that constrains what users can do and provides responsive, comprehensive validation, but you cannot use a GUI because of the excessive attack surface. It is easier to code a relatively more secure constrained TUI login shell with ncurses than with a full GUI library.
- nuancebydefault 4y agoThanks for introducing the term TUI to me, it appears to be applied more commonly than I thought. I'm at HN to interact and learn.
- woojoo666 4y agoWhat's the excessive attack surface on a GUI?
- PeterWhittaker 4y agoAll of the supporting libraries and services, e.g., DBUS. TUIs tend to have much simpler library dependencies and far fewer system dependencies.
- worthless-trash 4y agoNo cross site scripting. No CORS.
- ale42 4y agoI would say this is not completely true. I spend a lot of time using CLI applications, but I _do_ care about how the terminal contents look!
- vardump 4y agoThat kind of box drawing was pretty common on 8-bit character map systems, like Commodore 64 and I'd guess also on game consoles, like Nintendo Entertainment System.
- ThomW 4y agoI was going to say “this guy has never played around on the C=64!” lol
- kristopolous 4y agojust want to point out to people to not be discouraged by things having been done before. Always worth saying ...
- vardump 4y agoCouldn't agree more!
- klyrs 4y agoI'd like to discourage people from naming things after themselves, when those things have already been done before. https://fliptomato.wordpress.com/2007/03/19/medical-researcher-discovers-integration-gets-75-citations/ https://fliptomato.wordpress.com/2007/03/19/medical-research...
- kristopolous 4y agoI don't have domain expertise here at all but I'd like to hear the other side. Trapezoid estimation I believe I learned when I was 15 or so as part of standard coursework. I would find it remarkable if all these accomplished scientific experimenters and scholars first encountered it here Not impossible but I think Occam's razor would suggest there might be domain specific nuances to the implementation that makes it special. On the other hand I've certainly encountered a ton of stupidly obvious techniques in my 30 years of programming which I thought were unremarkable only to discover people have developed a special language and narrative history of attribution to it. You swim through the jargon presuming it's profound and enlightening but then ultimately get disappointed. It's an emotionally impactful experience so I tend to remember it.
- PeterWhittaker 4y agoFirst glance is impressive. I’ve spent a lot of time in ncurses for a security appliance we make, so I have to ask: how does Textualize compare to ncurses in terms of a) richness and b) complexity? We create some fairly complex and feature rich forms for managing transfers in this appliance, but ncurses isn’t always the friendliest beast - we’ve managed to make it simpler to use with a lot (a lot!) of component-like functions to get to the level of abstraction we need, but one wonders about the grass over yonder fence.
- pengaru 4y agoI'm surprised to hear someone is developing current ncurses applications today in a commercial context. At a former "disaster recovery" startup I had written a little ncurses tool for handling data transfers from pools of external USB drives customers would ship us to seed their off-site backups. This was something like 8 years ago now, and it was already a situation where literally nobody else in the company, new or existing hires, wanted anything to do with maintaining what was really a small ~1000-line C+ncurses application. I was on the systems/platform/backend/OS team and it was just a weekend hack to get us going with something ops could interface with via putty. I can't imagine how much more difficult it is to find anyone with ncurses familiarity today, and few people seem interested in wasting time learning such antiquated tech. In hindsight I feel like I never should have written that tool in the first place, instead letting one of the front-end devs just make a REST API and web doodad for the whole thing. At least then it would have been familiar territory for practically every engineer they hired.
- PeterWhittaker 4y agoFunny thing about writing security products: one tends to work with a lot of things most people don’t want to touch (SELinux and SecComp come to mind; yeah, they are part of my job). As I noted in another comment, using a TUI starts us off with a smaller attack surface and fewer dependencies, which makes it easier to scrub things down even further with relative ease (relative). It may make tooling and programming tougher, but it simplifies the overall job of achieving a target level of security.
- 4y ago
- togaen 4y agoFor those who want to use a GUI, but don’t want to say they use a GUI.
- opan 4y agoFor me the main benefit of TUI programs is working with ssh and tmux. Also, they just tend to work better than gtk and qt stuff. My IRC client never lags or crashes, unlike my XMPP and Matrix clients.
- whartung 4y agoAlso, even though they may support a mouse, TUIs almost inevitably are very well keyboard driven, and typically do a better job of it than a GUI, particularly web GUIs. It can be done with GUIs, of course. You can also have bad TUIs. But "out of the box", the TUI tends towards better keyboard navigability than GUIs, so are more likely to get something usable "for free". I find it very easy to get "trapped" in GUIs where your keyboard falls in to a focus pit that it can't get out of.
- int_19h 4y agoElectron apps seem to be especially bad at keyboard navigation. A decade ago, the kind of breakage you'd see in GUI apps when trying to use the keyboard was mostly the lack of shortcuts/accelerators and nonsensical tab order - but it would still be usable in principle. Now I keep running into apps where tab navigation doesn't work at all, or where Enter/Esc doesn't do the expected thing in modal dialogs.
- ectopod 4y agoModern Windows apps also suffer from this kind of breakage. For example, the calculator. If you use the mouse to press a button while entering a calculation (for a trigonometric function say) then when you press enter to get the result it just presses that button again. This is contrary to the Windows design guidelines and, more importantly, it isn't useful. It's like the apps have been redeveloped by people who never use a keyboard.
- chrismorgan 4y agoI think that these four characters are being used: U+2581 LOWER ONE EIGHTH BLOCK U+2594 UPPER ONE EIGHTH BLOCK U+258E LEFT ONE QUARTER BLOCK U+1FB87 RIGHT ONE QUARTER BLOCK (Sorry, no actual glyphs, HN is gobbling them.) Notice anything different about the last one? It was added in Unicode 13 in a new block. This means very much reduced font support, and if absent, it generally means the use of a fallback font, which is very likely to mean a wider glyph, which means that the right edge of your box is displaced and probably the wrong thickness, and in some environments (though no proper terminals) anything following it will be offset too. I use Triplicate as my monospace, and yeah, it lacks U+1FB87 RIGHT ONE QUARTER BLOCK, so this technique looks awful. It gets a little worse when you consider line-heights. Some fonts design these things to fit line-height 1, others their default line-height, I think. The concepts are a bit fuzzy and implementations inconsistent and I don’t actually know the full details of what I’m talking about. Still worse, in browsers I don’t think the font’s proper preferred line-height (if that’s a thing?) is actually exposed, so you can’t actually get the correct result (the closest you’ll get is hard-coding the font metrics and hoping that font gets used, but that’s never guaranteed). But the end result is that you might get your box not neatly lining up in a terminal and probably won’t get it lining up in a browser, either squished more than it should be or with gaps, and in either case it’s going to be visually unbalanced in quite a disconcerting way, whereas the regular box-drawing characters are more likely to line up due to more care and even if they don’t the gaps (or maybe-visible-with-the-wrong-sort-of-antialiasing overlaps) will be balanced. Sample (remote since HN is gobbling all these Block Elements characters): https://temp.chrismorgan.info/2022-10-16-hn-comment-33217918.html https://temp.chrismorgan.info/2022-10-16-hn-comment-33217918..., also try copying it to your terminal to see if it differs from the web layout technique. Conclusion: stop trying to be fancy, block element support isn’t good enough and the technique’s failure modes are quite bad; just stick with box drawing characters and no clever backgrounds, because that will work much more consistently, and wastes less space too.
- vidarh 4y ago> Notice anything off about the last one? You can just use U+258A LEFT THREE QUARTERS BLOCK and inverse colour settings. I use U+258B (LEFT FIVE EIGHTS BLOCK) in my editor that way (inverse of what you'd "expect", to get 3/8th's instead of 5/8ths)
- verisimilitudes 4y agoNot all CEOs of tech startups have the time to write code. Fortunately while Textualize is still in its development phase I have plenty of opportunity to get my hands dirty. Oh, so this is something unimpressive being used to disguise an advertisement. I've designed such interfaces, and drawing boxen is superfluous to the point I realized it's not worthwhile. Regardless, this solution seems obvious for anyone who actually had this issue, and I'm doubtful there were many.
- 1letterunixname 4y agoI wonder if anyone remembers the alternate text plane that allowed Norton/Symantec, Central Point Software, and moused in FreeBSD simulate a "pixel-accurate" mouse cursor in a text mode display (often 720 x 480 addressable as 80x25 using 8x16 glyphs that were last bit extended to 9x16). There was a little-used secondary code plane function in VGA where 512 characters could be displayed by sacrificing half of the colors (foreground color intensity bit 16 colors -> 8 colors). The secondary code page would be used as a raster bitmap to overlay the regular code page glyphs with the mouse cursor shape. Ultimately, the mouse cursor was typically 1-4 magic characters. One could code a double-sized cursor to use 4-9 characters if they so chose. The extra unused characters could be used for pixel-granular thermometer, progress bars, extra drawing characters, and UI elements like radio buttons and check boxes. /* segment:offset -> linear = (segment << 4) + offset */ volatile void *text_base = (volatile void *)(0xb8000) /* B800:0000 to BFFF:000F is 32 KiB */ /* In VGA, bg bit 3 is a blink bit by default depending on Attribute Mode Control Register bit 3 */ /* In VGA, fg bit 3 is a secondary character code plane if font A and font B pointers are different */ void put_char(int ch, int fg, int bg, int x /* 0..79 */, int y /* 0..24 */, int video_page /* 0..7 */ ) { size_t offset = video_page*4096 + (y*80 + x)*2; uint8_t* p = (uint8_t*)(text_base) + offset; /* Modern compilers should turn this into a 16-bit memory access without worrying about endianness. */ *p++ = (uint8_t)(ch & 0xff); *p = (uint8_t)((bg & 0xf)*16 + (fg & 0xf))); }
- bonzini 4y agoI think you could also replace the font with its inverse so that foreground and background are swapped. Disable blinking and you lose high intensity background but keep high intensity foreground (more useful).
- MontyCarloHall 4y agoBisqwit made a great video on this (as usual): https://youtu.be/7nlNQcKsj74 https://youtu.be/7nlNQcKsj74
- int_19h 4y agoI remember pixel-accurate mouse cursors in Norton/Symantec products around mid-90s, but at that time they were using 4 characters in the 128-255 range to render the cursor - you could actually observe that by displaying a file with all 256 characters on the screen and then moving the mouse around.
- amelius 4y agoThe problem is that if you put such a box on top of other content you blank out part of the content.
- samatman 4y agoAny full box in the terminal takes up two full rows top and bottom, and two full columns left and right, this is no different. It's a clever trick actually, though it doesn't compose the way the traditional box-drawing characters do. Good for one (1) box, where you want to be able to set the background without bleed.
- amelius 4y agoI'm talking about how it looks if the box partially covers other content. A 1-dimensional, 1-sided horizontal example would be if you have abcdef in the background partially covered by ABCDEF in the foreground. With a vertical bar in the middle, it looks like abc|ABCDEF However, with this new technique it looks more like: abc |ABCDEF (approximation, notice the space; also this example assumes a different stacking as used in the article, which brings the problem in the x-direction which is convenient in this example)
- falcor84 4y agoI'm not quite following your meaning here - it's terminal characters, there's no way to do alpha blending, right? So putting any character on top of another character would always replace it.
- amelius 4y agoSee: https://news.ycombinator.com/item?id=33218894 https://news.ycombinator.com/item?id=33218894
- deleted 4y ago[deleted]
- kevin_thibedeau 4y agoThis has been done with DOS CP437 characters albeit with thicker lines. U+2580, 2584, 258C, and 2590.
- mkl 4y agoThose usually make the horizontal and vertical lines different widths.
- PebblesRox 4y agoI like it! Reminds me of the time my woodworking professor told us it was impossible to make dovetailed joints in a spiral because you wouldn't be able to fit the last piece in unless the joints on both ends face the same direction instead of one of them pointing sideways. Of course for my dovetailing project, I had to make a little frame with spiral dovetails, to show that it could be done.
- quackrack 4y agoWhat is a dovetailed joint in a spiral?
- PebblesRox 4y agoSpiral is probably not the best word, sorry. Let me try to explain it another way. (It would be so much easier with a picture!) So a dovetail joint has two pieces that slide together at the corner. Because of how the wood is cut, one side of the corner has a fancy zig-zag showing on the outside (tails) and the other just has boring parallel lines (pins). [0] You have to slide the piece with pins into the piece with tails. So typically if you're making a dovetail box, each side of the box would either have pins on both ends or tails on both ends. This is so that the last piece has both joints pointed the same direction so both ends can slide in to the rest of the box. You end up with two sides of the box showing the zig-zag tails and two sides showing the boring pins. [1] But I figured out how to assemble the box so that each side showed tails at one end and pins at the other. [0] https://technologystudent.com/joints/dovejts.htm https://technologystudent.com/joints/dovejts.htm [1] https://blendswap.com/static/blendImages/2021/7/31/Blend/28666/Wooden%20dovetail%20box%20thumbnail.png https://blendswap.com/static/blendImages/2021/7/31/Blend/286... Edit: another way to describe it is that I made a square frame that had rotational symmetry instead of horizontal and vertical symmetry.
- masswerk 4y ago> No corners pieces. Darn. Actually, Unicode "Symbols for Legacy Computing", U+1FB7C – U+1FB7F ('LEFT AND LOWER ONE EIGHTH BLOCK', 'LEFT AND UPPER ONE EIGHTH BLOCK', 'RIGHT AND UPPER ONE EIGHTH BLOCK', 'RIGHT AND LOWER ONE EIGHTH BLOCK'). But support may vary, as this is a relatively recent addition (based on a proposal from 2019 [1]). That said, there is more to this approach, as it actually solves two problems at once: corners and the surrounding white space required for boxes with a background fill. And there are no compatibility requirements (as compared to using the new Unicode range.) [1] http://www.unicode.org/L2/L2019/19025-terminals-prop.pdf http://www.unicode.org/L2/L2019/19025-terminals-prop.pdf
- tuukkah 4y agoAn advantage with the traditional box characters is that you get consistent 0.5 character margins and paddings. In the example, there's obligatory 1 character vertical margin and horizontal padding (or vice versa). If you want consistence, you have to add one character of vertical padding and horizontal margin, or if you allow "rounded" (missing) corners, I suppose you could have margin in all directions and no padding.