mirror of
https://github.com/tmux/tmux.git
synced 2025-04-06 16:18:48 +00:00
Change inserting and deleting lines inside the scroll region to properly clear
lines that should be inserted/deleted but not moved. Fixes problems with mutt reported by Brian Lewis, thanks.
This commit is contained in:
parent
e073441c36
commit
295879cced
14
grid-view.c
14
grid-view.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: grid-view.c,v 1.16 2009-07-09 18:04:17 nicm Exp $ */
|
/* $Id: grid-view.c,v 1.17 2009-07-09 18:04:53 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -134,13 +134,17 @@ grid_view_insert_lines(struct grid *gd, u_int py, u_int ny)
|
|||||||
void
|
void
|
||||||
grid_view_insert_lines_region(struct grid *gd, u_int rlower, u_int py, u_int ny)
|
grid_view_insert_lines_region(struct grid *gd, u_int rlower, u_int py, u_int ny)
|
||||||
{
|
{
|
||||||
|
u_int ny2;
|
||||||
|
|
||||||
GRID_DEBUG(gd, "rlower=%u, py=%u, ny=%u", rlower, py, ny);
|
GRID_DEBUG(gd, "rlower=%u, py=%u, ny=%u", rlower, py, ny);
|
||||||
|
|
||||||
rlower = grid_view_y(gd, rlower);
|
rlower = grid_view_y(gd, rlower);
|
||||||
|
|
||||||
py = grid_view_y(gd, py);
|
py = grid_view_y(gd, py);
|
||||||
|
|
||||||
grid_move_lines(gd, py + ny, py, (rlower + 1) - py - ny);
|
ny2 = rlower + 1 - py - ny;
|
||||||
|
grid_move_lines(gd, rlower + 1 - ny2, py, ny2);
|
||||||
|
grid_clear(gd, 0, py + ny2, gd->sx, ny - ny2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Delete lines. */
|
/* Delete lines. */
|
||||||
@ -163,13 +167,17 @@ grid_view_delete_lines(struct grid *gd, u_int py, u_int ny)
|
|||||||
void
|
void
|
||||||
grid_view_delete_lines_region(struct grid *gd, u_int rlower, u_int py, u_int ny)
|
grid_view_delete_lines_region(struct grid *gd, u_int rlower, u_int py, u_int ny)
|
||||||
{
|
{
|
||||||
|
u_int ny2;
|
||||||
|
|
||||||
GRID_DEBUG(gd, "rlower=%u, py=%u, ny=%u", rlower, py, ny);
|
GRID_DEBUG(gd, "rlower=%u, py=%u, ny=%u", rlower, py, ny);
|
||||||
|
|
||||||
rlower = grid_view_y(gd, rlower);
|
rlower = grid_view_y(gd, rlower);
|
||||||
|
|
||||||
py = grid_view_y(gd, py);
|
py = grid_view_y(gd, py);
|
||||||
|
|
||||||
grid_move_lines(gd, py, py + ny, (rlower + 1) - py - ny);
|
ny2 = rlower + 1 - py - ny;
|
||||||
|
grid_move_lines(gd, py, py + ny, ny2);
|
||||||
|
grid_clear(gd, 0, py + ny2, gd->sx, ny - ny2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Insert characters. */
|
/* Insert characters. */
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Id: screen-write.c,v 1.57 2009-07-09 18:04:17 nicm Exp $ */
|
/* $Id: screen-write.c,v 1.58 2009-07-09 18:04:53 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -369,6 +369,7 @@ screen_write_insertline(struct screen_write_ctx *ctx, u_int ny)
|
|||||||
if (ny == 0)
|
if (ny == 0)
|
||||||
ny = 1;
|
ny = 1;
|
||||||
|
|
||||||
|
if (s->cy < s->rupper || s->cy > s->rlower) {
|
||||||
if (ny > screen_size_y(s) - s->cy)
|
if (ny > screen_size_y(s) - s->cy)
|
||||||
ny = screen_size_y(s) - s->cy;
|
ny = screen_size_y(s) - s->cy;
|
||||||
if (ny == 0)
|
if (ny == 0)
|
||||||
@ -376,6 +377,19 @@ screen_write_insertline(struct screen_write_ctx *ctx, u_int ny)
|
|||||||
|
|
||||||
screen_write_save(ctx);
|
screen_write_save(ctx);
|
||||||
|
|
||||||
|
grid_view_insert_lines(s->grid, s->cy, ny);
|
||||||
|
|
||||||
|
tty_write_cmd(ctx->wp, TTY_INSERTLINE, ny);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ny > s->rlower + 1 - s->cy)
|
||||||
|
ny = s->rlower + 1 - s->cy;
|
||||||
|
if (ny == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
screen_write_save(ctx);
|
||||||
|
|
||||||
if (s->cy < s->rupper || s->cy > s->rlower)
|
if (s->cy < s->rupper || s->cy > s->rlower)
|
||||||
grid_view_insert_lines(s->grid, s->cy, ny);
|
grid_view_insert_lines(s->grid, s->cy, ny);
|
||||||
else
|
else
|
||||||
@ -393,6 +407,7 @@ screen_write_deleteline(struct screen_write_ctx *ctx, u_int ny)
|
|||||||
if (ny == 0)
|
if (ny == 0)
|
||||||
ny = 1;
|
ny = 1;
|
||||||
|
|
||||||
|
if (s->cy < s->rupper || s->cy > s->rlower) {
|
||||||
if (ny > screen_size_y(s) - s->cy)
|
if (ny > screen_size_y(s) - s->cy)
|
||||||
ny = screen_size_y(s) - s->cy;
|
ny = screen_size_y(s) - s->cy;
|
||||||
if (ny == 0)
|
if (ny == 0)
|
||||||
@ -400,6 +415,19 @@ screen_write_deleteline(struct screen_write_ctx *ctx, u_int ny)
|
|||||||
|
|
||||||
screen_write_save(ctx);
|
screen_write_save(ctx);
|
||||||
|
|
||||||
|
grid_view_delete_lines(s->grid, s->cy, ny);
|
||||||
|
|
||||||
|
tty_write_cmd(ctx->wp, TTY_DELETELINE, ny);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ny > s->rlower + 1 - s->cy)
|
||||||
|
ny = s->rlower + 1 - s->cy;
|
||||||
|
if (ny == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
screen_write_save(ctx);
|
||||||
|
|
||||||
if (s->cy < s->rupper || s->cy > s->rlower)
|
if (s->cy < s->rupper || s->cy > s->rlower)
|
||||||
grid_view_delete_lines(s->grid, s->cy, ny);
|
grid_view_delete_lines(s->grid, s->cy, ny);
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user