2 * line edition function for Win32 console
4 * Copyright 2001 Eric Pouech
13 #include "wine/unicode.h"
15 #include "debugtools.h"
17 DEFAULT_DEBUG_CHANNEL(console
);
20 extern int CONSOLE_GetHistory(int idx
, WCHAR
* buf
, int buf_len
);
21 extern BOOL
CONSOLE_AppendHistory(const WCHAR
*p
);
22 extern unsigned int CONSOLE_GetNumHistoryEntries(void);
28 WCHAR val
; /* vk or unicode char */
29 void (*func
)(struct WCEL_Context
* ctx
);
34 DWORD keyState
; /* keyState (from INPUT_RECORD) to match */
35 BOOL chkChar
; /* check vk or char */
36 KeyEntry
* entries
; /* array of entries */
39 typedef struct WCEL_Context
{
40 WCHAR
* line
; /* the line being edited */
41 size_t alloc
; /* number of WCHAR in line */
42 unsigned len
; /* number of chars in line */
43 unsigned ofs
; /* offset for cursor in current line */
44 WCHAR
* yanked
; /* yanked line */
45 unsigned mark
; /* marked point (emacs mode only) */
46 CONSOLE_SCREEN_BUFFER_INFO csbi
; /* current state (initial cursor, window size, attribute) */
49 unsigned done
: 1, /* to 1 when we're done with editing */
50 error
: 1; /* to 1 when an error occurred in the editing */
57 static void WCEL_Dump(WCEL_Context
* ctx
, const char* pfx
)
59 MESSAGE("%s: [line=%s[alloc=%u] ofs=%u len=%u start=(%d,%d) mask=%c%c\n"
60 "\t\thist=(size=%u pos=%u curr=%s)\n",
61 pfx
, debugstr_w(ctx
->line
), ctx
->alloc
, ctx
->ofs
, ctx
->len
,
62 ctx
->csbi
.dwCursorPosition
.X
, ctx
->csbi
.dwCursorPosition
.Y
,
63 ctx
->done
? 'D' : 'd', ctx
->error
? 'E' : 'e',
64 ctx
->histSize
, ctx
->histPos
, debugstr_w(ctx
->histCurr
));
68 /* ====================================================================
70 * Console helper functions
72 * ====================================================================*/
74 static BOOL
WCEL_Get(WCEL_Context
* ctx
, INPUT_RECORD
* ir
)
80 /* data available ? */
81 if (ReadConsoleInputW(ctx
->hConIn
, ir
, 1, &retv
) && retv
== 1)
84 switch (WaitForSingleObject(ctx
->hConIn
, INFINITE
))
89 /* we have checked that hConIn was a console handle (could be sb) */
90 ERR("Shouldn't happen\n");
95 ERR("hmm bad situation\n");
101 static inline void WCEL_Beep(WCEL_Context
* ctx
)
106 static inline COORD
WCEL_GetCoord(WCEL_Context
* ctx
, int ofs
)
109 c
.X
= ctx
->csbi
.dwCursorPosition
.X
+ ofs
;
110 c
.Y
= ctx
->csbi
.dwCursorPosition
.Y
;
114 static inline void WCEL_GetRect(WCEL_Context
* ctx
, LPSMALL_RECT sr
, int beg
, int end
)
116 sr
->Left
= ctx
->csbi
.dwCursorPosition
.X
+ beg
;
117 sr
->Top
= ctx
->csbi
.dwCursorPosition
.Y
;
118 sr
->Right
= ctx
->csbi
.dwCursorPosition
.X
+ end
;
119 sr
->Bottom
= ctx
->csbi
.dwCursorPosition
.Y
;
122 /* ====================================================================
124 * context manipulation functions
126 * ====================================================================*/
128 static BOOL
WCEL_Grow(WCEL_Context
* ctx
, size_t len
)
130 if (ctx
->csbi
.dwCursorPosition
.X
+ ctx
->ofs
+ len
>= ctx
->csbi
.dwSize
.X
)
132 FIXME("Current implementation doesn't allow edition to spray across several lines\n");
136 if (ctx
->len
+ len
>= ctx
->alloc
)
139 newline
= HeapReAlloc(GetProcessHeap(), 0, ctx
->line
, sizeof(WCHAR
) * (ctx
->alloc
+ 32));
140 if (!newline
) return FALSE
;
147 static void WCEL_DeleteString(WCEL_Context
* ctx
, int beg
, int end
)
153 memmove(&ctx
->line
[beg
], &ctx
->line
[end
], (ctx
->len
- end
) * sizeof(WCHAR
));
154 /* make the source rect bigger than the actual rect to that the part outside the clip
155 * rect (before the scroll) will get redrawn after the scroll
157 WCEL_GetRect(ctx
, &scl
, end
, ctx
->len
+ end
- beg
);
158 WCEL_GetRect(ctx
, &clp
, beg
, ctx
->len
);
160 ci
.Char
.UnicodeChar
= ' ';
161 ci
.Attributes
= ctx
->csbi
.wAttributes
;
162 ScrollConsoleScreenBufferW(ctx
->hConOut
, &scl
, &clp
, WCEL_GetCoord(ctx
, beg
), &ci
);
164 ctx
->len
-= end
- beg
;
165 ctx
->line
[ctx
->len
] = 0;
168 static void WCEL_InsertString(WCEL_Context
* ctx
, const WCHAR
* str
)
170 size_t len
= lstrlenW(str
);
172 if (!len
|| !WCEL_Grow(ctx
, len
)) return;
173 if (ctx
->len
> ctx
->ofs
)
174 memmove(&ctx
->line
[ctx
->ofs
+ len
], &ctx
->line
[ctx
->ofs
], (ctx
->len
- ctx
->ofs
) * sizeof(WCHAR
));
175 memcpy(&ctx
->line
[ctx
->ofs
], str
, len
* sizeof(WCHAR
));
177 ctx
->line
[ctx
->len
] = 0;
178 SetConsoleCursorPosition(ctx
->hConOut
, WCEL_GetCoord(ctx
, ctx
->ofs
));
179 WriteConsoleW(ctx
->hConOut
, &ctx
->line
[ctx
->ofs
], ctx
->len
- ctx
->ofs
, NULL
, NULL
);
183 static void WCEL_InsertChar(WCEL_Context
* ctx
, WCHAR c
)
187 /* do not insert 0..31 control characters */
190 if (c
!= '\t') return;
194 WCEL_InsertString(ctx
, buffer
);
197 static void WCEL_SaveYank(WCEL_Context
* ctx
, int beg
, int end
)
200 ctx
->yanked
= HeapReAlloc(GetProcessHeap(), 0, ctx
->yanked
, (len
+ 1) * sizeof(WCHAR
));
201 if (!ctx
->yanked
) return;
202 memcpy(ctx
->yanked
, &ctx
->line
[beg
], len
* sizeof(WCHAR
));
203 ctx
->yanked
[len
] = 0;
206 /* FIXME NTDLL doesn't export iswalnum, and I don't want to link in msvcrt when most
207 * of the data lay in unicode lib
209 static inline BOOL
WCEL_iswalnum(WCHAR wc
)
211 return get_char_typeW(wc
) & (C1_ALPHA
|C1_DIGIT
|C1_LOWER
|C1_UPPER
);
214 static int WCEL_GetLeftWordTransition(WCEL_Context
* ctx
, int ofs
)
217 while (ofs
>= 0 && !WCEL_iswalnum(ctx
->line
[ofs
])) ofs
--;
218 while (ofs
>= 0 && WCEL_iswalnum(ctx
->line
[ofs
])) ofs
--;
223 static int WCEL_GetRightWordTransition(WCEL_Context
* ctx
, int ofs
)
226 while (ofs
<= ctx
->len
&& !WCEL_iswalnum(ctx
->line
[ofs
])) ofs
++;
227 while (ofs
<= ctx
->len
&& WCEL_iswalnum(ctx
->line
[ofs
])) ofs
++;
228 return min(ofs
, ctx
->len
);
231 static WCHAR
* WCEL_GetHistory(WCEL_Context
* ctx
, int idx
)
235 if (idx
== ctx
->histSize
- 1)
237 ptr
= HeapAlloc(GetProcessHeap(), 0, (lstrlenW(ctx
->histCurr
) + 1) * sizeof(WCHAR
));
238 lstrcpyW(ptr
, ctx
->histCurr
);
242 int len
= CONSOLE_GetHistory(idx
, NULL
, 0);
244 if ((ptr
= HeapAlloc(GetProcessHeap(), 0, len
* sizeof(WCHAR
))))
246 CONSOLE_GetHistory(idx
, ptr
, len
);
252 static void WCEL_HistoryInit(WCEL_Context
* ctx
)
254 ctx
->histPos
= CONSOLE_GetNumHistoryEntries();
255 ctx
->histSize
= ctx
->histPos
+ 1;
256 ctx
->histCurr
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(WCHAR
));
259 static void WCEL_MoveToHist(WCEL_Context
* ctx
, int idx
)
261 WCHAR
* data
= WCEL_GetHistory(ctx
, idx
);
262 int len
= lstrlenW(data
) + 1;
264 /* save current line edition for recall when needed (FIXME seems broken to me) */
265 if (ctx
->histPos
== ctx
->histSize
- 1)
267 if (ctx
->histCurr
) HeapFree(GetProcessHeap(), 0, ctx
->histCurr
);
268 ctx
->histCurr
= HeapAlloc(GetProcessHeap(), 0, (ctx
->len
+ 1) * sizeof(WCHAR
));
269 memcpy(ctx
->histCurr
, ctx
->line
, (ctx
->len
+ 1) * sizeof(WCHAR
));
271 /* need to clean also the screen if new string is shorter than old one */
272 WCEL_DeleteString(ctx
, 0, ctx
->len
);
274 /* insert new string */
275 if (WCEL_Grow(ctx
, len
))
277 WCEL_InsertString(ctx
, data
);
278 HeapFree(GetProcessHeap(), 0, data
);
283 /* ====================================================================
285 * basic edition functions
287 * ====================================================================*/
289 static void WCEL_Done(WCEL_Context
* ctx
)
291 if (!WCEL_Grow(ctx
, 1)) return;
292 ctx
->line
[ctx
->len
++] = '\n';
293 ctx
->line
[ctx
->len
] = 0;
294 WriteConsoleA(ctx
->hConOut
, "\n", 1, NULL
, NULL
);
298 static void WCEL_MoveLeft(WCEL_Context
* ctx
)
300 if (ctx
->ofs
> 0) ctx
->ofs
--;
303 static void WCEL_MoveRight(WCEL_Context
* ctx
)
305 if (ctx
->ofs
< ctx
->len
) ctx
->ofs
++;
308 static void WCEL_MoveToLeftWord(WCEL_Context
* ctx
)
310 int new_ofs
= WCEL_GetLeftWordTransition(ctx
, ctx
->ofs
);
311 if (new_ofs
!= ctx
->ofs
) ctx
->ofs
= new_ofs
;
314 static void WCEL_MoveToRightWord(WCEL_Context
* ctx
)
316 int new_ofs
= WCEL_GetRightWordTransition(ctx
, ctx
->ofs
);
317 if (new_ofs
!= ctx
->ofs
) ctx
->ofs
= new_ofs
;
320 static void WCEL_MoveToBeg(WCEL_Context
* ctx
)
325 static void WCEL_MoveToEnd(WCEL_Context
* ctx
)
330 static void WCEL_SetMark(WCEL_Context
* ctx
)
332 ctx
->mark
= ctx
->ofs
;
335 static void WCEL_ExchangeMark(WCEL_Context
* ctx
)
339 if (ctx
->mark
> ctx
->len
) return;
341 ctx
->ofs
= ctx
->mark
;
345 static void WCEL_CopyMarkedZone(WCEL_Context
* ctx
)
349 if (ctx
->mark
> ctx
->len
|| ctx
->mark
== ctx
->ofs
) return;
350 if (ctx
->mark
> ctx
->ofs
)
352 beg
= ctx
->ofs
; end
= ctx
->mark
;
356 beg
= ctx
->mark
; end
= ctx
->ofs
;
358 WCEL_SaveYank(ctx
, beg
, end
);
361 static void WCEL_TransposeChar(WCEL_Context
* ctx
)
365 if (!ctx
->ofs
|| ctx
->ofs
== ctx
->len
) return;
367 c
= ctx
->line
[ctx
->ofs
];
368 ctx
->line
[ctx
->ofs
] = ctx
->line
[ctx
->ofs
- 1];
369 ctx
->line
[ctx
->ofs
- 1] = c
;
371 WriteConsoleOutputCharacterW(ctx
->hConOut
, &ctx
->line
[ctx
->ofs
- 1], 2, WCEL_GetCoord(ctx
, ctx
->ofs
- 1), NULL
);
375 static void WCEL_TransposeWords(WCEL_Context
* ctx
)
380 static void WCEL_LowerCaseWord(WCEL_Context
* ctx
)
382 int new_ofs
= WCEL_GetRightWordTransition(ctx
, ctx
->ofs
);
383 if (new_ofs
!= ctx
->ofs
)
386 for (i
= ctx
->ofs
; i
<= new_ofs
; i
++)
387 ctx
->line
[i
] = tolowerW(ctx
->line
[i
]);
388 WriteConsoleOutputCharacterW(ctx
->hConOut
, &ctx
->line
[ctx
->ofs
], new_ofs
- ctx
->ofs
+ 1,
389 WCEL_GetCoord(ctx
, ctx
->ofs
), NULL
);
394 static void WCEL_UpperCaseWord(WCEL_Context
* ctx
)
396 int new_ofs
= WCEL_GetRightWordTransition(ctx
, ctx
->ofs
);
397 if (new_ofs
!= ctx
->ofs
)
400 for (i
= ctx
->ofs
; i
<= new_ofs
; i
++)
401 ctx
->line
[i
] = toupperW(ctx
->line
[i
]);
402 WriteConsoleOutputCharacterW(ctx
->hConOut
, &ctx
->line
[ctx
->ofs
], new_ofs
- ctx
->ofs
+ 1,
403 WCEL_GetCoord(ctx
, ctx
->ofs
), NULL
);
408 static void WCEL_CapitalizeWord(WCEL_Context
* ctx
)
410 int new_ofs
= WCEL_GetRightWordTransition(ctx
, ctx
->ofs
);
411 if (new_ofs
!= ctx
->ofs
)
415 ctx
->line
[ctx
->ofs
] = toupperW(ctx
->line
[ctx
->ofs
]);
416 for (i
= ctx
->ofs
+ 1; i
<= new_ofs
; i
++)
417 ctx
->line
[i
] = tolowerW(ctx
->line
[i
]);
418 WriteConsoleOutputCharacterW(ctx
->hConOut
, &ctx
->line
[ctx
->ofs
], new_ofs
- ctx
->ofs
+ 1,
419 WCEL_GetCoord(ctx
, ctx
->ofs
), NULL
);
424 static void WCEL_Yank(WCEL_Context
* ctx
)
426 WCEL_InsertString(ctx
, ctx
->yanked
);
427 HeapFree(GetProcessHeap(), 0, ctx
->yanked
);
431 static void WCEL_KillToEndOfLine(WCEL_Context
* ctx
)
433 WCEL_SaveYank(ctx
, ctx
->ofs
, ctx
->len
);
434 WCEL_DeleteString(ctx
, ctx
->ofs
, ctx
->len
);
437 static void WCEL_KillMarkedZone(WCEL_Context
* ctx
)
441 if (ctx
->mark
> ctx
->len
|| ctx
->mark
== ctx
->ofs
) return;
442 if (ctx
->mark
> ctx
->ofs
)
444 beg
= ctx
->ofs
; end
= ctx
->mark
;
448 beg
= ctx
->mark
; end
= ctx
->ofs
;
450 WCEL_SaveYank(ctx
, beg
, end
);
451 WCEL_DeleteString(ctx
, beg
, end
);
455 static void WCEL_DeletePrevChar(WCEL_Context
* ctx
)
459 WCEL_DeleteString(ctx
, ctx
->ofs
- 1, ctx
->ofs
);
464 static void WCEL_DeleteCurrChar(WCEL_Context
* ctx
)
466 if (ctx
->ofs
< ctx
->len
)
467 WCEL_DeleteString(ctx
, ctx
->ofs
, ctx
->ofs
+ 1);
470 static void WCEL_DeleteLeftWord(WCEL_Context
* ctx
)
472 int new_ofs
= WCEL_GetLeftWordTransition(ctx
, ctx
->ofs
);
473 if (new_ofs
!= ctx
->ofs
)
475 WCEL_DeleteString(ctx
, new_ofs
, ctx
->ofs
);
480 static void WCEL_DeleteRightWord(WCEL_Context
* ctx
)
482 int new_ofs
= WCEL_GetRightWordTransition(ctx
, ctx
->ofs
);
483 if (new_ofs
!= ctx
->ofs
)
485 WCEL_DeleteString(ctx
, ctx
->ofs
, new_ofs
);
489 static void WCEL_MoveToPrevHist(WCEL_Context
* ctx
)
491 if (ctx
->histPos
) WCEL_MoveToHist(ctx
, ctx
->histPos
- 1);
494 static void WCEL_MoveToNextHist(WCEL_Context
* ctx
)
496 if (ctx
->histPos
< ctx
->histSize
- 1) WCEL_MoveToHist(ctx
, ctx
->histPos
+ 1);
499 static void WCEL_MoveToFirstHist(WCEL_Context
* ctx
)
501 if (ctx
->histPos
!= 0) WCEL_MoveToHist(ctx
, 0);
504 static void WCEL_MoveToLastHist(WCEL_Context
* ctx
)
506 if (ctx
->histPos
!= ctx
->histSize
- 1) WCEL_MoveToHist(ctx
, ctx
->histSize
- 1);
509 /* ====================================================================
513 * ====================================================================*/
515 #define CTRL(x) ((x) - '@')
516 static KeyEntry StdKeyMap
[] =
518 {/*BACK*/0x08, WCEL_DeletePrevChar
},
519 {/*RETURN*/0x0d, WCEL_Done
},
520 {/*DEL*/127, WCEL_DeleteCurrChar
},
524 static KeyEntry EmacsKeyMapCtrl
[] =
526 { CTRL('@'), WCEL_SetMark
},
527 { CTRL('A'), WCEL_MoveToBeg
},
528 { CTRL('B'), WCEL_MoveLeft
},
530 { CTRL('D'), WCEL_DeleteCurrChar
},
531 { CTRL('E'), WCEL_MoveToEnd
},
532 { CTRL('F'), WCEL_MoveRight
},
533 { CTRL('G'), WCEL_Beep
},
534 { CTRL('H'), WCEL_DeletePrevChar
},
535 /* I: meaningless (or tab ???) */
536 { CTRL('J'), WCEL_Done
},
537 { CTRL('K'), WCEL_KillToEndOfLine
},
538 /* L: [NIY] redraw the whole stuff */
539 { CTRL('M'), WCEL_Done
},
540 { CTRL('N'), WCEL_MoveToNextHist
},
541 /* O; insert line... meaningless */
542 { CTRL('P'), WCEL_MoveToPrevHist
},
543 /* Q: [NIY] quoting... */
544 /* R: [NIY] search backwards... */
545 /* S: [NIY] search forwards... */
546 { CTRL('T'), WCEL_TransposeChar
},
547 /* U: [NIY] set repeat count... */
548 /* V: paragraph down... meaningless */
549 { CTRL('W'), WCEL_KillMarkedZone
},
550 { CTRL('X'), WCEL_ExchangeMark
},
551 { CTRL('Y'), WCEL_Yank
},
556 static KeyEntry EmacsKeyMapAlt
[] =
558 {/*DEL*/127, WCEL_DeleteLeftWord
},
559 { '<', WCEL_MoveToFirstHist
},
560 { '>', WCEL_MoveToLastHist
},
562 { 'b', WCEL_MoveToLeftWord
},
563 { 'c', WCEL_CapitalizeWord
},
564 { 'd', WCEL_DeleteRightWord
},
565 { 'f', WCEL_MoveToRightWord
},
566 { 'l', WCEL_LowerCaseWord
},
567 { 't', WCEL_TransposeWords
},
568 { 'u', WCEL_UpperCaseWord
},
569 { 'w', WCEL_CopyMarkedZone
},
573 static KeyEntry EmacsKeyMapExtended
[] =
575 {/*VK_PRIOR*/0x21, WCEL_MoveToPrevHist
},
576 {/*VK_NEXT*/0x22, WCEL_MoveToNextHist
},
577 {/*VK_RIGHT*/0x27, WCEL_MoveRight
},
578 {/*VK_LEFT*/0x25, WCEL_MoveLeft
},
582 static KeyMap EmacsKeyMap
[] =
584 {0x00000000, 1, StdKeyMap
},
585 {0x00000001, 1, EmacsKeyMapAlt
}, /* left alt */
586 {0x00000002, 1, EmacsKeyMapAlt
}, /* right alt */
587 {0x00000004, 1, EmacsKeyMapCtrl
}, /* left ctrl */
588 {0x00000008, 1, EmacsKeyMapCtrl
}, /* right ctrl */
589 {0x00000100, 0, EmacsKeyMapExtended
},
593 static KeyEntry Win32KeyMapExtended
[] =
595 {/*VK_LEFT*/ 0x25, WCEL_MoveLeft
},
596 {/*VK_RIGHT*/0x27, WCEL_MoveRight
},
597 {/*VK_HOME*/ 0x24, WCEL_MoveToBeg
},
598 {/*VK_END*/ 0x23, WCEL_MoveToEnd
},
599 {/*VK_UP*/ 0x26, WCEL_MoveToPrevHist
},
600 {/*VK_DOWN*/ 0x28, WCEL_MoveToNextHist
},
604 static KeyEntry Win32KeyMapCtrlExtended
[] =
606 {/*VK_LEFT*/ 0x25, WCEL_MoveToLeftWord
},
607 {/*VK_RIGHT*/0x27, WCEL_MoveToRightWord
},
611 KeyMap Win32KeyMap
[] =
613 {0x00000000, 1, StdKeyMap
},
614 {0x00000100, 0, Win32KeyMapExtended
},
615 {0x00000104, 0, Win32KeyMapCtrlExtended
},
616 {0x00000108, 0, Win32KeyMapCtrlExtended
},
621 /* ====================================================================
623 * Read line master function
625 * ====================================================================*/
627 WCHAR
* CONSOLE_Readline(HANDLE hConsoleIn
, int use_emacs
)
634 void (*func
)(struct WCEL_Context
* ctx
);
637 memset(&ctx
, 0, sizeof(ctx
));
638 ctx
.hConIn
= hConsoleIn
;
639 WCEL_HistoryInit(&ctx
);
640 if ((ctx
.hConOut
= CreateFileA("CONOUT$", GENERIC_READ
|GENERIC_WRITE
, 0, NULL
,
641 OPEN_EXISTING
, 0, 0 )) == INVALID_HANDLE_VALUE
||
642 !GetConsoleScreenBufferInfo(ctx
.hConOut
, &ctx
.csbi
))
644 if (!WCEL_Grow(&ctx
, 1))
646 CloseHandle(ctx
.hConOut
);
651 /* EPP WCEL_Dump(&ctx, "init"); */
653 while (!ctx
.done
&& !ctx
.error
&& WCEL_Get(&ctx
, &ir
))
655 if (ir
.EventType
!= KEY_EVENT
|| !ir
.Event
.KeyEvent
.bKeyDown
) continue;
656 TRACE("key%s repeatCount=%u, keyCode=%02x scanCode=%02x char=%02x keyState=%08lx\n",
657 ir
.Event
.KeyEvent
.bKeyDown
? "Down" : "Up ", ir
.Event
.KeyEvent
.wRepeatCount
,
658 ir
.Event
.KeyEvent
.wVirtualKeyCode
, ir
.Event
.KeyEvent
.wVirtualScanCode
,
659 ir
.Event
.KeyEvent
.uChar
.UnicodeChar
, ir
.Event
.KeyEvent
.dwControlKeyState
);
661 /* EPP WCEL_Dump(&ctx, "before func"); */
663 /* mask out some bits which don't interest us */
664 ks
= ir
.Event
.KeyEvent
.dwControlKeyState
& ~(NUMLOCK_ON
|SCROLLLOCK_ON
|CAPSLOCK_ON
);
667 for (km
= (use_emacs
) ? EmacsKeyMap
: Win32KeyMap
; km
->entries
!= NULL
; km
++)
669 if (km
->keyState
!= ks
)
673 for (ke
= &km
->entries
[0]; ke
->func
!= 0; ke
++)
674 if (ke
->val
== ir
.Event
.KeyEvent
.uChar
.UnicodeChar
) break;
678 for (ke
= &km
->entries
[0]; ke
->func
!= 0; ke
++)
679 if (ke
->val
== ir
.Event
.KeyEvent
.wVirtualKeyCode
) break;
691 else if (!(ir
.Event
.KeyEvent
.dwControlKeyState
& (ENHANCED_KEY
|LEFT_ALT_PRESSED
)))
692 WCEL_InsertChar(&ctx
, ir
.Event
.KeyEvent
.uChar
.UnicodeChar
);
693 else TRACE("Dropped event\n");
695 /* EPP WCEL_Dump(&ctx, "after func"); */
697 SetConsoleCursorPosition(ctx
.hConOut
, WCEL_GetCoord(&ctx
, ctx
.ofs
));
701 HeapFree(GetProcessHeap(), 0, ctx
.line
);
705 CONSOLE_AppendHistory(ctx
.line
);
707 CloseHandle(ctx
.hConOut
);
708 if (ctx
.histCurr
) HeapFree(GetProcessHeap(), 0, ctx
.histCurr
);