From: Takashi Yano <takashi.yano@nifty.ne.jp>
To: cygwin-patches@cygwin.com
Subject: [PATCH 2/2] Cygwin: console: Add support for FLUSHO and Ctrl-O.
Date: Fri, 19 Feb 2021 17:44:02 +0900 [thread overview]
Message-ID: <20210219084402.1072-3-takashi.yano@nifty.ne.jp> (raw)
In-Reply-To: <20210219084402.1072-1-takashi.yano@nifty.ne.jp>
- With this patch, FLUSHO and Ctrl-O (VDISCARD) get working.
---
winsup/cygwin/fhandler_console.cc | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc
index ca8eb6400..6ded9eabf 100644
--- a/winsup/cygwin/fhandler_console.cc
+++ b/winsup/cygwin/fhandler_console.cc
@@ -259,6 +259,7 @@ fhandler_console::cons_master_thread (handle_set_t *p, tty *ttyp)
{
ttyp->kill_pgrp (sig);
ttyp->output_stopped = false;
+ ti.c_lflag &= ~FLUSHO;
/* Discard type ahead input */
goto skip_writeback;
}
@@ -286,6 +287,13 @@ fhandler_console::cons_master_thread (handle_set_t *p, tty *ttyp)
&& c && i >= output_stopped_at)
goto restart_output;
}
+ if ((ti.c_lflag & ICANON) && (ti.c_lflag & IEXTEN)
+ && CCEQ (ti.c_cc[VDISCARD], c))
+ {
+ if (input_rec[i].Event.KeyEvent.bKeyDown)
+ ti.c_lflag ^= FLUSHO;
+ processed = true;
+ }
break;
case WINDOW_BUFFER_SIZE_EVENT:
SHORT y = con.dwWinSize.Y;
@@ -3052,6 +3060,9 @@ fhandler_console::write (const void *vsrc, size_t len)
if (bg <= bg_eof)
return (ssize_t) bg;
+ if (get_ttyp ()->ti.c_lflag & FLUSHO)
+ return len; /* Discard write data */
+
if (get_ttyp ()->output_stopped && is_nonblocking ())
{
set_errno (EAGAIN);
--
2.30.0
next prev parent reply other threads:[~2021-02-19 8:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-19 8:44 [PATCH 0/2] Cygwin: pty, console: Make FLUSHO and Ctrl-O work Takashi Yano
2021-02-19 8:44 ` [PATCH 1/2] Cygwin: pty: " Takashi Yano
2021-02-19 8:44 ` Takashi Yano [this message]
2021-02-19 17:09 ` [PATCH 0/2] Cygwin: pty, console: " Corinna Vinschen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210219084402.1072-3-takashi.yano@nifty.ne.jp \
--to=takashi.yano@nifty.ne.jp \
--cc=cygwin-patches@cygwin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).