vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit 0e67173989af6f7636dc681a53476a3e206060ba
parent e99c7fb772b4632236b079d05be05abb7333156b
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Tue, 20 Oct 2015 16:00:41 +0200

view: ensure minimal window size

Do not create empty windows, more importantly do not overwrite
random memory.

Closes #80

Diffstat:
Mview.c | 4++++
1 file changed, 4 insertions(+), 0 deletions(-)

diff --git a/view.c b/view.c @@ -523,6 +523,10 @@ void view_draw(View *view) { } bool view_resize(View *view, int width, int height) { + if (width <= 0) + width = 1; + if (height <= 0) + height = 1; size_t lines_size = height*(sizeof(Line) + width*sizeof(Cell)); if (lines_size > view->lines_size) { Line *lines = realloc(view->lines, lines_size);