commit 0aef305d12c879faacb155c7b7348e6dcd99f394 from: Omar Polo date: Mon Jan 10 15:04:15 2022 UTC add vi-like `~' fringes after the end of the buffers commit - 23ca9d13ca4a4a1ef66bd6fa717bef548dbe8fba commit + 0aef305d12c879faacb155c7b7348e6dcd99f394 blob - f9f37a87eedaff718d71a10e8a2233e0938f5bd2 blob + 605bcc2a5b658a91ad2bc6feaf3eb77d3638f65c --- defaults.c +++ defaults.c @@ -41,6 +41,18 @@ int max_killed_tabs = 10; int olivetti_mode = 1; int set_title = 1; int tab_bar_show = 1; + +static struct line fringe_line = { + .type = LINE_FRINGE, +}; +struct vline fringe = { + /* + * This is a special vline, it won't ever be free'd, as it's + * only "virtual" for the UI, it's never added to a buffer. + */ + .line = (char *)"", + .parent = &fringe_line, +}; struct lineprefix line_prefixes[] = { [LINE_TEXT] = { "", "" }, @@ -68,6 +80,8 @@ struct lineprefix line_prefixes[] = { [LINE_DOWNLOAD] = {" Fetching ", " "}, [LINE_DOWNLOAD_DONE] = {" Done ", " "}, [LINE_DOWNLOAD_INFO] = {" ", " "}, + + [LINE_FRINGE] = {"", ""}, }; struct line_face line_faces[] = { @@ -191,6 +205,13 @@ struct line_face line_faces[] = { .pair = PDOWNLOAD_INFO, .trail_pair = PDOWNLOAD_INFO_TRAIL }, + + /* misc ui */ + [LINE_FRINGE] = { + .prfx_pair = PFRINGE, + .pair = PFRINGE, + .trail_pair = PFRINGE_TRAIL, + } }; struct tab_face tab_face = { @@ -264,6 +285,9 @@ struct mapping { {"download.ongoing", LINE_DOWNLOAD}, {"download.done", LINE_DOWNLOAD_DONE}, {"download.info", LINE_DOWNLOAD_INFO}, + + /* misc ui */ + {"fringe", LINE_FRINGE}, }; static struct mapping * blob - 177c8b83606b33ad09561dae2b66e7d0413a05db blob + 8c8b3a8b7db06d3abba3a4cfb0d159db40c990cc --- defaults.h +++ defaults.h @@ -33,6 +33,8 @@ extern int olivetti_mode; extern int set_title; extern int tab_bar_show; +extern struct vline fringe; + struct lineprefix { const char *prfx1; const char *prfx2; blob - 464645a0f4b4328d77b50d86c75c04e5a4a6dff8 blob + 5facedbac001028d9b4a2f887d3d3b715606ffe2 --- telescope.h +++ telescope.h @@ -106,6 +106,9 @@ enum line_type { LINE_DOWNLOAD, LINE_DOWNLOAD_DONE, LINE_DOWNLOAD_INFO, + + /* misc ui */ + LINE_FRINGE, }; /* for lines: mark as hidden */ blob - 59bc25a054e90eb846d92fee014ba499b23e28d0 blob + a4803f9231ebca27a7e363810dc46e96ce477d45 --- ui.c +++ ui.c @@ -60,7 +60,7 @@ static void rearrange_windows(void); static void line_prefix_and_text(struct vline *, char *, size_t, const char **, const char **); static void print_vline(int, int, WINDOW*, struct vline*); static void redraw_tabline(void); -static void redraw_window(WINDOW*, int, int, int, struct buffer*); +static void redraw_window(WINDOW *, int, int, int, int, struct buffer *); static void redraw_download(void); static void redraw_help(void); static void redraw_body(struct tab*); @@ -639,10 +639,10 @@ adjust_line(struct vline *vl, struct buffer *buffer) static void redraw_window(WINDOW *win, int off, int height, int width, - struct buffer *buffer) + int show_fringe, struct buffer *buffer) { struct vline *vl; - int l, onscreen; + int onscreen = 0, l = 0; restore_curs_x(buffer); @@ -670,8 +670,6 @@ again: buffer->current_line = adjust_line(buffer->current_line, buffer); - l = 0; - onscreen = 0; for (vl = buffer->top_line; vl != NULL; vl = TAILQ_NEXT(vl, vlines)) { if (vl->parent->flags & L_HIDDEN) continue; @@ -707,19 +705,22 @@ again: buffer->last_line_off = buffer->line_off; buffer->force_redraw = 0; end: + for (; show_fringe && l < height; l++) + print_vline(0, width, win, &fringe); + wmove(win, buffer->curs_y, buffer->curs_x); } static void redraw_download(void) { - redraw_window(download, 0, download_lines, COLS, &downloadwin); + redraw_window(download, 0, download_lines, COLS, 0, &downloadwin); } static void redraw_help(void) { - redraw_window(help, 0, help_lines, help_cols, &helpwin); + redraw_window(help, 0, help_lines, help_cols, 1, &helpwin); } static void @@ -731,7 +732,7 @@ redraw_body(struct tab *tab) tab->buffer.force_redraw =1; last_tab = tab; - redraw_window(body, x_offset, body_lines, body_cols, &tab->buffer); + redraw_window(body, x_offset, body_lines, body_cols, 1, &tab->buffer); } static inline char @@ -875,7 +876,7 @@ do_redraw_minibuffer(void) static void do_redraw_minibuffer_compl(void) { - redraw_window(minibuffer, 0, 10, COLS, + redraw_window(minibuffer, 0, 10, COLS, 1, &ministate.compl.buffer); } blob - 91f25e72264b4b2b92e490dcce6e798344b7166e blob + 00fe68291a346562f2e358b9eaef4fad166db13d --- ui.h +++ ui.h @@ -118,6 +118,9 @@ enum pairs { PMODELINE, PMINIBUF, + + PFRINGE, + PFRINGE_TRAIL, }; extern struct thiskey thiskey; blob - 7cf9b8af5ba28dda0dbf628cf0c5cdc7a7491f40 blob + 338068315003a7f604337fc0f6c91a4b98a7739e --- wrap.c +++ wrap.c @@ -283,6 +283,9 @@ wrap_page(struct buffer *buffer, int width) case LINE_DOWNLOAD_INFO: wrap_one(buffer, prfx, l, width); break; + case LINE_FRINGE: + /* never, ever wrapped */ + break; } if (top_orig == l && buffer->top_line == NULL) {