11# ABSTRACT: Input widgets for raw terminal text input
22
3- use Terminal::MakeRaw ;
3+ use Terminal::API ;
44use Terminal::ANSIParser;
55use Terminal::LineEditor::DuospaceInput;
66use Terminal::LineEditor::History;
@@ -311,7 +311,7 @@ role Terminal::LineEditor::RawTerminalIO {
311311 has atomicint $ ! done = 0 ;
312312 has $ ! parse = make-ansi-parser(emit-item => { $ ! raw-supplier . emit ($ _ ) });
313313 has MouseEventMode: D $ ! previous-mouse-mode = MouseNoEvents;
314- has $ ! saved-termios ;
314+ has $ ! saved-term-config ;
315315 has @ ! active-queries ;
316316
317317 # | Atomically set done, even from outside role
@@ -325,10 +325,10 @@ role Terminal::LineEditor::RawTerminalIO {
325325 # termios), then start the parser, save current TTY mode, flush
326326 # previous I/O, and convert TTY to raw mode
327327
328- if $ . input . t && ! $ ! saved-termios {
328+ if $ . input . t && ! $ ! saved-term-config {
329329 my $ fd = $ . input . native-descriptor;
330- $ ! saved-termios = Terminal::MakeRaw::getattr ($ fd );
331- Terminal::MakeRaw::makeraw ($ fd , : FLUSH);
330+ $ ! saved-term-config = Terminal::API::get-config ($ fd );
331+ Terminal::API::make-raw ($ fd , : when(Terminal::API:: FLUSH) );
332332
333333 $ ! done ⚛= 0 ;
334334 self . start-parser;
@@ -341,11 +341,11 @@ role Terminal::LineEditor::RawTerminalIO {
341341 # mark the saved termios as unused, and optionally output a \n to push
342342 # the cursor to the start of the next line
343343
344- if $ ! saved-termios {
344+ if $ ! saved-term-config {
345345 $ ! done ⚛= 1 ;
346346 my $ fd = $ . input . native-descriptor;
347- Terminal::MakeRaw::setattr( $ fd , $ ! saved-termios , : DRAIN);
348- $ ! saved-termios = Nil ;
347+ Terminal::API::restore-config( $ ! saved-term-config , $ fd , : when(Terminal::API:: DRAIN) );
348+ $ ! saved-term-config = Nil ;
349349 $ . output . put (' ' ) if $ nl ;
350350 }
351351 }
0 commit comments