Shift history up by 10% at a time.

This commit is contained in:
Nicholas Marriott 2007-11-26 22:18:57 +00:00
parent 14610569c8
commit c5b1fa9411
2 changed files with 25 additions and 22 deletions

View File

@ -1,5 +1,7 @@
26 November 2007 26 November 2007
* Rather than shifting up one line at a time once the history is full,
shift by 10% of the history each time. This is faster.
* Add ^A and ^E to copy mode to move to start-of-line/end-of-line. * Add ^A and ^E to copy mode to move to start-of-line/end-of-line.
24 November 2007 24 November 2007
@ -271,4 +273,4 @@
(including mutt, emacs). No status bar yet and no key remapping or other (including mutt, emacs). No status bar yet and no key remapping or other
customisation. customisation.
$Id: CHANGES,v 1.85 2007-11-26 20:36:30 nicm Exp $ $Id: CHANGES,v 1.86 2007-11-26 22:18:57 nicm Exp $

View File

@ -1,4 +1,4 @@
/* $Id: screen-display.c,v 1.7 2007-11-24 13:26:42 nicm Exp $ */ /* $Id: screen-display.c,v 1.8 2007-11-26 22:18:57 nicm Exp $ */
/* /*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -166,35 +166,36 @@ screen_display_cursor_down(struct screen *s)
void void
screen_display_scroll_region_up(struct screen *s) screen_display_scroll_region_up(struct screen *s)
{ {
u_int sy; u_int ny, sy;
/* /*
* If the region is the entire screen, this is easy-peasy. Allocate * If the region is the entire screen, this is easy-peasy. Allocate
* a new line and adjust the history size. * a new line and adjust the history size.
* XXX1 should this be done somewhere else? * XXX should this be done somewhere else?
*/ */
if (s->rupper == 0 && s->rlower == screen_last_y(s)) { if (s->rupper == 0 && s->rlower == screen_last_y(s)) {
sy = screen_size_y(s) + s->hsize; sy = screen_size_y(s) + s->hsize;
if (s->hsize == s->hlimit) { if (s->hsize == s->hlimit) {
/* /* If the limit is hit, free 10% and shift up. */
* If the limit is hit, free the first and shift ny = s->hlimit / 10;
* the whole thing up. if (ny < 1)
*/ ny = 1;
screen_free_lines(s, 0, 1); screen_free_lines(s, 0, ny);
screen_move_lines(s, 0, 1, sy - 1); screen_move_lines(s, 0, ny, sy - ny);
} else {
s->hsize++;
s->grid_data = xrealloc( s->hsize -= ny;
s->grid_data, sy + 1, sizeof *s->grid_data); sy -= ny;
s->grid_attr = xrealloc(
s->grid_attr, sy + 1, sizeof *s->grid_attr);
s->grid_colr = xrealloc(
s->grid_colr, sy + 1, sizeof *s->grid_colr);
s->grid_size = xrealloc(
s->grid_size, sy + 1, sizeof *s->grid_size);
} }
s->hsize++;
s->grid_data = xrealloc(
s->grid_data, sy + 1, sizeof *s->grid_data);
s->grid_attr = xrealloc(
s->grid_attr, sy + 1, sizeof *s->grid_attr);
s->grid_colr = xrealloc(
s->grid_colr, sy + 1, sizeof *s->grid_colr);
s->grid_size = xrealloc(
s->grid_size, sy + 1, sizeof *s->grid_size);
screen_display_make_lines(s, screen_last_y(s), 1); screen_display_make_lines(s, screen_last_y(s), 1);
return; return;
} }