打开文件的bug。

This commit is contained in:
unlockable
2023-06-24 19:15:06 +08:00
parent 1c58758515
commit 39b3cec221
5 changed files with 16 additions and 13 deletions

View File

@@ -41,7 +41,7 @@ std::string Date::toString() const {
char buffer[20];
tm curTime;
#ifdef __APPLE__
#if defined __APPLE__ || defined __linux__
curTime = *(localtime(&this->time));
#endif

View File

@@ -263,7 +263,7 @@ void ListDisplay::promptForFromDate() {
time_t originTime = this->fromDate.getTime();
tm curDate;
#ifdef __APPLE__
#if defined __APPLE__ || defined __linux__
curDate = *(localtime(&originTime));
#endif
@@ -333,7 +333,7 @@ void ListDisplay::promptForToDate() {
tm curDate;
#ifdef __APPLE__
#if defined __APPLE__ || defined __linux__
curDate = *(localtime(&originTime));
#endif

View File

@@ -49,7 +49,7 @@ void BaseRecord::promptForNewDate(bool showOriginal) {
tm curDate;
#ifdef __APPLE__
#if defined __APPLE__ || defined __linux__
curDate = *(localtime(&originTime));
#endif

View File

@@ -262,12 +262,13 @@ void StudentInfoManager::closeFile() {
}
this->hasChangePendingSave = false;
}
Iterator<BaseRecord *> iter = this->recordPtrList.iterate();
while (iter) {
delete iter.next();
}
this->recordPtrList.clear();
}
this->displayer.reapplyFilter();
}
bool StudentInfoManager::cmdNew() {
@@ -353,7 +354,7 @@ bool StudentInfoManager::cmdNew() {
tm curDate;
#ifdef __APPLE__
#if defined __APPLE__ || defined __linux__
curDate = *(localtime(&curTime));
#endif
@@ -934,6 +935,8 @@ void StudentInfoManager::mainloop() {
else if (cmd == infoManagerCommand::home::closeFile) {
this->closeFile();
this->promptForFileName();
this->readFile();
this->displayer.reapplyFilter();
}
else if (cmd == infoManagerCommand::home::quit) {
this->closeFile();

View File

@@ -1,7 +1,7 @@
#include "Tools.hpp"
#include <string>
#ifdef __APPLE__
#if defined __APPLE__ || defined __linux__
#include <sys/ioctl.h>
#include <unistd.h>
#endif
@@ -133,7 +133,7 @@ const std::string setMiddle(const std::string str, const int targetLength,
return result;
}
#ifdef __APPLE__
#if defined __APPLE__ || defined __linux__
void clearScreen() {
system("clear");
}
@@ -166,7 +166,7 @@ void enableEchoBack() {
const termSize getConsoleSize() {
winsize size;
ioctl(STDOUT_FILENO, TIOCGWINSZ, &size);
return termSize{.height = size.ws_row, .width = size.ws_col};
return termSize{.width = size.ws_col, .height = size.ws_row};
}
#endif