summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5b4c449)
raw | patch | inline | side by side (parent: 5b4c449)
author | Jonas Fonseca <fonseca@diku.dk> | |
Sat, 31 Jan 2009 10:41:01 +0000 (11:41 +0100) | ||
committer | Jonas Fonseca <fonseca@diku.dk> | |
Mon, 2 Feb 2009 08:28:24 +0000 (09:28 +0100) |
Also fixes use of the C++ true keyword which crept in in commit
babaa6f7a97cbe3948588e5181de0801ce32b792 (Refactor user input handling
into separate function).
babaa6f7a97cbe3948588e5181de0801ce32b792 (Refactor user input handling
into separate function).
TODO | patch | blob | history | |
tig.c | patch | blob | history |
index 374b173a21fea3235a35e0a98f7498816cfaf836..89e5dd4273a0baec1230da1573f366dcc69005d6 100644 (file)
--- a/TODO
+++ b/TODO
----
Features that should be explored.
- - Better text-input support. From setsyx(3):
-
- The setsyx routine sets the virtual screen cursor to y, x. If y
- and x are both -1, then leaveok is set. The two routines getsyx
- and setsyx are designed to be used by a library routine, which
- manipulates curses windows but does not want to change the
- current position of the program cursor. The library routine
- would call getsyx at the beginning, do its manipulation of its
- own windows, do a wnoutrefresh on its windows, call setsyx, and
- then call doupdate.
+ - Better text-input support.
- When the user wants to "view" a commit, you could show from which
branch heads and from which tags the commit is reachable, and perhaps
index 486b0c7444cd29526195bdb7faa61511c3505c42..c20a9d4f9b833a3f7d2c796ac5b4c3d591b42823 100644 (file)
--- a/tig.c
+++ b/tig.c
}
-static void
-update_display_cursor(struct view *view)
-{
- /* Move the cursor to the right-most column of the cursor line.
- *
- * XXX: This could turn out to be a bit expensive, but it ensures that
- * the cursor does not jump around. */
- if (view->lines) {
- wmove(view->win, view->lineno - view->offset, view->width - 1);
- wnoutrefresh(view->win);
- }
-}
-
static void
update_view_title(struct view *view)
{
mvwaddnstr(view->title, 0, 0, buf, bufpos);
wclrtoeol(view->title);
- wmove(view->title, 0, view->width - 1);
wnoutrefresh(view->title);
}
redraw_view(view);
update_view_title(view);
}
-
- if (display[current_view])
- update_display_cursor(display[current_view]);
}
static void
/* Update the title _after_ the redraw so that if the redraw picks up a
* commit reference in view->ref it'll be available here. */
update_view_title(view);
- update_display_cursor(view);
return TRUE;
}
}
update_view_title(view);
- update_display_cursor(view);
}
/* Controls when nodelay should be in effect when polling user input. */
nonl(); /* Tell curses not to do NL->CR/NL on output */
cbreak(); /* Take input chars one at a time, no wait for \n */
noecho(); /* Don't echo input */
- leaveok(stdscr, TRUE);
+ leaveok(stdscr, FALSE);
if (has_colors())
init_colors();
}
static int
-get_input(bool prompting)
+get_input(int prompt_position)
{
struct view *view;
- int i, key;
+ int i, key, cursor_y, cursor_x;
- if (prompting)
+ if (prompt_position)
input_mode = TRUE;
- while (true) {
+ while (TRUE) {
foreach_view (view, i)
update_view(view);
+ /* Update the cursor position. */
+ if (prompt_position) {
+ getbegyx(status_win, cursor_y, cursor_x);
+ cursor_x = prompt_position;
+ } else {
+ view = display[current_view];
+ getbegyx(view->win, cursor_y, cursor_x);
+ cursor_x = view->width - 1;
+ cursor_y += view->lineno - view->offset;
+ }
+ setsyx(cursor_y, cursor_x);
+
/* Refresh, accept single keystroke of input */
doupdate();
key = wgetch(status_win);
getmaxyx(stdscr, height, width);
- /* Resize the status view first so the cursor is
- * placed properly. */
wresize(status_win, 1, width);
mvwin(status_win, height - 1, 0);
wnoutrefresh(status_win);
mvwprintw(status_win, 0, 0, "%s%.*s", prompt, pos, buf);
wclrtoeol(status_win);
- key = get_input(TRUE);
+ key = get_input(pos + 1);
switch (key) {
case KEY_RETURN:
case KEY_ENTER:
}
while (view_driver(display[current_view], request)) {
- int key = get_input(FALSE);
+ int key = get_input(0);
view = display[current_view];
request = get_keybinding(view->keymap, key);