mirror of
https://github.com/tmux/tmux.git
synced 2024-12-13 01:48:47 +00:00
Move the check for whether to force a line wrapper lower down into the tty code
where it has access to the tty width, which is what should have been checked.
This commit is contained in:
parent
d1e6388fed
commit
387f4d42cc
@ -855,15 +855,15 @@ screen_write_mousemode(struct screen_write_ctx *ctx, int state)
|
|||||||
s->mode &= ~MODE_MOUSE;
|
s->mode &= ~MODE_MOUSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* Line feed. */
|
||||||
* Line feed the screen only (don't update the tty). Used for printing single
|
|
||||||
* characters, where might want to let the scroll happen naturally.
|
|
||||||
*/
|
|
||||||
void
|
void
|
||||||
screen_write_linefeedscreen(struct screen_write_ctx *ctx, int wrapped)
|
screen_write_linefeed(struct screen_write_ctx *ctx, int wrapped)
|
||||||
{
|
{
|
||||||
struct screen *s = ctx->s;
|
struct screen *s = ctx->s;
|
||||||
struct grid_line *gl;
|
struct grid_line *gl;
|
||||||
|
struct tty_ctx ttyctx;
|
||||||
|
|
||||||
|
screen_write_initctx(ctx, &ttyctx, 0);
|
||||||
|
|
||||||
gl = &s->grid->linedata[s->grid->hsize + s->cy];
|
gl = &s->grid->linedata[s->grid->hsize + s->cy];
|
||||||
if (wrapped)
|
if (wrapped)
|
||||||
@ -875,18 +875,8 @@ screen_write_linefeedscreen(struct screen_write_ctx *ctx, int wrapped)
|
|||||||
grid_view_scroll_region_up(s->grid, s->rupper, s->rlower);
|
grid_view_scroll_region_up(s->grid, s->rupper, s->rlower);
|
||||||
else if (s->cy < screen_size_y(s) - 1)
|
else if (s->cy < screen_size_y(s) - 1)
|
||||||
s->cy++;
|
s->cy++;
|
||||||
}
|
|
||||||
|
|
||||||
/* Line feed (down with scroll). */
|
|
||||||
void
|
|
||||||
screen_write_linefeed(struct screen_write_ctx *ctx, int wrapped)
|
|
||||||
{
|
|
||||||
struct tty_ctx ttyctx;
|
|
||||||
|
|
||||||
screen_write_initctx(ctx, &ttyctx, 0);
|
|
||||||
|
|
||||||
screen_write_linefeedscreen(ctx, wrapped);
|
|
||||||
|
|
||||||
|
ttyctx.num = wrapped;
|
||||||
tty_write(tty_cmd_linefeed, &ttyctx);
|
tty_write(tty_cmd_linefeed, &ttyctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -985,7 +975,6 @@ screen_write_cell(
|
|||||||
struct screen_write_ctx *ctx, const struct grid_cell *gc, u_char *udata)
|
struct screen_write_ctx *ctx, const struct grid_cell *gc, u_char *udata)
|
||||||
{
|
{
|
||||||
struct screen *s = ctx->s;
|
struct screen *s = ctx->s;
|
||||||
struct window_pane *wp = ctx->wp;
|
|
||||||
struct grid *gd = s->grid;
|
struct grid *gd = s->grid;
|
||||||
struct tty_ctx ttyctx;
|
struct tty_ctx ttyctx;
|
||||||
struct grid_utf8 gu, *tmp_gu;
|
struct grid_utf8 gu, *tmp_gu;
|
||||||
@ -1062,10 +1051,7 @@ screen_write_cell(
|
|||||||
* leave the cursor to scroll naturally, unless this is only
|
* leave the cursor to scroll naturally, unless this is only
|
||||||
* part of the screen width.
|
* part of the screen width.
|
||||||
*/
|
*/
|
||||||
if (wp->xoff != 0 || wp->sx != screen_size_x(s))
|
|
||||||
screen_write_linefeed(ctx, 1);
|
screen_write_linefeed(ctx, 1);
|
||||||
else
|
|
||||||
screen_write_linefeedscreen(ctx, 1);
|
|
||||||
s->cx = 0; /* carriage return */
|
s->cx = 0; /* carriage return */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
8
tty.c
8
tty.c
@ -713,6 +713,14 @@ tty_cmd_linefeed(struct tty *tty, const struct tty_ctx *ctx)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If this line wrapped naturally (ctx->num is nonzero), don't do
|
||||||
|
* anything - the cursor can just be moved to the last cell and wrap
|
||||||
|
* naturally.
|
||||||
|
*/
|
||||||
|
if (ctx->num && !(tty->term->flags & TERM_EARLYWRAP))
|
||||||
|
return;
|
||||||
|
|
||||||
if (ctx->ocy == ctx->orlower) {
|
if (ctx->ocy == ctx->orlower) {
|
||||||
tty_reset(tty);
|
tty_reset(tty);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user