config+render: allow cursor.style=hollow

Closes #1965
This commit is contained in:
Daniel Eklöf 2025-02-19 11:44:38 +01:00
parent 101bc28698
commit c41008da31
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
5 changed files with 11 additions and 4 deletions

View file

@ -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

View file

@ -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);
}

View file

@ -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,

View file

@ -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

View file

@ -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;
}
}