19393a
--- less-394/line.c.search	2005-12-03 21:20:32.000000000 +0100
19393a
+++ less-394/line.c	2006-02-15 11:23:25.308694376 +0100
19393a
@@ -1125,6 +1125,14 @@
19393a
 				break;
19393a
 			}
19393a
 		}
19393a
+		if (c == '\0')
19393a
+		{
19393a
+			/* 
19393a
+			 * Pretend the line ended here
19393a
+			 */
19393a
+			new_pos = ch_tell();
19393a
+			break;
19393a
+		}
19393a
 		linebuf[n++] = c;
19393a
 		c = ch_forw_get();
19393a
 	}
19393a
@@ -1198,6 +1206,14 @@
19393a
 				*to = *fm;
19393a
 			n = size_linebuf - old_size_linebuf;
19393a
 		}
19393a
+		if (c == '\0')
19393a
+		{
19393a
+			/*
19393a
+			 * Pretend the line ended here
19393a
+			 */
19393a
+			new_pos = ch_tell() + 1;
19393a
+			break;
19393a
+		}
19393a
 		linebuf[--n] = c;
19393a
 	}
19393a
 	if (linep != NULL)