Fix problem with reporting cursor position
Turns out that sending duplicate characters would only send one (e.g. "11" would just be "1"). Sending the key up events fixed it.
This commit is contained in:
parent
2f3fe57b60
commit
43b3653c8a
30
ANSI.c
30
ANSI.c
@ -152,11 +152,12 @@
|
||||
remove wcstok, avoiding potential interference with the host;
|
||||
similarly, use a private heap instead of malloc.
|
||||
|
||||
v1.80, 26 to 30 October, 2017:
|
||||
v1.80, 26 October to 3 November, 2017:
|
||||
fix unloading;
|
||||
revert back to (re)storing buffer cursor position;
|
||||
increase cache to five handles;
|
||||
hook CreateFile & CreateConsoleScreenBuffer to enable readable handles.
|
||||
hook CreateFile & CreateConsoleScreenBuffer to enable readable handles;
|
||||
fix cursor report with duplicated digits (e.g. "11" was just "1").
|
||||
*/
|
||||
|
||||
#include "ansicon.h"
|
||||
@ -610,20 +611,25 @@ void PushBuffer( WCHAR c )
|
||||
void SendSequence( LPTSTR seq )
|
||||
{
|
||||
DWORD out;
|
||||
INPUT_RECORD in;
|
||||
PINPUT_RECORD in;
|
||||
DWORD len;
|
||||
HANDLE hStdIn = GetStdHandle( STD_INPUT_HANDLE );
|
||||
|
||||
in.EventType = KEY_EVENT;
|
||||
in.Event.KeyEvent.bKeyDown = TRUE;
|
||||
in.Event.KeyEvent.wRepeatCount = 1;
|
||||
in.Event.KeyEvent.wVirtualKeyCode = 0;
|
||||
in.Event.KeyEvent.wVirtualScanCode = 0;
|
||||
in.Event.KeyEvent.dwControlKeyState = 0;
|
||||
for (; *seq; ++seq)
|
||||
in = HeapAlloc( hHeap, HEAP_ZERO_MEMORY, 2 * wcslen( seq ) * sizeof(*in) );
|
||||
if (in == NULL)
|
||||
return;
|
||||
for (len = 0; *seq; len += 2, ++seq)
|
||||
{
|
||||
in.Event.KeyEvent.uChar.UnicodeChar = *seq;
|
||||
WriteConsoleInput( hStdIn, &in, 1, &out );
|
||||
in[len+0].EventType =
|
||||
in[len+1].EventType = KEY_EVENT;
|
||||
in[len+0].Event.KeyEvent.wRepeatCount =
|
||||
in[len+1].Event.KeyEvent.wRepeatCount = 1;
|
||||
in[len+0].Event.KeyEvent.uChar.UnicodeChar =
|
||||
in[len+1].Event.KeyEvent.uChar.UnicodeChar = *seq;
|
||||
in[len+0].Event.KeyEvent.bKeyDown = TRUE;
|
||||
}
|
||||
WriteConsoleInput( hStdIn, in, len, &out );
|
||||
HeapFree( hHeap, 0, in );
|
||||
}
|
||||
|
||||
// ========== Print functions
|
||||
|
@ -90,7 +90,7 @@
|
||||
write newline with _putws, not putwchar (fixes redirecting to CON).
|
||||
*/
|
||||
|
||||
#define PDATE L"30 October, 2017"
|
||||
#define PDATE L"3 November, 2017"
|
||||
|
||||
#include "ansicon.h"
|
||||
#include "version.h"
|
||||
|
@ -295,11 +295,12 @@ Version History
|
||||
|
||||
Legend: + added, - bug-fixed, * changed.
|
||||
|
||||
1.80 - 28 October, 2017:
|
||||
1.80 - 3 November, 2017:
|
||||
- fix unloading;
|
||||
- fix -e et al when redirecting to CON;
|
||||
- hook CreateFile and CreateConsoleScreenBuffer to force read/write access
|
||||
(fixes redirecting to CON and Microsoft's conio);
|
||||
- fix cursor report with duplicated digits (e.g. "11" was only writing "1");
|
||||
* go back to saving the buffer cursor position.
|
||||
|
||||
1.72 - 24 December, 2015:
|
||||
@ -505,6 +506,7 @@ Acknowledgments
|
||||
Leigh Hebblethwaite for documentation tweaks.
|
||||
|
||||
Vincent Fatica for pointing out \e[K was not right.
|
||||
Nat Kuhn for pointing out the problem with report cursor position.
|
||||
|
||||
|
||||
Contact
|
||||
@ -528,4 +530,4 @@ Distribution
|
||||
|
||||
|
||||
=============================
|
||||
Jason Hood, 30 October, 2017.
|
||||
Jason Hood, 3 November, 2017.
|
||||
|
Loading…
x
Reference in New Issue
Block a user