diff -ur wdiff-1.1.2.orig/src/wdiff.c wdiff-1.1.2/src/wdiff.c
--- wdiff-1.1.2.orig/src/wdiff.c	2012-05-30 12:56:57 +0400
+++ wdiff-1.1.2/src/wdiff.c	2012-08-26 21:01:39 +0400
@@ -159,6 +159,7 @@
   int character;		/* one character look ahead */
   char *temp_name;		/* temporary file name */
   FILE *temp_file;		/* temporary file */
+  int wordkind;                 /* kind of the word; 0 - space; 1 - word; 2 - unknown */
 };
 SIDE side_array[2];		/* area for holding side descriptions */
 SIDE *left_side = &side_array[0];
@@ -362,53 +363,80 @@
 }
 
 /*--------------------------------.
-| Skip over white space on SIDE.  |
+| Skip over a word on SIDE.  |
 `--------------------------------*/
 
 static void
-skip_whitespace (SIDE * side)
+skip_a_word (SIDE * side)
 {
   if (interrupted)
     longjmp (signal_label, 1);
 
-  while (isspace (side->character))
-    side->character = getc (side->file);
-}
-
-/*------------------------------------.
-| Skip over non white space on SIDE.  |
-`------------------------------------*/
-
-static void
-skip_word (SIDE * side)
-{
-  if (interrupted)
-    longjmp (signal_label, 1);
-
-  while (side->character != EOF && !isspace (side->character))
+  while (side->character != EOF)
+  {
+    int sp;
+    int eol;
     side->character = getc (side->file);
+    /* 0x0d0a - skip 0x0d */
+    if (side->character == '\r')
+      side->character = getc (side->file);
+    sp = isspace (side->character);
+    eol = side->character == '\n';
+    if (eol)
+    {
+      side->wordkind = 2;
+      side->position++;
+      break;
+    }
+    if (side->wordkind == 2)
+    {
+      side->wordkind = sp ? 0 : 1;
+      break;
+    }
+    else if (side->wordkind == 0 && !sp)
+    {
+      side->wordkind = 1;
+      break;
+    }
+    else if (side->wordkind == 1 && sp)
+    {
+      side->wordkind = 0;
+      break;
+    }
+  }
   side->position++;
 }
 
 /*-------------------------------------.
-| Copy white space from SIDE to FILE.  |
+| Copy a word from SIDE to FILE.  |
 `-------------------------------------*/
 
 static void
-copy_whitespace (SIDE * side, FILE * file)
+copy_a_word (SIDE * side, FILE * file)
 {
   if (interrupted)
     longjmp (signal_label, 1);
 
-  while (isspace (side->character))
+  while (side->character != EOF)
     {
+      int sp;
+      int eol;
 
+      if (side->wordkind == 2)
+      {
+        sp = isspace (side->character);
+        side->wordkind = sp ? 0 : 1;
+      }
       /* While changing lines, ensure we stop any special display prior
          to, and restore the special display after.  When copy_mode is
          anything else than COPY_NORMAL, file is always output_file.  We
          care underlining whitespace or overstriking it with itself,
          because "less" understands these things as emphasis requests.  */
+      /* In printer mode, act according to copy_mode.  If copy_mode is not
+         COPY_NORMAL, we know that file is necessarily output_file.  */
 
+      if (side->wordkind == 0)
+      {
       switch (copy_mode)
 	{
 	case COPY_NORMAL:
@@ -469,29 +497,9 @@
 	    putc (side->character, output_file);
 	  break;
 	}
-
-      /* Advance to next character.  */
-
-      side->character = getc (side->file);
-    }
-}
-
-/*-----------------------------------------.
-| Copy non white space from SIDE to FILE.  |
-`-----------------------------------------*/
-
-static void
-copy_word (SIDE * side, FILE * file)
-{
-  if (interrupted)
-    longjmp (signal_label, 1);
-
-  while (side->character != EOF && !isspace (side->character))
-    {
-
-      /* In printer mode, act according to copy_mode.  If copy_mode is not
-         COPY_NORMAL, we know that file is necessarily output_file.  */
-
+      }
+      else
+      {
       if (overstrike)
 	switch (copy_mode)
 	  {
@@ -519,8 +527,31 @@
 	  }
       else
 	putc (side->character, file);
+      }
 
+      /* Advance to next character.  */
       side->character = getc (side->file);
+      /* 0x0d0a - skip 0x0d */
+      if (side->character == '\r')
+        side->character = getc (side->file);
+      sp = isspace (side->character);
+      eol = side->character == '\n';
+      if (eol)
+      {
+        side->wordkind = 2;
+        side->position++;
+        break;
+      }
+      if (side->wordkind == 0 && !sp)
+      {
+        side->wordkind = 1;
+        break;
+      }
+      else if (side->wordkind == 1 && sp)
+      {
+        side->wordkind = 0;
+        break;
+      }
     }
   side->position++;
 }
@@ -695,6 +726,7 @@
 	}
     }
   side->character = getc (side->file);
+  side->wordkind = 2;
   side->position = 0;
 
   if ((side->temp_name = create_template_filename ()) == NULL)
@@ -713,10 +745,9 @@
       if (interrupted)
 	longjmp (signal_label, 1);
 
-      skip_whitespace (side);
       if (side->character == EOF)
 	break;
-      copy_word (side, side->temp_file);
+      copy_a_word (side, side->temp_file);
       putc ('\n', side->temp_file);
     }
   fclose (side->temp_file);
@@ -809,8 +840,7 @@
 {
   while (side->position < ordinal)
     {
-      skip_whitespace (side);
-      skip_word (side);
+      skip_a_word (side);
     }
 }
 
@@ -823,8 +853,7 @@
 {
   while (side->position < ordinal)
     {
-      copy_whitespace (side, output_file);
-      copy_word (side, output_file);
+      copy_a_word (side, output_file);
     }
 }
 
@@ -842,10 +871,12 @@
 
   rewind (left_side->file);
   left_side->character = getc (left_side->file);
+  left_side->wordkind = 2;
   left_side->position = 0;
 
   rewind (right_side->file);
   right_side->character = getc (right_side->file);
+  right_side->wordkind = 2;
   right_side->position = 0;
 
   /* Process diff output.  */
@@ -940,9 +971,8 @@
 
 	  if ((directive == 'd' || directive == 'c') && !inhibit_left)
 	    {
-	      copy_whitespace (left_side, output_file);
 	      start_of_delete ();
-	      copy_word (left_side, output_file);
+	      copy_a_word (left_side, output_file);
 	      copy_until_ordinal (left_side, argument[1]);
 	      end_of_delete ();
 	    }
@@ -958,9 +988,8 @@
 	      }
 	    else
 	      {
-		copy_whitespace (right_side, output_file);
 		start_of_insert ();
-		copy_word (right_side, output_file);
+	        copy_a_word (right_side, output_file);
 		copy_until_ordinal (right_side, argument[3]);
 		end_of_insert ();
 	      }
@@ -981,12 +1010,12 @@
   else if (!inhibit_left && inhibit_right)
     {
       copy_until_ordinal (left_side, count_total_left);
-      copy_whitespace (left_side, output_file);
+      copy_a_word (left_side, output_file);
     }
   else
     {
       copy_until_ordinal (right_side, count_total_right);
-      copy_whitespace (right_side, output_file);
+      copy_a_word (right_side, output_file);
     }
 
   /* Close input files.  */
