Conversation
This gets rid of using the tput program to retrieve the ANSI escape codes. One dependency on tput still remains: Determining the current number of rows and cols of the terminal window. That's to be removed in a separate commit.
|
I'd like to get feedback on the PRs first and when things look good release Terminal-API. This will allow me to still make changes to T-API without burning version numbers. |
| Terminal::MakeRaw::makeraw($fd, |$mode); | ||
| $saved-term-config = Terminal::API::get-config($fd); | ||
| my $when = $drop-old-unread ?? Terminal::API::FLUSH !! Terminal::API::DRAIN; | ||
| Terminal::API::make-raw($fd, :$when); |
There was a problem hiding this comment.
:when is a somewhat odd name for this parameter. Maybe :how or :method or :cleanup or so?
There was a problem hiding this comment.
This was inspired by the man page (highlight mine):
optional_actions specifies **when** the changes take effect:
TCSANOW
the change occurs immediately.
TCSADRAIN
the change occurs after all output written to fd has been transmitted. This function should be used when changing parameters that affect output.
TCSAFLUSH
the change occurs after all output written to the object referred by fd has been transmitted, and all input that has been received but not read will be discarded before the change is made.
Do you still think the name is suboptimal? (I don't have strong emotions, so if you think something else is better, I'll gladly change it.)
There was a problem hiding this comment.
Hmmm. In that case, I think your choice is correct (to match the underlying documentation, since this is a relatively thin layer in the Unix world at least).
Whether the original API had good naming sense is a different question -- but not your problem to solve. ;-)
japhb
left a comment
There was a problem hiding this comment.
Finally! Kind of nice seeing tput go away. 😁
|
@japhb This fails on MacOS. Reason: Terminal-API is native-calling |
|
Well shoot, that bites. All right, reverting. |
Do so by relying on Terminal-API for retrieving the Window size and using VT codes directly for output instead of using on a
tputredirection.Part of a set of PRs in Terminal-LineEditor, Terminal-Print and Terminal-Widgets.
Don't merge yet, Terminal-API isn't released yet!