# HG changeset patch # User Henry S. Thompson # Date 1584299324 0 # Node ID ede2551ae7d9fb5f3c991c375bc4d64974d1723a # Parent 1b9daa849b0f5c78df29f0e3bae54f83c574fe99 red-formatting fixed, margins improved, cols 3&4 not being filled in, why? diff -r 1b9daa849b0f -r ede2551ae7d9 nono.py --- a/nono.py Sun Mar 15 17:05:49 2020 +0000 +++ b/nono.py Sun Mar 15 19:08:44 2020 +0000 @@ -187,13 +187,15 @@ # New blob at pos, can we complete anything? # Assuming @@ FTTB that it's never possible to definitively complete a # non-marginal run, which is wrong if the length is unique and it's bounded... + start0=0 if self.margin0==0 else self.margin0+1 + startN=self.marginN if (self.marginN==self.n-1) else self.marginN-1 changed=False # First, find our boundaries: s=pos # start index of our run - while s>self.margin0 and self[s-1].val is True: + while s>start0 and self[s-1].val is True: s-=1 f=pos # finish index of our run - while f'%(str(self.__class__.__name__)[0],s,f,l,self.runs,self)) @@ -204,14 +206,14 @@ return if self.runs[0]==l: # is it safely left marginal, i.e. no blobs or big enough gaps before us? - if self.marginal(range(self.margin0,s),l): + if self.marginal(range(start0,s),l): changed=True dprint('n1') # mark our margins - for i in range(self.margin0+1,s): + for i in range(start0,s): if self[i].val is None: self[i].setVal(False) - if fself.margin0+1: + if s>start0: if self[s-1].val is None: self[s-1].setVal(False) self.foundN(s) # pull in the finish margin at least to s-2 @@ -292,7 +294,7 @@ if maxWidth is None: # update if pre: - self.infix+=(RedFmt%r)+" " + self.infix+=(RedFmt%r)+(" " if self.runs else "") else: # post self.suffix=" "+RedFmt%r+self.suffix @@ -323,7 +325,7 @@ if pre: for rc in str(r): self.infix.append(RedFmt%rc) - self.infix.append("-") + self.infix.append("-" if self.runs else "") else: # post ins=["-"]