diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2015-01-04 21:11:06 +0100 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2015-01-04 22:31:50 +0100 |
| commit | f356d76752c59bef8e4034e759226ab36c8a1a62 (patch) | |
| tree | 37b1563fce1470d4008bdb21bd1498180ebaac1e /window.c | |
| parent | d9f1a640d84054c5bcc513e0cbe34aad77c167bc (diff) | |
| download | vis-f356d76752c59bef8e4034e759226ab36c8a1a62.tar.gz vis-f356d76752c59bef8e4034e759226ab36c8a1a62.tar.xz | |
Change window_cursor_getxy API
Diffstat (limited to 'window.c')
| -rw-r--r-- | window.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -296,16 +296,16 @@ static bool window_addch(Win *win, Char *c) { } } -void window_cursor_getxy(Win *win, size_t *lineno, size_t *col) { +CursorPos window_cursor_getpos(Win *win) { Cursor *cursor = &win->cursor; Line *line = cursor->line; - *lineno = line->lineno; - *col = cursor->col; - while (line->prev && line->prev->lineno == *lineno) { + CursorPos pos = { .line = line->lineno, .col = cursor->col }; + while (line->prev && line->prev->lineno == pos.line) { line = line->prev; - *col += line->width; + pos.col += line->width; } - *col += 1; + pos.col++; + return pos; } /* place the cursor according to the screen coordinates in win->{row,col} and |
