Created
May 3, 2015 14:03
-
-
Save ao-kenji/fe07a4725b27ca161d87 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/draw.h b/draw.h | |
| index 541688d..914272e 100644 | |
| --- a/draw.h | |
| +++ b/draw.h | |
| @@ -25,7 +25,7 @@ static inline void draw_line(struct framebuffer *fb, struct terminal *term, int | |
| struct cell_t *cellp; | |
| for (col = term->cols - 1; col >= 0; col--) { | |
| - margin_right = (term->cols - 1 - col) * CELL_WIDTH; | |
| + margin_right = (term->cols - 1 - col) * CELL_WIDTH + term->rpad; | |
| /* target cell */ | |
| cellp = &term->cells[line][col]; | |
| diff --git a/terminal.h b/terminal.h | |
| index 58b0a95..9c29b93 100644 | |
| --- a/terminal.h | |
| +++ b/terminal.h | |
| @@ -347,6 +347,7 @@ void term_init(struct terminal *term, int width, int height) | |
| term->cols = term->width / CELL_WIDTH; | |
| term->lines = term->height / CELL_HEIGHT; | |
| + term->rpad = term->width % CELL_WIDTH; | |
| if (DEBUG) | |
| fprintf(stderr, "width:%d height:%d cols:%d lines:%d\n", | |
| diff --git a/yaft.h b/yaft.h | |
| index ad8c3a8..390e17d 100644 | |
| --- a/yaft.h | |
| +++ b/yaft.h | |
| @@ -144,6 +144,7 @@ struct terminal { | |
| int fd; /* master fd */ | |
| int width, height; /* terminal size (pixel) */ | |
| int cols, lines; /* terminal size (cell) */ | |
| + int rpad; /* right pad (pixel) */ | |
| struct cell_t **cells; /* pointer to each cell: cells[lines][cols] */ | |
| struct margin scroll; /* scroll margin */ | |
| struct point_t cursor; /* cursor pos (x, y) */ |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
yaftで (TERM_WIDTH % CELL_WIDTH) != 0 の時、Sixel表示のX方向原点とキャラクタ表示のX方向原点にずれが生じると思います。そのため、Sixel画像を表示した後にスクロールすると、左端にゴミが残ります。それをなくすためのpatch案です。
【例】
TERM_WIDTH == 1024で、12x24フォント(CELL_WIDTH == 12)とした時:
http://www.nk-home.net/~aoyama/tmp/KIMG0232.jpg