Compare commits
No commits in common. "4b16733d225a9a0d296f67f7c8047828378f92d7" and "366fd6473e1dd5b72f1d61dc89b27e818b4d6e27" have entirely different histories.
4b16733d22
...
366fd6473e
2 changed files with 8 additions and 25 deletions
31
ccc.c
31
ccc.c
|
@ -21,7 +21,6 @@
|
|||
#include "util.h"
|
||||
|
||||
/* functions' definitions */
|
||||
void handle_sigwinch();
|
||||
void cleanup();
|
||||
void show_help();
|
||||
int read_key();
|
||||
|
@ -109,16 +108,6 @@ int main(int argc, char **argv)
|
|||
if (!isatty(STDIN_FILENO))
|
||||
die("ccc: No tty detected. ccc requires an interactive shell to run.\n");
|
||||
|
||||
struct sigaction sa;
|
||||
sa.sa_handler = handle_sigwinch;
|
||||
sa.sa_flags = SA_RESTART;
|
||||
sigemptyset(&sa.sa_mask);
|
||||
|
||||
if (sigaction(SIGWINCH, &sa, NULL) == -1) {
|
||||
perror("sigaction");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* initialize screen, don't print special chars,
|
||||
* make ctrl + c work, don't show cursor
|
||||
* enable arrow keys */
|
||||
|
@ -142,8 +131,10 @@ int main(int argc, char **argv)
|
|||
getcwd(cwd, PATH_MAX);
|
||||
p_cwd = memalloc(PATH_MAX);
|
||||
p_cwd[0] = '\0';
|
||||
get_window_size(&rows, &cols);
|
||||
|
||||
half_width = cols / 2 + WINDOW_OFFSET;
|
||||
populate_files(cwd, 0, &files);
|
||||
handle_sigwinch();
|
||||
|
||||
if (to_open_file) {
|
||||
sel_file = arraylist_search(files, argv_cp, true);
|
||||
|
@ -153,7 +144,10 @@ int main(int argc, char **argv)
|
|||
int ch, ch2;
|
||||
int run = 1;
|
||||
while (run) {
|
||||
|
||||
if (cols < 80 || rows < 24) {
|
||||
cleanup();
|
||||
die("ccc: Terminal size needs to be at least 80x24");
|
||||
}
|
||||
ch = read_key();
|
||||
switch (ch) {
|
||||
/* quit */
|
||||
|
@ -412,17 +406,6 @@ int main(int argc, char **argv)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void handle_sigwinch()
|
||||
{
|
||||
get_window_size(&rows, &cols);
|
||||
if (cols < 80 || rows < 24) {
|
||||
cleanup();
|
||||
die("ccc: Terminal size needs to be at least 80x24");
|
||||
}
|
||||
half_width = cols / 2 + WINDOW_OFFSET;
|
||||
list_files();
|
||||
}
|
||||
|
||||
void cleanup()
|
||||
{
|
||||
if (argv_cp != NULL)
|
||||
|
|
2
config.h
2
config.h
|
@ -19,7 +19,7 @@ In COLS:
|
|||
0 will make them equal (at the center),
|
||||
15 will make files bigger
|
||||
-15 will make preview bigger */
|
||||
#define WINDOW_OFFSET -30
|
||||
#define WINDOW_OFFSET -65
|
||||
|
||||
/* Options */
|
||||
#define SHOW_HIDDEN true /* show hidden files/dotfiles at startup */
|
||||
|
|
Loading…
Reference in a new issue