Re: [BLACKBOX] AW: [BLACKBOX] Modified DevSearch

From: [at]} <Alexander>
Date: Sat, 7 Feb 2009 00:37:50 +0600

----boundary-LibPST-iamunique-374742166_-_-
Content-type: text/plain

Hello!

ZH> I did not care about spaces highlighting or not. I forgot to mention that

ZH> red is wrong highlighting
ZH> blue is correct highlighting

ZH> In the first example the red word INC(n) is wrong highlighting
ZH> with your version and correct not highlighting with the original version.

  Unfortunately, whitespace sensitivity is exactly what matters in
  this case. The text comparison works as follows:
  1. you compare two texts character by character from a certain
  point, and while the characters match, you see there is no
  difference;
  2. once you found a mismatching pair of characters, you see that the
  texts are different, and you've found the start of the changed
  place;
  3. you need to find the end of the changed place. How to do it?
  DevSearch starts looking for a matching piece of text 32 characters
  long (see DevSearch.compMatchSize constant). Once such a piece is
  found, it thinks that the changed part ends before the matching
  piece and sets the highlighting according to the found boundaries.

  In the first code sample a space character after "INC(n)" was
  replaced with EOL character. The old DevSearch version did not
  distinguish the two, so it considered the "INC(n)" to be a part of
  non-modified stretch of text. My whitespace-sensitive version of
  DevSearch sees the difference, so the 32-character match is broken
  and must be sought for after the "INC(n)".

  If you set DevSearch.compMatchSize = Length("INC(n)") = 6, then you
  will see that the highlighting is "fixed". But you may then witness
  the mess it does with the second code sample comparison.

  Clearly, the default DevSearch.compMatchSize = 32 is an arbitrary
  number, and it is impossible to make it fit all cases: setting it
  too small will make it find many small differences where there is
  actually only one big, and setting it too big will make it unite
  several medium changes into a huge one.

  I can make whitespace sensitivity an option, e.g. exported as a
  BOOLEAN variable to be changed by tools like Josef Templ's custom
  Config module. The default setting could be the old behaviour.

ZH> The second sample is showing twice:
ZH> First one: the wrong combination of your version in red
ZH> Second one: the right combination of the original version in blue.

ZH> I hope that helps

  Indeed it does.

  The second sample is just another one of those "on the edge" cases,
  where whitespace consideration triggers the change. You see, the
  piece of text "THEN INC(i); j := (j + 1) MOD maxPat" (which is
  present both in the comment and after it) is 36 characters long if
  you COUNT space characters, and 28 if you DON'T. One of the numbers
  is above the DevSearch.compMatchSize limit, the other is below. That
  makes the difference, and shows how arbitrary the "32" value
  actually is.

---=====---
 Alexander


----
To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy----boundary-LibPST-iamunique-374742166_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzcyBBcmlhbDt9DQp7XGYxXGZtb2Rlcm4gQ291cmllciBOZXc7fQ0Ke1xmMlxmbmlsXGZjaGFy
c2V0MiBTeW1ib2w7fQ0Ke1xmM1xmbW9kZXJuXGZjaGFyc2V0MCBDb3VyaWVyIE5ldzt9fQ0Ke1xj
b2xvcnRibFxyZWQwXGdyZWVuMFxibHVlMDtccmVkMFxncmVlbjBcYmx1ZTI1NTt9DQpcdWMxXHBh
cmRccGxhaW5cZGVmdGFiMzYwIFxmMFxmczIwIEhlbGxvIVxwYXINClxwYXINClpIPiBJIGRpZCBu
b3QgY2FyZSBhYm91dCBzcGFjZXMgaGlnaGxpZ2h0aW5nIG9yIG5vdC4gSSBmb3Jnb3QgdG8gbWVu
dGlvbiB0aGF0XHBhcg0KXHBhcg0KWkg+ICAgICAgICAgcmVkIGlzIHdyb25nIGhpZ2hsaWdodGlu
Z1xwYXINClpIPiAgICAgICAgIGJsdWUgaXMgY29ycmVjdCBoaWdobGlnaHRpbmdccGFyDQpccGFy
DQpaSD4gSW4gdGhlIGZpcnN0IGV4YW1wbGUgdGhlIHJlZCB3b3JkIElOQyhuKSBpcyB3cm9uZyBo
aWdobGlnaHRpbmdccGFyDQpaSD4gd2l0aCB5b3VyIHZlcnNpb24gYW5kIGNvcnJlY3Qgbm90IGhp
Z2hsaWdodGluZyB3aXRoIHRoZSBvcmlnaW5hbCB2ZXJzaW9uLlxwYXINClxwYXINCiAgVW5mb3J0
dW5hdGVseSwgd2hpd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bnNpZGVyYXRpb24gdHJpZ2dlcnMgdGhl
IGNoYW5nZS4gWW91IHNlZSwgdGhlXHBhcg0KICBwaWVjZSBvZiB0ZXh0ICJUSEVOIElOQyhpKTsg
aiA6PSAoaiArIDEpIE1PRCBtYXhQYXQiICh3aGljaCBpc1xwYXINCiAgcHJlc2VudCBib3RoIGlu
IHRoZSBjb21tZW50IGFuZCBhZnRlciBpdCkgaXMgMzYgY2hhcmFjdGVycyBsb25nIGlmXHBhcg0K
ICB5b3UgQ09VTlQgc3BhY2UgY2hhcmFjdGVycywgYW5kIDI4IGlmIHlvdSBET04nVC4gT25lIG9m
IHRoZSBudW1iZXJzXHBhcg0KICBpcyBhYm92ZSB0aGUgRGV2U2VhcmNoLmNvbXBNYXRjaFNpemUg
bGltaXQsIHRoZSBvdGhlciBpcyBiZWxvdy4gVGhhdFxwYXINCiAgbWFrZXMgdGhlIGRpZmZlcmVu
Y2UsIGFuZCBzaG93cyBob3cgYXJiaXRyYXJ5IHRoZSAiMzIiIHZhbHVlXHBhcg0KICBhY3R1YWxs
eSBpcy5ccGFyDQpccGFyDQotLS09PT09PS0tLVxwYXINCiBBbGV4YW5kZXJccGFyDQpccGFyDQpc
cGFyDQotLS0tXHBhcg0KVG8gdW5zdWJzY3JpYmUsIHNlbmQgYSBtZXNzYWdlIHdpdGggYm9keSAi
U0lHTk9GRiBCTEFDS0JPWCIgdG8gTElTVFNFUlZATElTVFMuT0JFUk9OLkNIXHBhcg0KfQ==
----boundary-LibPST-iamunique-374742166_-_---
Received on Fri Feb 06 2009 - 19:37:50 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:30:49 UTC