Skip to content
Snippets Groups Projects
Commit bcdf5546 authored by deuce's avatar deuce
Browse files

Only save window state if SyncTERM exits while in the startup mode...

If you change the current mode before exiting, your window size will not be
saves.

Also, fix crash in search when there's a blank option at the end.
parent 5fe94ce4
Branches
Tags
No related merge requests found
......@@ -1731,33 +1731,37 @@ int main(int argc, char **argv)
if (last_bbs)
free(last_bbs);
// Save changed settings
ww = wh = sf = -1;
get_window_info(&ww, &wh, NULL, NULL);
sf = getscaling();
if((sf > 0 && sf != settings.scaling_factor) ||
(ww > 0 && ww != settings.window_width) ||
(wh > 0 && wh != settings.window_height)) {
char inipath[MAX_PATH+1];
FILE *inifile;
str_list_t inicontents;
get_syncterm_filename(inipath, sizeof(inipath), SYNCTERM_PATH_INI, FALSE);
if((inifile=fopen(inipath,"r"))!=NULL) {
inicontents=iniReadFile(inifile);
fclose(inifile);
}
else {
inicontents=strListInit();
}
if (sf > 0 && sf != settings.scaling_factor)
iniSetInteger(&inicontents,"SyncTERM","ScalingFactor",sf,&ini_style);
if (ww > 0 && ww != settings.window_width)
iniSetInteger(&inicontents,"SyncTERM","WindowWidth",ww,&ini_style);
if (wh > 0 && wh != settings.window_height)
iniSetInteger(&inicontents,"SyncTERM","WindowHeight",wh,&ini_style);
if((inifile=fopen(inipath,"w"))!=NULL) {
iniWriteFile(inifile,inicontents);
fclose(inifile);
gettextinfo(&txtinfo);
// Only save window info if we're in the startup mode...
if (txtinfo.currmode == settings.startup_mode || (settings.startup_mode == SCREEN_MODE_CURRENT && txtinfo.currmode == C80)) {
ww = wh = sf = -1;
get_window_info(&ww, &wh, NULL, NULL);
sf = getscaling();
if((sf > 0 && sf != settings.scaling_factor) ||
(ww > 0 && ww != settings.window_width) ||
(wh > 0 && wh != settings.window_height)) {
char inipath[MAX_PATH+1];
FILE *inifile;
str_list_t inicontents;
get_syncterm_filename(inipath, sizeof(inipath), SYNCTERM_PATH_INI, FALSE);
if((inifile=fopen(inipath,"r"))!=NULL) {
inicontents=iniReadFile(inifile);
fclose(inifile);
}
else {
inicontents=strListInit();
}
if (sf > 0 && sf != settings.scaling_factor)
iniSetInteger(&inicontents,"SyncTERM","ScalingFactor",sf,&ini_style);
if (ww > 0 && ww != settings.window_width)
iniSetInteger(&inicontents,"SyncTERM","WindowWidth",ww,&ini_style);
if (wh > 0 && wh != settings.window_height)
iniSetInteger(&inicontents,"SyncTERM","WindowHeight",wh,&ini_style);
if((inifile=fopen(inipath,"w"))!=NULL) {
iniWriteFile(inifile,inicontents);
fclose(inifile);
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment