diff --git a/ChangeLog b/ChangeLog
index df7c84f3515143d713e73d8ef59432934fae2124..cd82f194d8b8d254d73f548ea977d0c6d7467f10 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -178,6 +178,8 @@ CVS code -
   display_string()
 	- Properly handle buf[start_index]'s being a null terminator.
 	  (DLR)
+  edit_draw()
+	- Simplify the setting of paintlen. (DLR)
   titlebar()
 	- Don't display overly long filenames with ellipses if the
 	  number of columns is extremely small. (DLR)
diff --git a/src/winio.c b/src/winio.c
index c0201c5516526e70f7d8f8d7a2f5f401aadf56f1..7ab1a123a34adb659807f332d9c01ee630a2c825 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -2504,19 +2504,16 @@ void edit_draw(const filestruct *fileptr, const char *converted, int
 			endmatch.rm_eo <= startpos))
 			goto step_two;
 
-		    /* Now paint the start of fileptr. */
-		    if (end_line != fileptr)
-			/* If the start of fileptr is on a different
-			 * line from the end, paintlen is -1, meaning
-			 * that everything on the line gets painted. */
-			paintlen = -1;
-		    else
-			/* Otherwise, paintlen is the expanded location
-			 * of the end of the match minus the expanded
-			 * location of the beginning of the page. */
-			paintlen = actual_x(converted,
-				strnlenpt(fileptr->data,
-				endmatch.rm_eo) - start);
+		    /* Now paint the start of fileptr.  If the start of
+		     * fileptr is on a different line from the end,
+		     * paintlen is -1, meaning that everything on the
+		     * line gets painted.  Otherwise, paintlen is the
+		     * expanded location of the end of the match minus
+		     * the expanded location of the beginning of the
+		     * page. */
+		    paintlen = (end_line != fileptr) ? -1 :
+			actual_x(converted, strnlenpt(fileptr->data,
+			endmatch.rm_eo) - start);
 
 		    mvwaddnstr(edit, line, 0, converted, paintlen);
 
@@ -2635,17 +2632,13 @@ void edit_draw(const filestruct *fileptr, const char *converted, int
 	     * mark minus the beginning of the page. */
 	    x_start = strnlenpt(fileptr->data, top_x) - start;
 
-	    if (bot_x >= endpos)
-		/* If the end of the mark is off the page, paintlen is
-		 * -1, meaning that everything on the line gets
-		 * painted. */
-		paintlen = -1;
-	    else
-		/* Otherwise, paintlen is the expanded location of the
-		 * end of the mark minus the expanded location of the
-		 * beginning of the mark. */
-		paintlen = strnlenpt(fileptr->data, bot_x) -
-			(x_start + start);
+	    /* If the end of the mark is off the page, paintlen is -1,
+	     * meaning that everything on the line gets painted.
+	     * Otherwise, paintlen is the expanded location of the end
+	     * of the mark minus the expanded location of the beginning
+	     * of the mark. */
+	    paintlen = (bot_x >= endpos) ? -1 : strnlenpt(fileptr->data,
+		bot_x) - (x_start + start);
 
 	    /* If x_start is before the beginning of the page, shift
 	     * paintlen x_start characters to compensate, and put