diff --git a/CHANGELOG.md b/CHANGELOG.md index f4ed6459..8e9ca7d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -68,9 +68,11 @@ * Support for custom regex matching ([#1386][1386], [#1872][1872]) * Support for kitty's text-sizing protocol (`w`, width, only), OSC-66. +* `cursor.style` can now be set to `hollow` ([#1965][1965]). [1386]: https://codeberg.org/dnkl/foot/issues/1386 [1872]: https://codeberg.org/dnkl/foot/issues/1872 +[1965]: https://codeberg.org/dnkl/foot/issues/1965 ### Changed diff --git a/config.c b/config.c index 7a12cb1a..de2dc07f 100644 --- a/config.c +++ b/config.c @@ -1517,7 +1517,7 @@ parse_section_cursor(struct context *ctx) return value_to_enum( ctx, - (const char *[]){"block", "underline", "beam", NULL}, + (const char *[]){"block", "underline", "beam", "hollow", NULL}, (int *)&conf->cursor.style); } diff --git a/config.h b/config.h index 3535064e..deddcf04 100644 --- a/config.h +++ b/config.h @@ -28,7 +28,7 @@ struct font_size_adjustment { float percent; }; -enum cursor_style { CURSOR_BLOCK, CURSOR_UNDERLINE, CURSOR_BEAM }; +enum cursor_style { CURSOR_BLOCK, CURSOR_UNDERLINE, CURSOR_BEAM, CURSOR_HOLLOW }; enum cursor_unfocused_style { CURSOR_UNFOCUSED_UNCHANGED, CURSOR_UNFOCUSED_HOLLOW, diff --git a/doc/foot.ini.5.scd b/doc/foot.ini.5.scd index 87673233..56004654 100644 --- a/doc/foot.ini.5.scd +++ b/doc/foot.ini.5.scd @@ -842,8 +842,8 @@ applications can change these at runtime. *style* Configures the default cursor style, and is one of: *block*, - *beam* or *underline*. Note that this can be overridden by - applications. Default: _block_. + *beam*, *underline* or *hollow*. Note that this can be overridden + by applications. Default: _block_. *unfocused-style* Configures how the cursor is rendered when the terminal window is diff --git a/render.c b/render.c index cf4f303e..701cefae 100644 --- a/render.c +++ b/render.c @@ -647,6 +647,11 @@ draw_cursor(const struct terminal *term, const struct cell *cell, draw_underline_cursor(term, pix, font, &cursor_color, x, y, cols); } break; + + case CURSOR_HOLLOW: + if (likely(term->cursor_blink.state == CURSOR_BLINK_ON)) + draw_hollow_block(term, pix, &cursor_color, x, y, cols); + break; } }