Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion META6.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"build-depends": [
],
"depends": [
"Terminal::MakeRaw:ver<1.0.1+>",
"Terminal::API:auth<zef:patrickb>:ver<1.0.0>",
"Terminal::ANSIParser:auth<zef:japhb>:ver<0.0.3+>",
"Terminal::Capabilities:auth<zef:japhb>:ver<0.0.1+>",
"Text::MiscUtils:auth<zef:japhb>:ver<0.0.8+>"
Expand Down
16 changes: 8 additions & 8 deletions lib/Terminal/LineEditor/RawTerminalInput.rakumod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ABSTRACT: Input widgets for raw terminal text input

use Terminal::MakeRaw;
use Terminal::API;
use Terminal::ANSIParser;
use Terminal::LineEditor::DuospaceInput;
use Terminal::LineEditor::History;
Expand Down Expand Up @@ -311,7 +311,7 @@ role Terminal::LineEditor::RawTerminalIO {
has atomicint $!done = 0;
has $!parse = make-ansi-parser(emit-item => { $!raw-supplier.emit($_) });
has MouseEventMode:D $!previous-mouse-mode = MouseNoEvents;
has $!saved-termios;
has $!saved-term-config;
has @!active-queries;

#| Atomically set done, even from outside role
Expand All @@ -325,10 +325,10 @@ role Terminal::LineEditor::RawTerminalIO {
# termios), then start the parser, save current TTY mode, flush
# previous I/O, and convert TTY to raw mode

if $.input.t && !$!saved-termios {
if $.input.t && !$!saved-term-config {
my $fd = $.input.native-descriptor;
$!saved-termios = Terminal::MakeRaw::getattr($fd);
Terminal::MakeRaw::makeraw($fd, :FLUSH);
$!saved-term-config = Terminal::API::get-config($fd);
Terminal::API::make-raw($fd, :when(Terminal::API::FLUSH));

$!done ⚛= 0;
self.start-parser;
Expand All @@ -341,11 +341,11 @@ role Terminal::LineEditor::RawTerminalIO {
# mark the saved termios as unused, and optionally output a \n to push
# the cursor to the start of the next line

if $!saved-termios {
if $!saved-term-config {
$!done ⚛= 1;
my $fd = $.input.native-descriptor;
Terminal::MakeRaw::setattr($fd, $!saved-termios, :DRAIN);
$!saved-termios = Nil;
Terminal::API::restore-config($!saved-term-config, $fd, :when(Terminal::API::DRAIN));
$!saved-term-config = Nil;
$.output.put('') if $nl;
}
}
Expand Down
Loading