From 3f9ccbd00f04d2fd0bd297de194ea43e33729367 Mon Sep 17 00:00:00 2001 From: das Date: Sat, 28 Feb 2009 06:27:23 +0000 Subject: Make `less -R' not crash all the time. --- contrib/less/line.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'contrib/less') diff --git a/contrib/less/line.c b/contrib/less/line.c index 944e02d..11122a5 100644 --- a/contrib/less/line.c +++ b/contrib/less/line.c @@ -601,9 +601,11 @@ store_char(ch, a, rep, pos) { if (!is_ansi_end(ch) && !is_ansi_middle(ch)) { /* Remove whole unrecognized sequence. */ - do { + while (curr) { --curr; - } while (!IS_CSI_START(linebuf[curr])); + if (IS_CSI_START(linebuf[curr])) + break; + } return 0; } a = AT_ANSI; /* Will force re-AT_'ing around it. */ -- cgit v1.1