mirror of
https://github.com/tmux/tmux.git
synced 2026-04-16 12:06:32 +00:00
Merge branch 'obsd-master'
This commit is contained in:
2
regsub.c
2
regsub.c
@@ -41,7 +41,7 @@ regsub_expand(char **buf, ssize_t *len, const char *with, const char *text,
|
|||||||
u_int i;
|
u_int i;
|
||||||
|
|
||||||
for (cp = with; *cp != '\0'; cp++) {
|
for (cp = with; *cp != '\0'; cp++) {
|
||||||
if (*cp == '\\') {
|
if (cp[0] == '\\' && cp[1] != '\0') {
|
||||||
cp++;
|
cp++;
|
||||||
if (*cp >= '0' && *cp <= '9') {
|
if (*cp >= '0' && *cp <= '9') {
|
||||||
i = *cp - '0';
|
i = *cp - '0';
|
||||||
|
|||||||
19
tmux.1
19
tmux.1
@@ -5797,8 +5797,13 @@ and a location suffix, one of the following:
|
|||||||
.It Li "ScrollbarSlider" Ta "the scrollbar slider"
|
.It Li "ScrollbarSlider" Ta "the scrollbar slider"
|
||||||
.It Li "ScrollbarUp" Ta "above the scrollbar slider"
|
.It Li "ScrollbarUp" Ta "above the scrollbar slider"
|
||||||
.It Li "ScrollbarDown" Ta "below the scrollbar slider"
|
.It Li "ScrollbarDown" Ta "below the scrollbar slider"
|
||||||
|
.It Li "ControlN" Ta "on control range N"
|
||||||
.El
|
.El
|
||||||
.Pp
|
.Pp
|
||||||
|
See the
|
||||||
|
.Sx STYLES
|
||||||
|
section for information on control ranges.
|
||||||
|
.Pp
|
||||||
The following mouse events are available:
|
The following mouse events are available:
|
||||||
.Bl -column "MouseDown1" "MouseDrag1" "WheelDown" -offset indent
|
.Bl -column "MouseDown1" "MouseDrag1" "WheelDown" -offset indent
|
||||||
.It Li "WheelUp" Ta "WheelDown" Ta ""
|
.It Li "WheelUp" Ta "WheelDown" Ta ""
|
||||||
@@ -6611,6 +6616,7 @@ replaces the previous saved default).
|
|||||||
.Ic range=window|X ,
|
.Ic range=window|X ,
|
||||||
.Ic range=pane|X ,
|
.Ic range=pane|X ,
|
||||||
.Ic range=user|X ,
|
.Ic range=user|X ,
|
||||||
|
.Ic range=control|N ,
|
||||||
.Ic norange
|
.Ic norange
|
||||||
.Xc
|
.Xc
|
||||||
Mark a range for mouse events in the
|
Mark a range for mouse events in the
|
||||||
@@ -6657,6 +6663,19 @@ will be available in the
|
|||||||
format variable.
|
format variable.
|
||||||
.Ql X
|
.Ql X
|
||||||
must be at most 15 bytes in length.
|
must be at most 15 bytes in length.
|
||||||
|
.Pp
|
||||||
|
.Ic range=control|N
|
||||||
|
is a set of ranges for users to define custom behavior.
|
||||||
|
.Ql N
|
||||||
|
can be 0 through 9.
|
||||||
|
When a mouse event occurs in the
|
||||||
|
.Ic range=control|N
|
||||||
|
range, the
|
||||||
|
.Ql ControlN
|
||||||
|
key binding is triggered.
|
||||||
|
See
|
||||||
|
.Sx MOUSE SUPPORT
|
||||||
|
for details.
|
||||||
.It Ic set\-default
|
.It Ic set\-default
|
||||||
Set the current colours and attributes as the default, overwriting any previous
|
Set the current colours and attributes as the default, overwriting any previous
|
||||||
default.
|
default.
|
||||||
|
|||||||
46
tty-draw.c
46
tty-draw.c
@@ -143,6 +143,14 @@ tty_draw_line(struct tty *tty, struct screen *s, u_int px, u_int py, u_int nx,
|
|||||||
log_debug("%s: px=%u py=%u nx=%u atx=%u aty=%u", __func__, px, py, nx,
|
log_debug("%s: px=%u py=%u nx=%u atx=%u aty=%u", __func__, px, py, nx,
|
||||||
atx, aty);
|
atx, aty);
|
||||||
|
|
||||||
|
/* There is no point in drawing more than the end of the terminal. */
|
||||||
|
if (atx >= tty->sx)
|
||||||
|
return;
|
||||||
|
if (atx + nx >= tty->sx)
|
||||||
|
nx = tty->sx - atx;
|
||||||
|
if (nx == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Clamp the width to cellsize - note this is not cellused, because
|
* Clamp the width to cellsize - note this is not cellused, because
|
||||||
* there may be empty background cells after it (from BCE).
|
* there may be empty background cells after it (from BCE).
|
||||||
@@ -150,19 +158,24 @@ tty_draw_line(struct tty *tty, struct screen *s, u_int px, u_int py, u_int nx,
|
|||||||
cellsize = grid_get_line(gd, gd->hsize + py)->cellsize;
|
cellsize = grid_get_line(gd, gd->hsize + py)->cellsize;
|
||||||
if (screen_size_x(s) > cellsize)
|
if (screen_size_x(s) > cellsize)
|
||||||
ex = cellsize;
|
ex = cellsize;
|
||||||
else {
|
else
|
||||||
ex = screen_size_x(s);
|
ex = screen_size_x(s);
|
||||||
if (px > ex)
|
|
||||||
return;
|
|
||||||
if (px + nx > ex)
|
|
||||||
nx = ex - px;
|
|
||||||
}
|
|
||||||
if (ex < nx)
|
|
||||||
ex = nx;
|
|
||||||
log_debug("%s: drawing %u-%u,%u (end %u) at %u,%u; defaults: fg=%d, "
|
log_debug("%s: drawing %u-%u,%u (end %u) at %u,%u; defaults: fg=%d, "
|
||||||
"bg=%d", __func__, px, px + nx, py, ex, atx, aty, defaults->fg,
|
"bg=%d", __func__, px, px + nx, py, ex, atx, aty, defaults->fg,
|
||||||
defaults->bg);
|
defaults->bg);
|
||||||
|
|
||||||
|
/* Turn off cursor while redrawing and reset region and margins. */
|
||||||
|
flags = (tty->flags & TTY_NOCURSOR);
|
||||||
|
tty->flags |= TTY_NOCURSOR;
|
||||||
|
tty_update_mode(tty, tty->mode, s);
|
||||||
|
tty_region_off(tty);
|
||||||
|
tty_margin_off(tty);
|
||||||
|
|
||||||
|
/* Start with the default cell as the last cell. */
|
||||||
|
memcpy(&last, &grid_default_cell, sizeof last);
|
||||||
|
last.bg = defaults->bg;
|
||||||
|
tty_default_attributes(tty, defaults, palette, 8, s->hyperlinks);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If there is padding at the start, we must have truncated a wide
|
* If there is padding at the start, we must have truncated a wide
|
||||||
* character. Clear it.
|
* character. Clear it.
|
||||||
@@ -195,7 +208,7 @@ tty_draw_line(struct tty *tty, struct screen *s, u_int px, u_int py, u_int nx,
|
|||||||
log_debug("%s: clearing %u padding cells", __func__, cx);
|
log_debug("%s: clearing %u padding cells", __func__, cx);
|
||||||
tty_draw_line_clear(tty, atx, aty, cx, defaults, bg, 0);
|
tty_draw_line_clear(tty, atx, aty, cx, defaults, bg, 0);
|
||||||
if (cx == ex)
|
if (cx == ex)
|
||||||
return;
|
goto out;
|
||||||
atx += cx;
|
atx += cx;
|
||||||
px += cx;
|
px += cx;
|
||||||
nx -= cx;
|
nx -= cx;
|
||||||
@@ -209,18 +222,6 @@ tty_draw_line(struct tty *tty, struct screen *s, u_int px, u_int py, u_int nx,
|
|||||||
wrapped = 1;
|
wrapped = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Turn off cursor while redrawing and reset region and margins. */
|
|
||||||
flags = (tty->flags & TTY_NOCURSOR);
|
|
||||||
tty->flags |= TTY_NOCURSOR;
|
|
||||||
tty_update_mode(tty, tty->mode, s);
|
|
||||||
tty_region_off(tty);
|
|
||||||
tty_margin_off(tty);
|
|
||||||
|
|
||||||
/* Start with the default cell as the last cell. */
|
|
||||||
memcpy(&last, &grid_default_cell, sizeof last);
|
|
||||||
last.bg = defaults->bg;
|
|
||||||
tty_default_attributes(tty, defaults, palette, 8, s->hyperlinks);
|
|
||||||
|
|
||||||
/* Loop over each character in the range. */
|
/* Loop over each character in the range. */
|
||||||
last_i = i = 0;
|
last_i = i = 0;
|
||||||
len = 0;
|
len = 0;
|
||||||
@@ -252,7 +253,7 @@ tty_draw_line(struct tty *tty, struct screen *s, u_int px, u_int py, u_int nx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Work out the the empty width. */
|
/* Work out the the empty width. */
|
||||||
if (i >= ex)
|
if (px >= ex || i >= ex - px)
|
||||||
empty = 1;
|
empty = 1;
|
||||||
else if (gcp->bg != last.bg)
|
else if (gcp->bg != last.bg)
|
||||||
empty = 0;
|
empty = 0;
|
||||||
@@ -331,6 +332,7 @@ tty_draw_line(struct tty *tty, struct screen *s, u_int px, u_int py, u_int nx,
|
|||||||
i += gcp->data.width;
|
i += gcp->data.width;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
out:
|
||||||
tty->flags = (tty->flags & ~TTY_NOCURSOR)|flags;
|
tty->flags = (tty->flags & ~TTY_NOCURSOR)|flags;
|
||||||
tty_update_mode(tty, tty->mode, s);
|
tty_update_mode(tty, tty->mode, s);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user