mirror of
https://github.com/tmux/tmux.git
synced 2026-04-16 12:06:32 +00:00
Add some new mouse ranges called "control0" to "control9", will be used
for controls on floating panes, from Dane Jensen, with some bits from Michael Grant.
This commit is contained in:
47
style.c
47
style.c
@@ -137,6 +137,15 @@ style_parse(struct style *sy, const struct grid_cell *base, const char *in)
|
||||
sy->range_type = STYLE_RANGE_RIGHT;
|
||||
sy->range_argument = 0;
|
||||
style_set_range_string(sy, "");
|
||||
} else if (strcasecmp(tmp + 6, "control") == 0) {
|
||||
if (found == NULL)
|
||||
goto error;
|
||||
n = strtonum(found, 0, 9, &errstr);
|
||||
if (errstr != NULL)
|
||||
goto error;
|
||||
sy->range_type = STYLE_RANGE_CONTROL;
|
||||
sy->range_argument = n;
|
||||
style_set_range_string(sy, "");
|
||||
} else if (strcasecmp(tmp + 6, "pane") == 0) {
|
||||
if (found == NULL)
|
||||
goto error;
|
||||
@@ -426,8 +435,10 @@ style_copy(struct style *dst, struct style *src)
|
||||
memcpy(dst, src, sizeof *dst);
|
||||
}
|
||||
|
||||
/* Set scrollbar style from an option. */
|
||||
void
|
||||
style_set_scrollbar_style_from_option(struct style *sb_style, struct options *oo)
|
||||
style_set_scrollbar_style_from_option(struct style *sb_style,
|
||||
struct options *oo)
|
||||
{
|
||||
struct style *sy;
|
||||
|
||||
@@ -446,3 +457,37 @@ style_set_scrollbar_style_from_option(struct style *sb_style, struct options *oo
|
||||
utf8_set(&sb_style->gc.data, PANE_SCROLLBARS_CHARACTER);
|
||||
}
|
||||
}
|
||||
|
||||
/* Initialize style ranges. */
|
||||
void
|
||||
style_ranges_init(struct style_ranges *srs)
|
||||
{
|
||||
TAILQ_INIT(srs);
|
||||
}
|
||||
|
||||
/* Free style ranges. */
|
||||
void
|
||||
style_ranges_free(struct style_ranges *srs)
|
||||
{
|
||||
struct style_range *sr, *sr1;
|
||||
|
||||
TAILQ_FOREACH_SAFE(sr, srs, entry, sr1) {
|
||||
TAILQ_REMOVE(srs, sr, entry);
|
||||
free(sr);
|
||||
}
|
||||
}
|
||||
|
||||
/* Get range for position from style ranges. */
|
||||
struct style_range *
|
||||
style_ranges_get_range(struct style_ranges *srs, u_int x)
|
||||
{
|
||||
struct style_range *sr;
|
||||
|
||||
if (srs == NULL)
|
||||
return (NULL);
|
||||
TAILQ_FOREACH(sr, srs, entry) {
|
||||
if (x >= sr->start && x < sr->end)
|
||||
return (sr);
|
||||
}
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user