Loading ...
Sorry, an error occurred while loading the content.

First bug found in new release

Expand Messages
  • Steven Phillips
    I stumbled into a bug triggered by doing a replace-string in a buffer containing narrows. The bug should be safe in the sense that it should not blow up ME nor
    Message 1 of 1 , May 1, 2004
    • 0 Attachment
      I stumbled into a bug triggered by doing a replace-string in a buffer
      containing narrows. The bug should be safe in the sense that it should not
      blow up ME nor trash its contents but some macros may fail to operate. When
      this bug is triggered you will get one of the following 2 messages:

      [Protected line in matched string!]
      [Narrow in matched string!]

      Fix is to search.c (attached) or manually make the following changes:

      *** search.c 7 Jan 2004 00:10:06 -0000 1.21
      --- search.c 14 Apr 2004 09:25:49 -0000
      ***************
      *** 1005,1011 ****
      --- 1005,1017 ----
      return meABORT ;
      #if MEOPT_EXTENDED
      /* check that this replace is legal */
      + #if MEOPT_MAGIC
      + if(srchLastMagic)
      + i = mereRegexGroupEnd(0) ;
      + else
      + #endif
      i = slength + frameCur->windowCur->dotOffset ;
      + i += frameCur->windowCur->dotOffset ;
      if(i > meLineGetLength(frameCur->windowCur->dotLine))
      {
      meLine *lp ;

      More Information:

      I descovered the bug using jst's jst-to-html, I found that on a reasonable
      sized document the conversion failed do to its use of narrowing and string
      replacement.

      In this version of ME narrows are now safe to use, their location is correctly
      maintained, they can be sensibly cut from the buffer and... well, they just
      work!

      One of the improvments was to stop a search and replace 'cutting out' a
      narrow, e.g. if I have the text '12345678' and I narrow out '345' so I have
      '12678' (okay I know that narrow only works on lines but the principle is the
      same) if I now do a replace-string of '26' to 'help' what should happen?
      Should I be left with 1help78', '1help34578', '1345help78'... so instead me
      aborts the replace-string given the 2nd error message above.

      Also in this version a line of text can be protected (see help on
      $line-flags), this means that the line cannot be joined to another line, edits
      must either be contained to that line or remove the whole line (this feature
      is used be narrowing to create the marker lines). So a relace-string must fail
      if it crosses a protected line.

      Steve
    Your message has been successfully submitted and would be delivered to recipients shortly.