Skip to content

Commit bf7160a

Browse files
committed
Do not delay scratch cmds in agit
This is not needed anymore because heights of wins are not limitted to the number of lines in the buffer when splitting. This kind of reverts fee5e58.
1 parent 1aa7af2 commit bf7160a

1 file changed

Lines changed: 11 additions & 16 deletions

File tree

bin/agit.c

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ struct {
2424
int l1;
2525
int l2;
2626
} prompt;
27-
int scratch;
2827

2928
void opt(const char *arg) {
3029
vec_push(&cmd.v, xstrdup(arg));
@@ -47,14 +46,6 @@ void set_(const char *arg, ...) {
4746
cmd.fixed = vec_len(&cmd.v);
4847
}
4948

50-
void setscratch(const char *cwd, const char *title) {
51-
char **p = vec_dig(&cmd.v, 0, 3);
52-
p[0] = xstrdup("scratch");
53-
p[1] = xstrdup(cwd);
54-
p[2] = xstrdup(title);
55-
scratch = 1;
56-
}
57-
5849
void checktime(void) {
5950
const char *cmd[] = {"checktime"};
6051
request(cmd, ARRLEN(cmd), NULL);
@@ -78,6 +69,14 @@ int run(int outfd) {
7869
return call(cmd.v, fds);
7970
}
8071

72+
void scratch(const char *cwd, const char *title) {
73+
char **p = vec_dig(&cmd.v, 0, 3);
74+
p[0] = xstrdup("scratch");
75+
p[1] = xstrdup(cwd);
76+
p[2] = xstrdup(title);
77+
request((const char **)cmd.v, vec_len(&cmd.v), NULL);
78+
}
79+
8180
void changed(avim_strv msg) {
8281
if (vec_len(&msg) > 1) {
8382
prompt.l1 = atoi(msg[1]);
@@ -201,10 +200,6 @@ int main(int argc, char *argv[]) {
201200
checktime();
202201
status();
203202
menu(cmds);
204-
if (scratch) {
205-
request((const char **)cmd.v, vec_len(&cmd.v), NULL);
206-
scratch = 0;
207-
}
208203
block(-1);
209204
input();
210205
struct cmd *cmd = match(cmds);
@@ -376,7 +371,7 @@ void cmd_diff(void) {
376371
set("git", "diff");
377372
hint("< --cached --stat --submodule=diff HEAD @{u} -- >");
378373
if (add(NULL)) {
379-
setscratch(cwd, "git:diff");
374+
scratch(cwd, "git:diff");
380375
}
381376
}
382377

@@ -397,7 +392,7 @@ void cmd_fetch(void) {
397392
void cmd_graph(void) {
398393
clear();
399394
set("git-graph", "--no-color", "--no-pager", "--style", "ascii");
400-
setscratch(cwd, "git:graph");
395+
scratch(cwd, "git:graph");
401396
}
402397

403398
void cmd_log(void) {
@@ -407,7 +402,7 @@ void cmd_log(void) {
407402
opt("--cherry-mark");
408403
hint("< --first-parent --no-merges --oneline -S HEAD ...@{u} >");
409404
if (add(list_open_files_and_branches)) {
410-
setscratch(cwd, "git:log");
405+
scratch(cwd, "git:log");
411406
}
412407
}
413408

0 commit comments

Comments
 (0)