~mdw
/
tig
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Replace screen-update action with noop action named "none"
[tig]
/
tig.c
diff --git
a/tig.c
b/tig.c
index
b84c561
..
089a567
100644
(file)
--- a/
tig.c
+++ b/
tig.c
@@
-283,8
+283,8
@@
sq_quote(char buf[SIZEOF_STR], size_t bufsize, const char *src)
REQ_(SCROLL_PAGE_DOWN, "Scroll one page down"), \
\
REQ_GROUP("Misc") \
REQ_(SCROLL_PAGE_DOWN, "Scroll one page down"), \
\
REQ_GROUP("Misc") \
+ REQ_(NONE, "Do nothing"), \
REQ_(PROMPT, "Bring up the prompt"), \
REQ_(PROMPT, "Bring up the prompt"), \
- REQ_(SCREEN_UPDATE, "Update the screen"), \
REQ_(SCREEN_REDRAW, "Redraw the screen"), \
REQ_(SCREEN_RESIZE, "Resize the screen"), \
REQ_(SHOW_VERSION, "Show version information"), \
REQ_(SCREEN_REDRAW, "Redraw the screen"), \
REQ_(SCREEN_RESIZE, "Resize the screen"), \
REQ_(SHOW_VERSION, "Show version information"), \
@@
-691,9
+691,9
@@
static struct keybinding default_keybindings[] = {
{ ':', REQ_PROMPT },
/* wgetch() with nodelay() enabled returns ERR when there's no input. */
{ ':', REQ_PROMPT },
/* wgetch() with nodelay() enabled returns ERR when there's no input. */
- { ERR, REQ_
SCREEN_UPDAT
E },
+ { ERR, REQ_
NON
E },
- /* Us
e
the ncurses SIGWINCH handler. */
+ /* Us
ing
the ncurses SIGWINCH handler. */
{ KEY_RESIZE, REQ_SCREEN_RESIZE },
};
{ KEY_RESIZE, REQ_SCREEN_RESIZE },
};
@@
-1956,7
+1956,7
@@
view_driver(struct view *view, enum request request)
redraw_display();
break;
redraw_display();
break;
- case REQ_
SCREEN_UPDAT
E:
+ case REQ_
NON
E:
doupdate();
return TRUE;
doupdate();
return TRUE;
@@
-2686,11
+2686,11
@@
init_display(void)
wbkgdset(status_win, get_line_attr(LINE_STATUS));
}
wbkgdset(status_win, get_line_attr(LINE_STATUS));
}
-static
int
+static
char *
read_prompt(const char *prompt)
{
enum { READING, STOP, CANCEL } status = READING;
read_prompt(const char *prompt)
{
enum { READING, STOP, CANCEL } status = READING;
- char buf[sizeof(opt_cmd) - STRING_SIZE("git \0")];
+
static
char buf[sizeof(opt_cmd) - STRING_SIZE("git \0")];
int pos = 0;
while (status == READING) {
int pos = 0;
while (status == READING) {
@@
-2727,7
+2727,7
@@
read_prompt(const char *prompt)
default:
if (pos >= sizeof(buf)) {
report("Input string too long");
default:
if (pos >= sizeof(buf)) {
report("Input string too long");
- return
ERR
;
+ return
NULL
;
}
if (isprint(key))
}
if (isprint(key))
@@
-2738,18
+2738,12
@@
read_prompt(const char *prompt)
if (status == CANCEL) {
/* Clear the status window */
report("");
if (status == CANCEL) {
/* Clear the status window */
report("");
- return
ERR
;
+ return
NULL
;
}
buf[pos++] = 0;
}
buf[pos++] = 0;
- if (!string_format(opt_cmd, "git %s", buf))
- return ERR;
- if (strncmp(buf, "show", 4) && isspace(buf[4]))
- opt_request = REQ_VIEW_DIFF;
- else
- opt_request = REQ_VIEW_PAGER;
- return
OK
;
+ return
buf
;
}
/*
}
/*
@@
-3010,10
+3004,21
@@
main(int argc, char *argv[])
* status_win restricted. */
switch (request) {
case REQ_PROMPT:
* status_win restricted. */
switch (request) {
case REQ_PROMPT:
- if (read_prompt(":") == ERR)
- request = REQ_SCREEN_UPDATE;
- break;
+ {
+ char *cmd = read_prompt(":");
+
+ if (cmd && string_format(opt_cmd, "git %s", cmd)) {
+ if (strncmp(cmd, "show", 4) && isspace(cmd[4])) {
+ opt_request = REQ_VIEW_DIFF;
+ } else {
+ opt_request = REQ_VIEW_PAGER;
+ }
+ break;
+ }
+ request = REQ_NONE;
+ break;
+ }
case REQ_SCREEN_RESIZE:
{
int height, width;
case REQ_SCREEN_RESIZE:
{
int height, width;