ls tty fix
This commit is contained in:
parent
7a1eef1229
commit
4403e7edc2
1 changed files with 4 additions and 2 deletions
|
@ -166,10 +166,13 @@ static char* get_file_color(struct FileInfo* info) {
|
|||
}
|
||||
|
||||
static void list_files(struct FileInfo* files, int file_len, struct FileListInfo info, struct Flags* flags, const char* dir_path) {
|
||||
|
||||
struct winsize w;
|
||||
ioctl(STDOUT_FILENO, TIOCGWINSZ, &w);
|
||||
|
||||
if (!isatty(1)) {
|
||||
flags->one_column = true;
|
||||
}
|
||||
|
||||
char* color;
|
||||
const int column_width = info.max_name + 1;
|
||||
const int row_count = w.ws_col / column_width;
|
||||
|
@ -371,7 +374,6 @@ COMMAND(ls) {
|
|||
flags.hide_dot = false;
|
||||
flags.one_column = false;
|
||||
flags.recurse = false;
|
||||
|
||||
int start = 0;
|
||||
for (int i = 0; i < argc; i++) {
|
||||
if (!prefix("-", argv[i])) break;
|
||||
|
|
Loading…
Reference in a new issue