Moved minimum screen size handling to main.c
And with that, finally managed to get rid of sflags in ncdu.h
Этот коммит содержится в:
родитель
b24c3dee40
Коммит
ca11083385
12
src/main.c
12
src/main.c
@ -35,9 +35,10 @@
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
int sflags;
|
||||
int pstate;
|
||||
|
||||
int min_rows = 17,
|
||||
min_cols = 60;
|
||||
|
||||
void screen_draw() {
|
||||
int n = 1;
|
||||
@ -57,8 +58,8 @@ int input_handle(int wait) {
|
||||
screen_draw();
|
||||
while((ch = getch()) != ERR) {
|
||||
if(ch == KEY_RESIZE) {
|
||||
if(ncresize((sflags & SF_IGNS ? 0 : 17), (sflags * SF_IGNS ? 0 : 60)))
|
||||
sflags |= SF_IGNS;
|
||||
if(ncresize(min_rows, min_cols))
|
||||
min_rows = min_cols = 0;
|
||||
screen_draw();
|
||||
continue;
|
||||
}
|
||||
@ -79,7 +80,6 @@ void argv_parse(int argc, char **argv, char *dir) {
|
||||
/* load defaults */
|
||||
memset(dir, 0, PATH_MAX);
|
||||
getcwd(dir, PATH_MAX);
|
||||
sflags = 0;
|
||||
calc_delay = 100;
|
||||
calc_smfs = 0;
|
||||
|
||||
@ -150,8 +150,8 @@ int main(int argc, char **argv) {
|
||||
noecho();
|
||||
curs_set(0);
|
||||
keypad(stdscr, TRUE);
|
||||
if(ncresize((sflags & SF_IGNS ? 0 : 17), (sflags * SF_IGNS ? 0 : 60)))
|
||||
sflags |= SF_IGNS;
|
||||
if(ncresize(min_rows, min_cols))
|
||||
min_rows = min_cols = 0;
|
||||
|
||||
while(pstate != ST_QUIT) {
|
||||
if(pstate == ST_CALC)
|
||||
|
@ -58,11 +58,6 @@
|
||||
#define FF_SERR 0x20 /* error in subdirectory */
|
||||
#define FF_BSEL 0x40 /* selected */
|
||||
|
||||
/* Settings Flags (int sflags) */
|
||||
#define SF_IGNS 0x04 /* ignore too small terminal sizes */
|
||||
#define SF_NOCFM 0x08 /* don't confirm file deletion */
|
||||
#define SF_IGNE 0x10 /* ignore errors when deleting */
|
||||
|
||||
/* Program states */
|
||||
#define ST_CALC 0
|
||||
#define ST_BROWSE 1
|
||||
@ -80,9 +75,6 @@ struct dir {
|
||||
unsigned char flags;
|
||||
};
|
||||
|
||||
/* global settings */
|
||||
extern int sflags;
|
||||
|
||||
/* program state */
|
||||
extern int pstate;
|
||||
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user