Skip to content

Commit ace0881

Browse files
committed
v13.6
1 parent 54b3e13 commit ace0881

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

ghost_terminal.cpp

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
#define floop while(1)
3434

35-
#define GT_VAR_STR "13.5"
35+
#define GT_VAR_STR "13.6"
3636

3737
using namespace SSTP_link_n;
3838
using namespace std;
@@ -416,10 +416,11 @@ class ghost_terminal final: public simple_terminal {
416416
able_command_update = 0;
417417
able_command_complete = 0;
418418
able_command_history = 0;
419-
able_command_prompt = 0;
419+
able_command_prompt = 0;
420+
able_get_result = 0;
420421
err << SET_RED "Event " SET_GREEN "Has_Event" SET_RED " Not defined.\n"
421422
"You need to make your ghost support " SET_GREEN "Has_Event" SET_RED " event so that Terminal can know what events it supports.\n"
422-
"Terminal will assume your ghost only supports " SET_GREEN "ShioriEcho" SET_RED " and " SET_GREEN "ShioriEcho.GetResult" SET_RED " events." RESET_COLOR "\n\n";
423+
"Terminal will assume your ghost only supports " SET_GREEN "ShioriEcho" SET_RED " event." RESET_COLOR "\n\n";
423424
}
424425
}
425426

@@ -453,8 +454,17 @@ class ghost_terminal final: public simple_terminal {
453454
return Result_command;
454455
}
455456
std::wstring terminal_command_update(std::wstring command) {
456-
if(!able_command_update || _kbhit()) //考虑到sstp极慢的速度,只在需要时更新command的色彩
457+
if(!able_command_update)
457458
return command;
459+
{
460+
bool in_kbhit = _kbhit();
461+
if(in_kbhit) { //考虑到sstp极慢的速度,只在需要时更新command的色彩
462+
const auto next_ch = _getwch();
463+
_ungetwch(next_ch);
464+
if(next_ch != L'\n' && next_ch != L'\r')
465+
return command;
466+
}
467+
}
458468
auto Result = linker.NOTYFY({{L"Event", L"ShioriEcho.CommandUpdate"},
459469
{L"Reference0", command}});
460470
if(Result.has(L"CommandForDisplay"))
@@ -557,8 +567,11 @@ class ghost_terminal final: public simple_terminal {
557567
Sleep(1000);
558568
}
559569
if(Result.has(L"Status")) {
560-
if(Result[L"Status"] == L"End")
570+
const auto& status = Result[L"Status"];
571+
if(status == L"End")
561572
return false;
573+
else if(status == L"Continue")
574+
break;
562575
}
563576
}
564577
}

0 commit comments

Comments
 (0)