FS-4694 --resolve
This commit is contained in:
parent
7c644a271e
commit
c51aebf621
|
@ -39,6 +39,7 @@
|
||||||
#define KEY_RIGHT 7
|
#define KEY_RIGHT 7
|
||||||
#define KEY_INSERT 8
|
#define KEY_INSERT 8
|
||||||
#define PROMPT_OP 9
|
#define PROMPT_OP 9
|
||||||
|
#define KEY_DELETE 10
|
||||||
static int console_bufferInput (char *buf, int len, char *cmd, int key);
|
static int console_bufferInput (char *buf, int len, char *cmd, int key);
|
||||||
static unsigned char esl_console_complete(const char *buffer, const char *cursor, const char *lastchar);
|
static unsigned char esl_console_complete(const char *buffer, const char *cursor, const char *lastchar);
|
||||||
#endif
|
#endif
|
||||||
|
@ -318,6 +319,22 @@ static int console_bufferInput (char *addchars, int len, char *cmd, int key)
|
||||||
if (key == KEY_INSERT) {
|
if (key == KEY_INSERT) {
|
||||||
insertMode = !insertMode;
|
insertMode = !insertMode;
|
||||||
}
|
}
|
||||||
|
if (key == KEY_DELETE) {
|
||||||
|
if (iCmdCursor < iCmdBuffer) {
|
||||||
|
int pos;
|
||||||
|
for (pos = iCmdCursor; pos < iCmdBuffer; pos++) {
|
||||||
|
cmd[pos] = cmd[pos + 1];
|
||||||
|
}
|
||||||
|
cmd[pos] = 0;
|
||||||
|
iCmdBuffer--;
|
||||||
|
|
||||||
|
for (pos = iCmdCursor; pos < iCmdBuffer; pos++) {
|
||||||
|
printf("%c", cmd[pos]);
|
||||||
|
}
|
||||||
|
printf(" ");
|
||||||
|
SetConsoleCursorPosition(hOut, position);
|
||||||
|
}
|
||||||
|
}
|
||||||
for (iBuf = 0; iBuf < len; iBuf++) {
|
for (iBuf = 0; iBuf < len; iBuf++) {
|
||||||
switch (addchars[iBuf]) {
|
switch (addchars[iBuf]) {
|
||||||
case '\r':
|
case '\r':
|
||||||
|
@ -510,6 +527,9 @@ static BOOL console_readConsole(HANDLE conIn, char *buf, int len, int *pRed, int
|
||||||
if (keyEvent.wVirtualKeyCode == 45 && keyEvent.wVirtualScanCode == 82) {
|
if (keyEvent.wVirtualKeyCode == 45 && keyEvent.wVirtualScanCode == 82) {
|
||||||
*key = KEY_INSERT;
|
*key = KEY_INSERT;
|
||||||
}
|
}
|
||||||
|
if (keyEvent.wVirtualKeyCode == 46 && keyEvent.wVirtualScanCode == 83) {
|
||||||
|
*key = KEY_DELETE;
|
||||||
|
}
|
||||||
while (keyEvent.wRepeatCount && keyEvent.uChar.AsciiChar) {
|
while (keyEvent.wRepeatCount && keyEvent.uChar.AsciiChar) {
|
||||||
buf[bufferIndex] = keyEvent.uChar.AsciiChar;
|
buf[bufferIndex] = keyEvent.uChar.AsciiChar;
|
||||||
if (buf[bufferIndex] == '\r') {
|
if (buf[bufferIndex] == '\r') {
|
||||||
|
|
|
@ -67,6 +67,7 @@ static char *hfile = NULL;
|
||||||
#define KEY_RIGHT 7
|
#define KEY_RIGHT 7
|
||||||
#define KEY_INSERT 8
|
#define KEY_INSERT 8
|
||||||
#define PROMPT_OP 9
|
#define PROMPT_OP 9
|
||||||
|
#define KEY_DELETE 10
|
||||||
|
|
||||||
static int console_bufferInput(char *buf, int len, char *cmd, int key);
|
static int console_bufferInput(char *buf, int len, char *cmd, int key);
|
||||||
#endif
|
#endif
|
||||||
|
@ -1285,6 +1286,22 @@ static int console_bufferInput(char *addchars, int len, char *cmd, int key)
|
||||||
if (key == KEY_INSERT) {
|
if (key == KEY_INSERT) {
|
||||||
insertMode = !insertMode;
|
insertMode = !insertMode;
|
||||||
}
|
}
|
||||||
|
if (key == KEY_DELETE) {
|
||||||
|
if (iCmdCursor < iCmdBuffer) {
|
||||||
|
int pos;
|
||||||
|
for (pos = iCmdCursor; pos < iCmdBuffer; pos++) {
|
||||||
|
cmd[pos] = cmd[pos + 1];
|
||||||
|
}
|
||||||
|
cmd[pos] = 0;
|
||||||
|
iCmdBuffer--;
|
||||||
|
|
||||||
|
for (pos = iCmdCursor; pos < iCmdBuffer; pos++) {
|
||||||
|
printf("%c", cmd[pos]);
|
||||||
|
}
|
||||||
|
printf(" ");
|
||||||
|
SetConsoleCursorPosition(hOut, position);
|
||||||
|
}
|
||||||
|
}
|
||||||
for (iBuf = 0; iBuf < len; iBuf++) {
|
for (iBuf = 0; iBuf < len; iBuf++) {
|
||||||
switch (addchars[iBuf]) {
|
switch (addchars[iBuf]) {
|
||||||
case '\r':
|
case '\r':
|
||||||
|
@ -1476,6 +1493,9 @@ static BOOL console_readConsole(HANDLE conIn, char *buf, int len, int *pRed, int
|
||||||
if (keyEvent.wVirtualKeyCode == 45 && keyEvent.wVirtualScanCode == 82) {
|
if (keyEvent.wVirtualKeyCode == 45 && keyEvent.wVirtualScanCode == 82) {
|
||||||
*key = KEY_INSERT;
|
*key = KEY_INSERT;
|
||||||
}
|
}
|
||||||
|
if (keyEvent.wVirtualKeyCode == 46 && keyEvent.wVirtualScanCode == 83) {
|
||||||
|
*key = KEY_DELETE;
|
||||||
|
}
|
||||||
while (keyEvent.wRepeatCount && keyEvent.uChar.AsciiChar) {
|
while (keyEvent.wRepeatCount && keyEvent.uChar.AsciiChar) {
|
||||||
buf[bufferIndex] = keyEvent.uChar.AsciiChar;
|
buf[bufferIndex] = keyEvent.uChar.AsciiChar;
|
||||||
if (buf[bufferIndex] == '\r') {
|
if (buf[bufferIndex] == '\r') {
|
||||||
|
|
Loading…
Reference in New Issue