7
7
# Authors: Luuk van Baal
8
8
9
9
diff --git a/src/nnn.c b/src/nnn.c
10
- index af586056..9ebfb203 100644
10
+ index ee1f5beb..91aab231 100644
11
11
--- a/src/nnn.c
12
12
+++ b/src/nnn.c
13
- @@ -262 ,6 +262 ,25 @@
13
+ @@ -265 ,6 +265 ,25 @@
14
14
#define FREE 0
15
15
#define CAPACITY 1
16
16
@@ -36,23 +36,23 @@ index af586056..9ebfb203 100644
36
36
/* TYPE DEFINITIONS */
37
37
typedef unsigned int uint_t;
38
38
typedef unsigned char uchar_t;
39
- @@ -286 ,6 +305 ,7 @@ typedef struct entry {
39
+ @@ -289 ,6 +308 ,7 @@ typedef struct entry {
40
40
uid_t uid; /* 4 bytes */
41
41
gid_t gid; /* 4 bytes */
42
42
#endif
43
43
+ char git_status[2][5];
44
44
} *pEntry;
45
45
46
46
/* Selection marker */
47
- @@ -342 ,6 +362 ,7 @@ typedef struct {
47
+ @@ -345 ,6 +365 ,7 @@ typedef struct {
48
48
uint_t cliopener : 1; /* All-CLI app opener */
49
49
uint_t waitedit : 1; /* For ops that can't be detached, used EDITOR */
50
50
uint_t rollover : 1; /* Roll over at edges */
51
51
+ uint_t normalgit : 1; /* Show git status in normal mode */
52
52
} settings;
53
53
54
54
/* Non-persistent program-internal states (alphabeical order) */
55
- @@ -395 ,7 +416 ,17 @@ static struct {
55
+ @@ -398 ,7 +419 ,17 @@ static struct {
56
56
ushort_t maxnameln, maxsizeln, maxuidln, maxgidln, maxentln, uidln, gidln, printguid;
57
57
} dtls;
58
58
@@ -70,15 +70,15 @@ index af586056..9ebfb203 100644
70
70
71
71
/* Configuration, contexts */
72
72
static settings cfg = {
73
- @@ -426 ,6 +457 ,7 @@ static settings cfg = {
73
+ @@ -429 ,6 +460 ,7 @@ static settings cfg = {
74
74
0, /* cliopener */
75
75
0, /* waitedit */
76
76
1, /* rollover */
77
77
+ 0, /* normalgit */
78
78
};
79
79
80
80
static context g_ctx[CTX_MAX] __attribute__ ((aligned));
81
- @@ -3847 ,6 +3879 ,56 @@ static int get_kv_key(kv *kvarr, char *val, uchar_t max, uchar_t id)
81
+ @@ -3846 ,6 +3878 ,56 @@ static int get_kv_key(kv *kvarr, char *val, uchar_t max, uchar_t id)
82
82
return -1;
83
83
}
84
84
@@ -135,7 +135,7 @@ index af586056..9ebfb203 100644
135
135
static void resetdircolor(int flags)
136
136
{
137
137
/* Directories are always shown on top, clear the color when moving to first file */
138
- @@ -4157 ,6 +4239 ,9 @@ static void printent(const struct entry *ent, uint_t namecols, bool sel)
138
+ @@ -4163 ,6 +4245 ,9 @@ static void printent(const struct entry *ent, uint_t namecols, bool sel)
139
139
int attrs = 0, namelen;
140
140
uchar_t color_pair = get_color_pair_name_ind(ent, &ind, &attrs);
141
141
@@ -145,7 +145,7 @@ index af586056..9ebfb203 100644
145
145
addch((ent->flags & FILE_SELECTED) ? '+' | A_REVERSE | A_BOLD : ' ');
146
146
147
147
if (g_state.oldcolor)
148
- @@ -5623 ,6 +5708 ,11 @@ static int dentfill(char *path, struct entry **ppdents)
148
+ @@ -5636 ,6 +5721 ,11 @@ static int dentfill(char *path, struct entry **ppdents)
149
149
attron(COLOR_PAIR(cfg.curctx + 1));
150
150
}
151
151
@@ -157,7 +157,7 @@ index af586056..9ebfb203 100644
157
157
#if _POSIX_C_SOURCE >= 200112L
158
158
posix_fadvise(fd, 0, 0, POSIX_FADV_SEQUENTIAL);
159
159
#endif
160
- @@ -5821 ,6 +5911 ,29 @@ static int dentfill(char *path, struct entry **ppdents)
160
+ @@ -5836 ,6 +5926 ,29 @@ static int dentfill(char *path, struct entry **ppdents)
161
161
#endif
162
162
}
163
163
@@ -187,7 +187,7 @@ index af586056..9ebfb203 100644
187
187
++ndents;
188
188
} while ((dp = readdir(dirp)));
189
189
190
- @@ -6357 ,7 +6470 ,8 @@ static int adjust_cols(int n)
190
+ @@ -6374 ,7 +6487 ,8 @@ static int adjust_cols(int n)
191
191
cfg.showdetail ^= 1;
192
192
else /* 2 more accounted for below */
193
193
n -= (dtls.maxentln - 2 - dtls.maxnameln);
@@ -197,7 +197,7 @@ index af586056..9ebfb203 100644
197
197
198
198
/* 2 columns for preceding space and indicator */
199
199
return (n - 2);
200
- @@ -6512 ,7 +6626 ,7 @@ static void redraw(char *path)
200
+ @@ -6529 ,7 +6643 ,7 @@ static void redraw(char *path)
201
201
}
202
202
#endif
203
203
}
@@ -206,23 +206,23 @@ index af586056..9ebfb203 100644
206
206
}
207
207
208
208
ncols = adjust_cols(ncols);
209
- @@ -8132 ,6 +8246 ,7 @@ static void usage(void)
209
+ @@ -8154 ,6 +8268 ,7 @@ static void usage(void)
210
210
" -F val fifo mode [0:preview 1:explore]\n"
211
211
#endif
212
212
" -g regex filters\n"
213
213
+ " -G always show git status\n"
214
214
" -H show hidden files\n"
215
215
" -i show current file info\n"
216
- " -J no auto-jump on select \n"
217
- @@ -8272 ,6 +8387 ,7 @@ static void cleanup(void)
218
- free(hostname );
216
+ " -J no auto-jump on selection \n"
217
+ @@ -8292 ,6 +8407 ,7 @@ static void cleanup(void)
218
+ fflush(stdout );
219
219
}
220
220
#endif
221
221
+ free(git_statuses.statuses);
222
222
free(selpath);
223
223
free(plgpath);
224
224
free(cfgpath);
225
- @@ -8316 ,7 +8432 ,7 @@ int main(int argc, char *argv[])
225
+ @@ -8336 ,7 +8452 ,7 @@ int main(int argc, char *argv[])
226
226
227
227
while ((opt = (env_opts_id > 0
228
228
? env_opts[--env_opts_id]
@@ -231,7 +231,7 @@ index af586056..9ebfb203 100644
231
231
switch (opt) {
232
232
#ifndef NOFIFO
233
233
case 'a':
234
- @@ -8367 ,6 +8483 ,9 @@ int main(int argc, char *argv[])
234
+ @@ -8387 ,6 +8503 ,9 @@ int main(int argc, char *argv[])
235
235
cfg.regex = 1;
236
236
filterfn = &visible_re;
237
237
break;
0 commit comments