Announcement

Collapse
No announcement yet.

Can't ignore whitespace

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Can't ignore whitespace

    I'm having trouble with a simple 2-way text compare. In the Rules -> Importance dialog, I have Leading, Embedded, and Trailing whitespace all unchecked. The only box that is checked is "Everything else". The two files are identical except for one indented line. I would expect this to be an unimportant change, but it gets flagged as important. The line comparison shows that BC3 is flagging several characters elsewhere on the line as being different, even though they're the same.

    The text files and a screen capture are attached. It may matter that I'm running this on a Mac via Wine, but I don't have a Windows machine handy to test it on.

    BC3 Version 3.3.1 (build 13971)

  • #2
    Hello,

    It looks like the whitespace is correctly marked as unimportant; the only red text appears to be the "sit" on the right side. On Windows, your files correctly identify as equal and the whitespace is ignored.

    In the Line Details area, if you right click and switch from Aligned to Hex, are the hex values of "sit" different when viewing these files on your Z:\ drive?
    Aaron P Scooter Software

    Comment


    • #3
      When I switch the line details to hex I see that those bytes have the same values in both lines. They're colored red, though, as if they were different.

      If it's working under Windows I'm willing to chalk it up to just another Wine incompatibility. And I'll put in another plea for a Mac version!

      Comment


      • #4
        Oh, now this is interesting. You can see in my first screenshot that I had a custom grammar element called "Timestamp", which was disabled. When I delete that element rather than simply disabling it, BC3 shows the leading whitespace as an unimportant change just as expected.

        The timestamp element was a regex anchored at the beginning of the line which I had made to help me compare log files. If I change the regex to remove the leading '^' the whitespace is also shown as unimportant.

        It looks like there's some unfortunate interaction between ignoring leading whitespace and anchored regex grammar elements, even when the grammar element is disabled.

        Comment


        • #5
          Would it be possible for you to re-create that grammar, reproduce the problem, and email us your Support package (Help menu -> Support; Export) to [email protected] ? I'd like to try testing with your regex in place. Please also include a link back to this forum thread for our reference.
          Aaron P Scooter Software

          Comment


          • #6
            Done. Feel free to contact me if there's anything else you need.

            Comment


            • #7
              Thanks. That helped me figure out what is happening.

              Your grammar element is: ^.......... with exactly 10 . characters. This would include the whitespace at the front of the line. So on one side, this matches with the "ips" characters, and on the other side it does not reach them because the beginning whitespace takes up the first few . matches.

              When two different grammar elements align, they are considered a difference. For example, a "String" compared to the word String without quotes would come up as a difference when comparing code that defines String as " to ", since they are not matching grammar types. In this instance, the left "ips" characters are part of the grammar and are marked as unimportant, but the right side is a different grammar element (default text), and default text is considered Important.

              Does that help clear up the behavior you are running into?
              Aaron P Scooter Software

              Comment


              • #8
                I understand why it would show as an important difference with the grammar turned on, but with it off (unchecked) shouldn't that grammar element be ignored completely?

                Comment


                • #9
                  There isn't a way to "turn off" a grammar element other than by removing it from the file format. A grammar element can be marked as important or unimportant, but unimportant doesn't mean that it doesn't exist. If a grammar rule causes other text to mis-align it doesn't matter if it is important or not. What matters is whether the mis-aligned text represents an important or an unimportant difference.

                  That being said, I think it would be helpful to be able to disable and enable grammar rules in a file format. If it isn't already on the customer wish list, perhaps it should be...
                  BC v4.0.7 build 19761
                  ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

                  Comment


                  • #10
                    Hello,

                    Thanks for the suggestion. Unchecked items are unchecked in the Importance tab, which sets if they are important or not, and does not determine if they are enabled or not.

                    An alternative to deleting the grammar entirely is to create a Clone of the file format and delete the grammar from the clone. You can then easily switch between file formats (on either side or both sides) in the Tex Compare.

                    Revisiting how grammars work is definitely on our radar.
                    Aaron P Scooter Software

                    Comment

                    Working...
                    X