🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.utils.bug
Article #1265

Suspected bug with diff --side-by-side

#1265
From: Matthias Ulrich Neeracher
Date: Thu, 07 Jan 1993 00:52
48 lines
1735 bytes
Hello,

while porting GNU diff 2.0 to a Machine Whose Name I Shall Not Mention,
I noticed that diff when called with the --side-by-side option sometimes
would misalign long lines containing tabs. I managed to track it down
to the following lines; when the lines marked with "+" are added, the
problem goes away. The justification for this patch is that otherwise
in_position is updated, while out_position is not *and may still be smaller
than out_bound*.

*** oldside.c	Wed Jan  6 23:39:40 1993
--- side.c	Wed Jan  6 23:39:25 1993
***************
*** 96,115 ****
--- 96,121 ----
  		{
  		  out_position++;
  		  putc (' ', out);
  		}
  	    else
  	      if (out_position + spaces < out_bound)
  		{
  		  out_position += spaces;
  		  putc (c, out);
  		}
+ 	      else
+ 	        while (out_position < out_bound && spaces--)
+ 		  {
+ 		    out_position++;
+ 		    putc (' ', out);
+ 		  }
  	  }
  	  break;
  
  	case '\r':
  	  {
  	    putc (c, out);
  	    tab_from_to (0, indent);
  	    in_position = out_position = 0;
  	  }
  	  break;

Matthias

-----
Matthias Neeracher                                   neeri@iis.ethz.ch
   "These days, though, you have to be pretty technical before you can 
    even aspire to crudeness." -- William Gibson, _Johnny Mnemonic_
Technical Details
Message-ID: <199301062252.AA19766@yggdrasil.ethz.ch>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!iis.ethz.ch!neeri

Show Full Headers
Complete Article Headers
Newsgroups: gnu.utils.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!iis.ethz.ch!neeri
From: neeri@iis.ethz.ch (Matthias Ulrich Neeracher)
Subject: Suspected bug with diff --side-by-side
Message-ID: <199301062252.AA19766@yggdrasil.ethz.ch>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Thu, 7 Jan 1993 00:52:21 GMT
Approved: bug-gnu-utils@prep.ai.mit.edu
Lines: 49