summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ring.c8
-rw-r--r--src/ring.h2
-rw-r--r--src/vte-private.h1
3 files changed, 7 insertions, 4 deletions
diff --git a/src/ring.c b/src/ring.c
index af530d7..eaf5bd8 100644
--- a/src/ring.c
+++ b/src/ring.c
@@ -451,6 +451,7 @@ _vte_ring_chunk_new_compact (guint start)
chunk->base.offset = chunk->base.start = chunk->base.end = start;
chunk->base.mask = (guint) -1;
chunk->base.array = chunk->p.rows;
+
chunk->bytes_left = chunk->total_bytes;
chunk->cursor = chunk->p.data + chunk->bytes_left;
@@ -522,7 +523,8 @@ _vte_ring_chunk_init_writable (VteRingChunk *chunk)
chunk->type = VTE_RING_CHUNK_TYPE_WRITABLE;
chunk->offset = 0;
- chunk->mask = 63;
+ /* Allocate min of 512 and VTE_SCROLLBACK_INIT */
+ chunk->mask = MIN (512, (1 << g_bit_storage (VTE_SCROLLBACK_INIT - 1))) - 1;
chunk->array = g_malloc0 (sizeof (chunk->array[0]) * (chunk->mask + 1));
}
@@ -535,7 +537,7 @@ _vte_ring_chunk_fini_writable (VteRingChunk *chunk)
for (i = 0; i <= chunk->mask; i++)
_vte_row_data_fini (&chunk->array[i]);
- g_free(chunk->array);
+ g_free (chunk->array);
chunk->array = NULL;
}
@@ -622,7 +624,7 @@ _vte_ring_validate (VteRing * ring)
void
_vte_ring_init (VteRing *ring, guint max_rows)
{
- ring->max = MAX(max_rows, 2);
+ ring->max = MAX (max_rows, 2);
ring->tail = ring->cursor = ring->head;
diff --git a/src/ring.h b/src/ring.h
index 3205560..36a7f6b 100644
--- a/src/ring.h
+++ b/src/ring.h
@@ -29,6 +29,8 @@
G_BEGIN_DECLS
+#define VTE_SCROLLBACK_INIT 100
+
#define VTE_DEF_FG 256
#define VTE_DEF_BG 257
#define VTE_BOLD_FG 258
diff --git a/src/vte-private.h b/src/vte-private.h
index 2c3bc65..dbf43b4 100644
--- a/src/vte-private.h
+++ b/src/vte-private.h
@@ -64,7 +64,6 @@ G_BEGIN_DECLS
/* More color defines in ring.h */
#define VTE_SATURATION_MAX 10000
-#define VTE_SCROLLBACK_INIT 100
#define VTE_DEFAULT_CURSOR GDK_XTERM
#define VTE_MOUSING_CURSOR GDK_LEFT_PTR
#define VTE_TAB_MAX 999