Skip to content

Commit 6cbd8fc

Browse files
authored
Merge pull request #10 from patrickbkr/terminal-api
Move to Terminal-API
2 parents d8f272a + 111f4d7 commit 6cbd8fc

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

META6.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"build-depends": [
77
],
88
"depends": [
9-
"Terminal::MakeRaw:ver<1.0.1+>",
9+
"Terminal::API:auth<zef:patrickb>:ver<1.0.0>",
1010
"Terminal::ANSIParser:auth<zef:japhb>:ver<0.0.3+>",
1111
"Terminal::Capabilities:auth<zef:japhb>:ver<0.0.1+>",
1212
"Text::MiscUtils:auth<zef:japhb>:ver<0.0.8+>"

lib/Terminal/LineEditor/RawTerminalInput.rakumod

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# ABSTRACT: Input widgets for raw terminal text input
22

3-
use Terminal::MakeRaw;
3+
use Terminal::API;
44
use Terminal::ANSIParser;
55
use Terminal::LineEditor::DuospaceInput;
66
use 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

Comments
 (0)