Merge pull request #25120 from taosdata/fix/TD-28554-3.0

windows can not del after press tab
This commit is contained in:
Alex Duan 2024-03-19 09:12:31 +08:00 committed by GitHub
commit 761066ec73
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 10 additions and 5 deletions

View File

@ -1866,6 +1866,9 @@ _return:
// main key press tab // main key press tab
void pressTabKey(SShellCmd* cmd) { void pressTabKey(SShellCmd* cmd) {
#ifdef WINDOWS
return ;
#endif
// check empty tab key // check empty tab key
if (cmd->commandSize == 0) { if (cmd->commandSize == 0) {
// have multi line tab key // have multi line tab key
@ -1909,6 +1912,10 @@ void pressTabKey(SShellCmd* cmd) {
// press othr key // press othr key
void pressOtherKey(char c) { void pressOtherKey(char c) {
#ifdef WINDOWS
return ;
#endif
// reset global variant // reset global variant
firstMatchIndex = -1; firstMatchIndex = -1;
lastMatchIndex = -1; lastMatchIndex = -1;

View File

@ -445,7 +445,7 @@ char taosGetConsoleChar() {
static char mbStr[5]; static char mbStr[5];
static unsigned long bufLen = 0; static unsigned long bufLen = 0;
static uint16_t bufIndex = 0, mbStrIndex = 0, mbStrLen = 0; static uint16_t bufIndex = 0, mbStrIndex = 0, mbStrLen = 0;
CONSOLE_READCONSOLE_CONTROL inputControl={ sizeof(CONSOLE_READCONSOLE_CONTROL), 0, 1<<TAB_KEY, 0 }; CONSOLE_READCONSOLE_CONTROL inputControl={ sizeof(CONSOLE_READCONSOLE_CONTROL), 0, 0, 0 };
while (bufLen == 0) { while (bufLen == 0) {
ReadConsoleW(console, buf, SHELL_INPUT_MAX_COMMAND_SIZE, &bufLen, &inputControl); ReadConsoleW(console, buf, SHELL_INPUT_MAX_COMMAND_SIZE, &bufLen, &inputControl);
if (bufLen > 0 && buf[0] == 0) bufLen = 0; if (bufLen > 0 && buf[0] == 0) bufLen = 0;
@ -500,13 +500,11 @@ int32_t shellReadCommand(char *command) {
} }
shellInsertChar(&cmd, utf8_array, count); shellInsertChar(&cmd, utf8_array, count);
pressOtherKey(c); pressOtherKey(c);
#ifndef WINDOWS
} else if (c == TAB_KEY) { } else if (c == TAB_KEY) {
// press TAB key // press TAB key
pressTabKey(&cmd); pressTabKey(&cmd);
#endif
} else if (c < '\033') { } else if (c < '\033') {
pressOtherKey(c); pressOtherKey(c);
// Ctrl keys. TODO: Implement ctrl combinations // Ctrl keys. TODO: Implement ctrl combinations
switch (c) { switch (c) {
case 0: case 0:

View File

@ -77,7 +77,7 @@ int shell_conn_ws_server(bool first) {
} }
fprintf(stdout, "successfully connected to %s\n", host); fprintf(stdout, "successfully connected to %s\n", host);
} else { } else {
fprintf(stdout, "successfully connected to cloud service\n"); fprintf(stdout, "successfully connected to service\n");
} }
} }
fflush(stdout); fflush(stdout);