Skip to content

Commit

Permalink
directvt#450 Fix interference with copy/move/del
Browse files Browse the repository at this point in the history
  • Loading branch information
o-sdn-o committed Oct 28, 2023
1 parent cb3bab4 commit 7bdc0d3
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions src/netxs/desktopio/consrv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -506,14 +506,16 @@ struct impl : consrv
text toANSI; // evnt: ANSI decoder buffer.
irec leader; // evnt: Hanging key event record (lead byte).
work ostask; // evnt: Console task thread for the child process.
bool ctrl_c; // evnt: Ctrl+C was pressed.
cast macros; // evnt: Doskey macros storage.
hist inputs; // evnt: Input history per process name storage.

evnt(impl& serv)
: server{ serv },
closed{ faux },
ondata{ true },
leader{ }
leader{ },
ctrl_c{ faux }
{ }

auto& ref_history(text& exe)
Expand Down Expand Up @@ -1081,11 +1083,13 @@ struct impl : consrv
}
else
{
if (server.inpmod & nt::console::inmode::preprocess)
if (gear.pressed)
{
if (gear.pressed) alert(nt::console::event::ctrl_c);
//todo revise
//stream.pop_back();
ctrl_c = true;
if (server.inpmod & nt::console::inmode::preprocess)
{
alert(nt::console::event::ctrl_c);
}
}
}
}
Expand All @@ -1108,7 +1112,9 @@ struct impl : consrv
{
static constexpr auto noalias = "<noalias>"sv;

if (nameview == noalias && server.inpmod & nt::console::inmode::echo)
auto terminate = ctrl_c && nameview == noalias && server.inpmod & nt::console::inmode::echo;
ctrl_c = faux; // Clear to avoid interference with copy/move/del commands.
if (terminate)
{
lock.unlock();
if constexpr (isreal())
Expand Down Expand Up @@ -1271,17 +1277,17 @@ struct impl : consrv
else if (c == '\t') { burn(); hist.save(line); line.insert(" ", mode); }
else if (c == 'C' - '@')
{
if (nameview == noalias)
if (terminate)
{
line = "y";
cook(c, 1);
}
else
{
hist.save(line);
cooked.ustr = "\n";
cooked.ustr = {};
done = true;
crlf = 2;
crlf = 1;
line.insert(cell{}.c0_to_txt(c), mode);
if (n == 0) pops++;
}
Expand Down

0 comments on commit 7bdc0d3

Please sign in to comment.