Make requested console reports work

cf https://cygwin.com/ml/cygwin-patches/2012-q3/msg00019.html

This enables the following ESC sequences:
ESC[c sends primary device attributes
ESC[>c sends secondary device attributes
ESC[6n sends cursor position report

    * fhandler.h (class dev_console): Add console read-ahead buffer.
    (class fhandler_console): Add peek function for it (for select).
    * fhandler_console.cc (fhandler_console::setup): Init buffer.
    (fhandler_console::read): Check console read-aheader buffer.
    (fhandler_console::char_command): Put responses to terminal
    requests (device status and cursor position reports) into
    common console buffer (shared between CONOUT/CONIN)
    instead of fhandler buffer (separated).
    * select.cc (peek_console): Check console read-ahead buffer.
This commit is contained in:
Thomas Wolff
2016-03-16 10:25:16 +01:00
committed by Corinna Vinschen
parent e8e379ff1d
commit 734656818a
3 changed files with 30 additions and 4 deletions

View File

@ -1352,6 +1352,8 @@ class dev_console
bool ext_mouse_mode15;
bool use_focus;
bool raw_win32_keyboard_mode;
char cons_rabuf[40]; // cannot get longer than char buf[40] in char_command
char *cons_rapoi;
inline UINT get_console_cp ();
DWORD con_to_str (char *d, int dlen, WCHAR w);
@ -1449,6 +1451,10 @@ private:
int init (HANDLE, DWORD, mode_t);
bool mouse_aware (MOUSE_EVENT_RECORD& mouse_event);
bool focus_aware () {return shared_console_info->con.use_focus;}
bool get_cons_readahead_valid ()
{
return shared_console_info->con.cons_rapoi != NULL;
}
select_record *select_read (select_stuff *);
select_record *select_write (select_stuff *);