|
30 | 30 |
|
31 | 31 | #define floop while(1)
|
32 | 32 |
|
33 |
| -#define GT_VAR_STR "13.2" |
| 33 | +#define GT_VAR_STR "13.3" |
34 | 34 |
|
35 | 35 | using namespace SSTP_link_n;
|
36 | 36 | using namespace std;
|
@@ -421,16 +421,22 @@ class ghost_terminal final: public simple_terminal {
|
421 | 421 | editting_command_t terminal_tab_press(const editting_command_t& command, size_t tab_num) override {
|
422 | 422 | if(!able_tab_press)
|
423 | 423 | return command;
|
| 424 | + static size_t last_old_insert_index = 0; |
| 425 | + if(!tab_num) |
| 426 | + last_old_insert_index = command.insert_index; |
424 | 427 | auto Result = linker.NOTYFY({{L"Event", L"ShioriEcho.TabPress"},
|
425 | 428 | {L"Reference0", command.command},
|
426 | 429 | {L"Reference1", to_wstring(command.insert_index)},
|
427 |
| - {L"Reference2", to_wstring(tab_num)}}); |
| 430 | + {L"Reference2", to_wstring(tab_num)}, |
| 431 | + {L"Reference3", to_wstring(last_old_insert_index)}}); |
428 | 432 |
|
429 | 433 | editting_command_t Result_command = command;
|
430 | 434 | if(Result.has(L"Command"))
|
431 | 435 | Result_command.command = Result[L"Command"];
|
432 | 436 | if(Result.has(L"InsertIndex"))
|
433 | 437 | Result_command.insert_index = stoull(Result[L"InsertIndex"]);
|
| 438 | + if(Result.has(L"OldInsertIndex")) |
| 439 | + last_old_insert_index = stoull(Result[L"OldInsertIndex"]); |
434 | 440 | return Result_command;
|
435 | 441 | }
|
436 | 442 | bool terminal_run(const wstring& command) override {
|
@@ -662,22 +668,17 @@ class ghost_terminal final: public simple_terminal {
|
662 | 668 | string wt_json;
|
663 | 669 | {
|
664 | 670 | HANDLE hFile = CreateFileW(wt_json_path.c_str(), GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
|
665 |
| - if(hFile == INVALID_HANDLE_VALUE) { |
666 |
| - err << SET_RED "Can't open file: " SET_CYAN << wt_json_path << RESET_COLOR << endline; |
667 |
| - exit(1); |
668 |
| - } |
669 |
| - DWORD dwFileSize = GetFileSize(hFile, nullptr); |
670 |
| - if(dwFileSize == INVALID_FILE_SIZE) { |
671 |
| - err << SET_RED "Can't get file size: " SET_CYAN << wt_json_path << RESET_COLOR << endline; |
672 |
| - exit(1); |
673 |
| - } |
674 |
| - wt_json.resize(dwFileSize); |
675 |
| - DWORD dwRead; |
676 |
| - if(!ReadFile(hFile, wt_json.data(), dwFileSize, &dwRead, nullptr)) { |
677 |
| - err << SET_RED "Can't read file: " SET_CYAN << wt_json_path << RESET_COLOR << endline; |
678 |
| - exit(1); |
| 671 | + if(hFile != INVALID_HANDLE_VALUE) { |
| 672 | + const DWORD dwFileSize = GetFileSize(hFile, nullptr); |
| 673 | + if(dwFileSize != INVALID_FILE_SIZE) { |
| 674 | + wt_json.resize(dwFileSize); |
| 675 | + DWORD dwRead; |
| 676 | + if(!ReadFile(hFile, wt_json.data(), dwFileSize, &dwRead, nullptr)) { |
| 677 | + err << SET_RED "Can't read file: " SET_CYAN << wt_json_path << SET_RED ", overwriting it." RESET_COLOR << endline; |
| 678 | + } |
| 679 | + } |
| 680 | + CloseHandle(hFile); |
679 | 681 | }
|
680 |
| - CloseHandle(hFile); |
681 | 682 | }
|
682 | 683 | {
|
683 | 684 | wstring start_command;
|
|
0 commit comments