summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 85ecdc6)
raw | patch | inline | side by side (parent: 85ecdc6)
author | Jonas Fonseca <fonseca@diku.dk> | |
Sat, 17 Jan 2009 13:05:00 +0000 (14:05 +0100) | ||
committer | Jonas Fonseca <fonseca@diku.dk> | |
Wed, 21 Jan 2009 22:21:14 +0000 (23:21 +0100) |
Fixes resizing while the prompt is open.
NEWS | patch | blob | history | |
tig.c | patch | blob | history |
index 9eb36d552066ef25ea18fd8719f6118f43109df7..59a36c487e0a3d4df88442a7515cfc5a9943fe49 100644 (file)
--- a/NEWS
+++ b/NEWS
tig master
----------
+Incompatibilities:
+
+ - The screen-resize action has been deprecated. It had no real use for
+ users and was never meant to be exposed.
+
Improvements:
- Tree view: avoid flickering when updating.
index 70845310300e9890d9d1ded8947fcc1ac281c234..32d2fb7d8a143a06883cc29523575ac9f99a5f7a 100644 (file)
--- a/tig.c
+++ b/tig.c
@@ -709,7 +709,6 @@ static int read_properties(struct io *io, const char *separators, int (*read)(ch
REQ_GROUP("Misc") \
REQ_(PROMPT, "Bring up the prompt"), \
REQ_(SCREEN_REDRAW, "Redraw the screen"), \
- REQ_(SCREEN_RESIZE, "Resize the screen"), \
REQ_(SHOW_VERSION, "Show version information"), \
REQ_(STOP_LOADING, "Stop all loading views"), \
REQ_(EDIT, "Open in editor"), \
{ '@', REQ_STAGE_NEXT },
{ ',', REQ_TREE_PARENT },
{ 'e', REQ_EDIT },
-
- /* Using the ncurses SIGWINCH handler. */
- { KEY_RESIZE, REQ_SCREEN_RESIZE },
};
#define KEYMAP_INFO \
request = get_request(argv[2]);
if (request == REQ_NONE) {
- const char *obsolete[] = { "cherry-pick" };
+ const char *obsolete[] = { "cherry-pick", "screen-resize" };
size_t namelen = strlen(argv[2]);
int i;
report("tig-%s (built %s)", TIG_VERSION, __DATE__);
return TRUE;
- case REQ_SCREEN_RESIZE:
- resize_display();
- /* Fall-through */
case REQ_SCREEN_REDRAW:
redraw_display(TRUE);
break;
}
}
-static bool
-prompt_yesno(const char *prompt)
+static int
+get_input(bool prompting)
{
- enum { WAIT, STOP, CANCEL } status = WAIT;
- bool answer = FALSE;
-
- while (status == WAIT) {
- struct view *view;
- int i, key;
+ struct view *view;
+ int i, key;
+ if (prompting)
input_mode = TRUE;
+ while (true) {
foreach_view (view, i)
update_view(view);
- input_mode = FALSE;
+ /* Refresh, accept single keystroke of input */
+ key = wgetch(status_win);
+
+ /* wgetch() with nodelay() enabled returns ERR when
+ * there's no input. */
+ if (key == ERR) {
+ doupdate();
+
+ } else if (key == KEY_RESIZE) {
+ int height, width;
+
+ getmaxyx(stdscr, height, width);
+
+ /* Resize the status view and let the view driver take
+ * care of resizing the displayed views. */
+ resize_display();
+ redraw_display(TRUE);
+ wresize(status_win, 1, width);
+ mvwin(status_win, height - 1, 0);
+ wrefresh(status_win);
+
+ } else {
+ input_mode = FALSE;
+ return key;
+ }
+ }
+}
+
+static bool
+prompt_yesno(const char *prompt)
+{
+ enum { WAIT, STOP, CANCEL } status = WAIT;
+ bool answer = FALSE;
+
+ while (status == WAIT) {
+ int key;
mvwprintw(status_win, 0, 0, "%s [Yy]/[Nn]", prompt);
wclrtoeol(status_win);
- /* Refresh, accept single keystroke of input */
- key = wgetch(status_win);
+ key = get_input(TRUE);
switch (key) {
- case ERR:
- break;
-
case 'y':
case 'Y':
answer = TRUE;
int pos = 0;
while (status == READING) {
- struct view *view;
- int i, key;
-
- input_mode = TRUE;
-
- foreach_view (view, i)
- update_view(view);
-
- input_mode = FALSE;
+ int key;
mvwprintw(status_win, 0, 0, "%s%.*s", prompt, pos, buf);
wclrtoeol(status_win);
- /* Refresh, accept single keystroke of input */
- key = wgetch(status_win);
+ key = get_input(TRUE);
switch (key) {
case KEY_RETURN:
case KEY_ENTER:
status = CANCEL;
break;
- case ERR:
- break;
-
default:
if (pos >= sizeof(buf)) {
report("Input string too long");
}
while (view_driver(display[current_view], request)) {
- int key;
- int i;
+ int key = get_input(FALSE);
- foreach_view (view, i)
- update_view(view);
view = display[current_view];
-
- /* Refresh, accept single keystroke of input */
- key = wgetch(status_win);
-
- /* wgetch() with nodelay() enabled returns ERR when there's no
- * input. */
- if (key == ERR) {
- request = REQ_NONE;
- continue;
- }
-
request = get_keybinding(view->keymap, key);
/* Some low-level request handling. This keeps access to
request = REQ_NONE;
break;
}
- case REQ_SCREEN_RESIZE:
- {
- int height, width;
-
- getmaxyx(stdscr, height, width);
-
- /* Resize the status view and let the view driver take
- * care of resizing the displayed views. */
- wresize(status_win, 1, width);
- mvwin(status_win, height - 1, 0);
- wrefresh(status_win);
- break;
- }
default:
break;
}