Fix a bug that caused the program to enter an infinite loop when selecting

an empty line.

This closes my own PR bin/19160. Reviewed by wiz.
This commit is contained in:
jmmv 2002-12-25 19:04:27 +00:00
parent d379f66da8
commit c29a82ed73
1 changed files with 3 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: selection.c,v 1.2 2002/07/04 20:50:29 christos Exp $ */
/* $NetBSD: selection.c,v 1.3 2002/12/25 19:04:27 jmmv Exp $ */
/*
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -32,7 +32,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: selection.c,v 1.2 2002/07/04 20:50:29 christos Exp $");
__RCSID("$NetBSD: selection.c,v 1.3 2002/12/25 19:04:27 jmmv Exp $");
#endif /* not lint */
#include <sys/ioctl.h>
@ -116,7 +116,7 @@ row_length(struct mouse *m, size_t row)
if (ioctl(m->tty_fd, WSDISPLAYIO_GETWSCHAR, &ch) == -1)
warn("ioctl(WSDISPLAYIO_GETWSCHAR) failed");
ch.col--;
} while (isspace((unsigned char)ch.letter));
} while (isspace((unsigned char)ch.letter) && ch.col >= 0);
return ch.col + 2;
}