cpjreynolds / rustty

A terminal UI library
https://docs.rs/rustty
MIT License
153 stars 14 forks source link

Add Terminal.printline*() helpers #5

Closed ghost closed 9 years ago

ghost commented 9 years ago

Adds two new helper methods to Terminal, printline_with_cell() and printline() which are shorthands for putting a sequence of characters on screen.

The case for writing down sequences of characters in the terminal seems common enough to warrant the presence of those helpers.

ghost commented 9 years ago

Oh, docstrings have to be runnable? I'll be fixing that shortly...

cpjreynolds commented 9 years ago

Thank you for the PR!

I want to hold off on merging this for the moment until I have the last of the major refactoring changes done to the core API. My eventual plan for the library was to have an extremely minimal core module and separate modules for "higher level" functions built on top of it.

Helper methods like these are something I really want in the library in the very near future, I just want to get the implementation of the core library which the helper functions rely more stable before merging.

My tentative timeline for this is within the week, as soon as the core module is sorted out this will be in the library. Thanks again!

ghost commented 9 years ago

Alright, fine by me. I was also planning on starting implementing an ncurses-like windowing system, so I'd like to volunteer for helping you with the high level stuff.

cpjreynolds commented 9 years ago

Awesome! That would be great.

With regards to windowing. There are some changes I'm planning on merging soon that should lay the foundations for a solid windowing system. The general idea being that we can take a slice of references to the underlying terminal cells, which would implement the same interface as CellBuffer, then windows could be drawn to without having to worry about messing up any cells not contained within its borders.

I'll keep you posted, and thanks for the help!

ghost commented 9 years ago

FYI, I've started putting together some kind of UI API in my wip branch. The particular commit is https://github.com/hsoft/rustty/commit/c2bee11ee29bce2273c46e72582f8ebd5d42b434 .

I'm not too sure where I'm going with this or if I'm going in the right direction, but for now, this works for me (BTW, in case you're curious, https://github.com/hsoft/civng is my "proof of concept API consumer").

In particular, I'm a bit concerned that I'm "over-traiting" the API with the CellAccessor thing, but then again, I couldn't come up with a more elegant way to have a Painter trait that could target both a subwindow and the terminal.

@cpjreynolds, is that in line with what you had in mind?

ghost commented 9 years ago

This PR is superseded by #15. Closing.