File TODO changed (mode: 100644) (index 7a8c1837b..1370220d0) |
... |
... |
Basic things that need to be done. |
5 |
5 |
Better documentation. |
Better documentation. |
6 |
6 |
Handle commands that are too long to be passed directly to the shell. |
Handle commands that are too long to be passed directly to the shell. |
7 |
7 |
Make ga work in background. |
Make ga work in background. |
|
8 |
|
Implement ga instead of using du command. |
8 |
9 |
Document options. |
Document options. |
9 |
10 |
Add menu for viewing command line history. |
Add menu for viewing command line history. |
10 |
11 |
Replace escape sequences in quick view output with ^foo. |
Replace escape sequences in quick view output with ^foo. |
File src/Makefile.in changed (mode: 100644) (index 8fcb8f2c3..f25b4b426) |
... |
... |
am_vifm_OBJECTS = background.$(OBJEXT) bookmarks.$(OBJEXT) \ |
60 |
60 |
options.$(OBJEXT) permissions_dialog.$(OBJEXT) \ |
options.$(OBJEXT) permissions_dialog.$(OBJEXT) \ |
61 |
61 |
registers.$(OBJEXT) search.$(OBJEXT) signals.$(OBJEXT) \ |
registers.$(OBJEXT) search.$(OBJEXT) signals.$(OBJEXT) \ |
62 |
62 |
sort.$(OBJEXT) sort_dialog.$(OBJEXT) status.$(OBJEXT) \ |
sort.$(OBJEXT) sort_dialog.$(OBJEXT) status.$(OBJEXT) \ |
63 |
|
ui.$(OBJEXT) utils.$(OBJEXT) vifm.$(OBJEXT) visual.$(OBJEXT) |
|
|
63 |
|
tree.$(OBJEXT) ui.$(OBJEXT) utils.$(OBJEXT) vifm.$(OBJEXT) \ |
|
64 |
|
visual.$(OBJEXT) |
64 |
65 |
vifm_OBJECTS = $(am_vifm_OBJECTS) |
vifm_OBJECTS = $(am_vifm_OBJECTS) |
65 |
66 |
vifm_LDADD = $(LDADD) |
vifm_LDADD = $(LDADD) |
66 |
67 |
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; |
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; |
|
... |
... |
vifm_SOURCES = \ |
257 |
258 |
sort.c sort.h \ |
sort.c sort.h \ |
258 |
259 |
sort_dialog.c sort_dialog.h \ |
sort_dialog.c sort_dialog.h \ |
259 |
260 |
status.c status.h \ |
status.c status.h \ |
|
261 |
|
tree.c tree.h \ |
260 |
262 |
ui.c ui.h \ |
ui.c ui.h \ |
261 |
263 |
utils.c utils.h \ |
utils.c utils.h \ |
262 |
264 |
vifm.c \ |
vifm.c \ |
|
... |
... |
distclean-compile: |
411 |
413 |
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sort.Po@am__quote@ |
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sort.Po@am__quote@ |
412 |
414 |
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sort_dialog.Po@am__quote@ |
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sort_dialog.Po@am__quote@ |
413 |
415 |
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/status.Po@am__quote@ |
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/status.Po@am__quote@ |
|
416 |
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tree.Po@am__quote@ |
414 |
417 |
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ui.Po@am__quote@ |
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ui.Po@am__quote@ |
415 |
418 |
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utils.Po@am__quote@ |
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utils.Po@am__quote@ |
416 |
419 |
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vifm.Po@am__quote@ |
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vifm.Po@am__quote@ |
File src/filelist.c changed (mode: 100644) (index b7979b174..7dff16a89) |
46 |
46 |
#include "options.h" |
#include "options.h" |
47 |
47 |
#include "sort.h" |
#include "sort.h" |
48 |
48 |
#include "status.h" |
#include "status.h" |
|
49 |
|
#include "tree.h" |
49 |
50 |
#include "ui.h" |
#include "ui.h" |
50 |
51 |
#include "utils.h" |
#include "utils.h" |
51 |
52 |
|
|
|
... |
... |
add_sort_type_info(FileView *view, int y, int x, int current_line) |
144 |
145 |
case SORT_BY_SIZE: |
case SORT_BY_SIZE: |
145 |
146 |
default: |
default: |
146 |
147 |
{ |
{ |
|
148 |
|
size_t size = 0; |
147 |
149 |
char str[24] = ""; |
char str[24] = ""; |
148 |
150 |
|
|
149 |
|
friendly_size_notation(view->dir_entry[x].size, sizeof(str), str); |
|
|
151 |
|
if(view->dir_entry[x].type == DIRECTORY) |
|
152 |
|
size = (size_t)tree_get_data(curr_stats.dirsize_cache, |
|
153 |
|
view->dir_entry[x].name); |
150 |
154 |
|
|
|
155 |
|
if(size == 0) |
|
156 |
|
size = view->dir_entry[x].size; |
|
157 |
|
|
|
158 |
|
friendly_size_notation(size, sizeof(str), str); |
151 |
159 |
snprintf(buf, sizeof(buf), " %s", str); |
snprintf(buf, sizeof(buf), " %s", str); |
152 |
160 |
} |
} |
153 |
161 |
break; |
break; |
|
... |
... |
draw_dir_list(FileView *view, int top, int pos) |
513 |
521 |
|
|
514 |
522 |
color_scheme = check_directory_for_color_scheme(view->curr_dir); |
color_scheme = check_directory_for_color_scheme(view->curr_dir); |
515 |
523 |
|
|
516 |
|
/* |
|
|
524 |
|
/* TODO do we need this code? |
517 |
525 |
wattrset(view->title, COLOR_PAIR(BORDER_COLOR + color_scheme)); |
wattrset(view->title, COLOR_PAIR(BORDER_COLOR + color_scheme)); |
518 |
526 |
wattron(view->title, COLOR_PAIR(BORDER_COLOR + color_scheme)); |
wattron(view->title, COLOR_PAIR(BORDER_COLOR + color_scheme)); |
519 |
527 |
*/ |
*/ |
File src/normal.c changed (mode: 100644) (index 82d9233bb..66b7b8795) |
36 |
36 |
#include "registers.h" |
#include "registers.h" |
37 |
37 |
#include "search.h" |
#include "search.h" |
38 |
38 |
#include "status.h" |
#include "status.h" |
|
39 |
|
#include "tree.h" |
39 |
40 |
#include "ui.h" |
#include "ui.h" |
40 |
41 |
#include "utils.h" |
#include "utils.h" |
41 |
42 |
#include "visual.h" |
#include "visual.h" |
|
... |
... |
cmd_ga(struct key_info key_info, struct keys_info *keys_info) |
765 |
766 |
close(out_pipe[0]); |
close(out_pipe[0]); |
766 |
767 |
|
|
767 |
768 |
size = strtoul(buf, NULL, 10); |
size = strtoul(buf, NULL, 10); |
|
769 |
|
tree_set_data(curr_stats.dirsize_cache, |
|
770 |
|
curr_view->dir_entry[curr_view->list_pos].name, (void*)size); |
|
771 |
|
|
768 |
772 |
curr_view->dir_entry[curr_view->list_pos].size = size; |
curr_view->dir_entry[curr_view->list_pos].size = size; |
769 |
773 |
moveto_list_pos(curr_view, curr_view->list_pos); |
moveto_list_pos(curr_view, curr_view->list_pos); |
770 |
774 |
} |
} |
File src/tree.c added (mode: 100644) (index 000000000..c150cddd9) |
|
1 |
|
/* vifm |
|
2 |
|
* Copyright (C) 2011 xaizek. |
|
3 |
|
* |
|
4 |
|
* This program is free software; you can redistribute it and/or modify |
|
5 |
|
* it under the terms of the GNU General Public License as published by |
|
6 |
|
* the Free Software Foundation; either version 2 of the License, or |
|
7 |
|
* (at your option) any later version. |
|
8 |
|
* |
|
9 |
|
* This program is distributed in the hope that it will be useful, |
|
10 |
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
|
* GNU General Public License for more details. |
|
13 |
|
* |
|
14 |
|
* You should have received a copy of the GNU General Public License |
|
15 |
|
* along with this program; if not, write to the Free Software |
|
16 |
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
|
17 |
|
*/ |
|
18 |
|
|
|
19 |
|
#include <limits.h> |
|
20 |
|
|
|
21 |
|
#include <stdlib.h> |
|
22 |
|
#include <string.h> |
|
23 |
|
|
|
24 |
|
#include "tree.h" |
|
25 |
|
|
|
26 |
|
struct node { |
|
27 |
|
char *name; |
|
28 |
|
size_t name_len; |
|
29 |
|
void *data; |
|
30 |
|
int valid; |
|
31 |
|
struct node *next; |
|
32 |
|
struct node *child; |
|
33 |
|
}; |
|
34 |
|
|
|
35 |
|
static struct node * find_node(struct node *root, const char *name, int create); |
|
36 |
|
|
|
37 |
|
tree_t |
|
38 |
|
tree_create(void) |
|
39 |
|
{ |
|
40 |
|
struct node *tree; |
|
41 |
|
|
|
42 |
|
tree = malloc(sizeof(*tree)); |
|
43 |
|
tree->child = NULL; |
|
44 |
|
return tree; |
|
45 |
|
} |
|
46 |
|
|
|
47 |
|
int |
|
48 |
|
tree_set_data(tree_t tree, const char *path, void* data) |
|
49 |
|
{ |
|
50 |
|
struct node *node; |
|
51 |
|
char real_path[PATH_MAX]; |
|
52 |
|
|
|
53 |
|
if(realpath(path, real_path) != real_path) |
|
54 |
|
return -1; |
|
55 |
|
|
|
56 |
|
node = find_node(tree, real_path, 1); |
|
57 |
|
node->data = data; |
|
58 |
|
node->valid = 1; |
|
59 |
|
return 0; |
|
60 |
|
} |
|
61 |
|
|
|
62 |
|
void * |
|
63 |
|
tree_get_data(tree_t tree, const char *path) |
|
64 |
|
{ |
|
65 |
|
struct node *node; |
|
66 |
|
char real_path[PATH_MAX]; |
|
67 |
|
|
|
68 |
|
if(realpath(path, real_path) != real_path) |
|
69 |
|
return NULL; |
|
70 |
|
|
|
71 |
|
node = find_node(tree, real_path, 0); |
|
72 |
|
if(node == NULL || !node->valid) |
|
73 |
|
return NULL; |
|
74 |
|
|
|
75 |
|
return node->data; |
|
76 |
|
} |
|
77 |
|
|
|
78 |
|
static struct node * |
|
79 |
|
find_node(struct node *root, const char *name, int create) |
|
80 |
|
{ |
|
81 |
|
const char *end; |
|
82 |
|
size_t name_len; |
|
83 |
|
struct node *prev = NULL, *curr; |
|
84 |
|
struct node *new_node; |
|
85 |
|
|
|
86 |
|
if(*name == '/') |
|
87 |
|
name++; |
|
88 |
|
|
|
89 |
|
if(*name == '\0') |
|
90 |
|
return root; |
|
91 |
|
|
|
92 |
|
end = strchr(name, '/'); |
|
93 |
|
if(end == NULL) |
|
94 |
|
end = name + strlen(name); |
|
95 |
|
|
|
96 |
|
name_len = end - name; |
|
97 |
|
curr = root->child; |
|
98 |
|
while(curr != NULL) |
|
99 |
|
{ |
|
100 |
|
int comp = strncmp(name, curr->name, end - name); |
|
101 |
|
if(comp == 0 && curr->name_len == name_len) |
|
102 |
|
return find_node(curr, end, create); |
|
103 |
|
else if(comp < 0) |
|
104 |
|
break; |
|
105 |
|
prev = curr; |
|
106 |
|
curr = curr->next; |
|
107 |
|
} |
|
108 |
|
|
|
109 |
|
if(!create) |
|
110 |
|
return NULL; |
|
111 |
|
|
|
112 |
|
new_node = malloc(sizeof(*new_node)); |
|
113 |
|
if(new_node == NULL) |
|
114 |
|
return NULL; |
|
115 |
|
|
|
116 |
|
if((new_node->name = malloc(name_len + 1)) == NULL) |
|
117 |
|
{ |
|
118 |
|
free(new_node); |
|
119 |
|
return NULL; |
|
120 |
|
} |
|
121 |
|
strncpy(new_node->name, name, name_len); |
|
122 |
|
new_node->name[name_len] = '\0'; |
|
123 |
|
new_node->name_len = name_len; |
|
124 |
|
new_node->valid = 0; |
|
125 |
|
new_node->child = NULL; |
|
126 |
|
new_node->next = curr; |
|
127 |
|
|
|
128 |
|
if(root->child == curr) |
|
129 |
|
root->child = new_node; |
|
130 |
|
else |
|
131 |
|
prev->next = new_node; |
|
132 |
|
|
|
133 |
|
return find_node(new_node, end, create); |
|
134 |
|
} |
|
135 |
|
|
|
136 |
|
/* vim: set tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab : */ |
File src/tree.h copied from file src/opt_handlers.h (similarity 80%) (mode: 100644) (index f12be0c94..3fc2cc87a) |
16 |
16 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
17 |
17 |
*/ |
*/ |
18 |
18 |
|
|
19 |
|
#ifndef __OPT_HANDLERS_H__ |
|
20 |
|
#define __OPT_HANDLERS_H__ |
|
|
19 |
|
#ifndef __TREE_H__ |
|
20 |
|
#define __TREE_H__ |
21 |
21 |
|
|
22 |
|
#include "ui.h" |
|
|
22 |
|
typedef struct node *tree_t; |
23 |
23 |
|
|
24 |
|
void init_options(void); |
|
25 |
|
void load_local_options(FileView *view); |
|
26 |
|
int process_set_args(const char *args); |
|
|
24 |
|
tree_t tree_create(void); |
|
25 |
|
int tree_set_data(tree_t tree, const char *path, void* data); |
|
26 |
|
void * tree_get_data(tree_t tree, const char *path); |
27 |
27 |
|
|
28 |
28 |
#endif |
#endif |
29 |
29 |
|
|
File src/vifm.c changed (mode: 100644) (index 9ccc835b3..f92dee7c1) |
45 |
45 |
#include "registers.h" |
#include "registers.h" |
46 |
46 |
#include "signals.h" |
#include "signals.h" |
47 |
47 |
#include "status.h" |
#include "status.h" |
|
48 |
|
#include "tree.h" |
48 |
49 |
#include "ui.h" |
#include "ui.h" |
49 |
50 |
#include "utils.h" |
#include "utils.h" |
50 |
51 |
|
|
|
... |
... |
main(int argc, char *argv[]) |
153 |
154 |
init_window_history(&rwin); |
init_window_history(&rwin); |
154 |
155 |
|
|
155 |
156 |
init_status(); |
init_status(); |
|
157 |
|
curr_stats.dirsize_cache = tree_create(); |
|
158 |
|
if(curr_stats.dirsize_cache == NULL) |
|
159 |
|
{ |
|
160 |
|
puts("Not enough memory for initialization"); |
|
161 |
|
return -1; |
|
162 |
|
} |
156 |
163 |
|
|
157 |
164 |
#ifdef HAVE_LIBGTK |
#ifdef HAVE_LIBGTK |
158 |
165 |
curr_stats.gtk_available = gtk_init_check(&argc, &argv); |
curr_stats.gtk_available = gtk_init_check(&argc, &argv); |