No announcement yet.

Text compare doesn't restore proper order when saving changes to files

  • Filter
  • Time
  • Show
Clear All
new posts

  • Text compare doesn't restore proper order when saving changes to files

    When I compare 2 text files, I'm not sure why but the compare process doesn't seem to be working correctly. What I think should, or should I say, what I need to be happening, is for the left side to stay stationary, and the right side should show changes made relative to the left side file (i.e. additions, changes, deletes).

    However, what I am seeing is that both sides seem to be sorted in some way, but not necessarily in alphabetical order, and when changes are made and either files are saved, they are written as I see them in the comparison, with no comments and in unsorted order.

    1. Am I missing something?
    2. Should I be selecting a different comparison type?

    The problems I am seeing are mostly related to .ini or .txt files, and as long as the comments were sorted with the related sections, that would be at least acceptable. However if, for instance, I were comparing an old and new (updated) version of a program, trying to find the change that was now causing a particular error, clicking on a section of code from the older version and telling it to overwrite the same section in the newer one would wreak havoc, as the saved output would have all the statements out of order and all comments removed, rendering the entire program useless.

    I have been a long time customer and use BC4 mostly for comparing directory structures. I don't have a lot of time and have just lived with this, mostly because I have found it hard to figure out what the program is doing, what it is supposed to do, and how to describe the problem. Because I can't figure out how to make the text comparisons save files in the original order, I usually end up manually comparing text files, only using BC4 to show me where changes are, but not allowing it to make the corrections I need.

    Fortunately I have multiple monitors, so I have just been doing the comparison on 1 monitor, and making corrections to the real file I want to change on another monitor. However, this shouldn't be necessary and is very time consuming. Can someone please tell me how to accomplish what I need, or if it is even possible.

    Just an FYI, I follow a strict rule, the source file (i.e. what you consider "correct" or "unchangeable") should always be on the left (no changes except under special circumstances) and the target file (i.e. the one that is going to be changed) is always on the right (i.e. reading order). Likewise, I have always assumed that, like in my programming analogy, the left side is always is the "reference" file and should always be displayed in its original (i.e. proper) order, and the right side may or may not be, since, with a program, it is not uncommon to add, change, move or delete sections of code around. This is especially true of functions and/or subroutines.

    However, even though the location and/or order that functions and subroutines appear may change, the order of the main processing code generally stays the same. I hope this makes sense.

  • #2

    Beyond Compare can load and compare files in either the original file order (unsorted) or in a sorted order (sorted). Any save performed will save the file as is on the screen, so a sorted file is then saved sorted.

    Most of our default file formats are unsorted. If you have any installed from the website, these might be sorted or tidied. You can check the name of the currently loaded file format in the upper status bar above each file pane. If you then look at that file format in the Tools menu -> File Format dialog, the Conversion tab would show if any conversion (sorting) is taking place.

    Some conversions do not sort, such as our PDF conversion, which is translating the file from PDF to plain text for the compare. Other formats, like our XML Tidied or Sorted, would be sorting the file.

    If you are still having any trouble determining which formats are running and if they are sorting, please email us at [email protected] with
    - a fullscreen screenshot of the comparison
    - your from the Help menu -> Support, Export
    - a pair of sample files (from the screenshot)
    - a link back to this forum thread for our reference.
    Aaron P Scooter Software


    • #3
      I'm sorry I haven't gotten back to you before now but, as I mentioned, I am terribly busy, especially this time of year. I wanted to let you know I figured out the issue, based on my poking around and your thoughts. It seems that ".ini" file comparisons are "Sorted" by default, to I just have to change the "type" to "Everything else" and it works fine.

      I still believe there is a problem with the "ini (Sorted)" type, because it does remove comments before sorting, and saving the resulting file means the comments are stripped out. I am confused why they are removed (though it wouldn't really be meaningful), and why they aren't returned to the file when it is then saved but, it doesn't seem to do this if I change the type to "Everything else", so I am somewhat happy.

      Is there a way to change the association so that "ini" files are compared as a "text" file?


      • #4

        The a fresh install of Beyond Compare 4 has a format titled Registry Dumps, associated with .ini files and does not sort by default. We also have INI Sorted as a download on our website. When installed, the new format is placed higher on the priority list in the Tools menu -> File Formats dialog, but you can reorder the list to make either format the default. I would recommend moving your INI Sorted format lower in the list until it is below the Registry Dump format.
        Aaron P Scooter Software


        • #5
          Originally posted by Aaron View Post
          I would recommend moving your INI Sorted format lower in the list until it is below the Registry Dump format.
          Thank you. I actually started to do that, and it is cool, but then, I thought about it and determined that there is no reason for me to have a file format laying around that I don't want to use, so I deleted the add-on one. To tell you the truth, I am used to making sure that I have everything offered for all programs I own, just in case I should ever need them. However, this is 1 case where I shouldn't have done that because I didn't think it would interfere with another format and I'm pretty sure I would never need more than what the product comes with.

          Thank you for your comments though. They have been "Spot On" and much appreciated, as well as your timely responses and in-depth knowledge of the product. I recommend it all the time.


          • #6
            In case it helps, you can always delete the formats you don't need, or uncheck the item to prevent it from being auto-selected. If the Mask (*.ini) is red, this would indicate that there is a format higher in the list already matching on *.ini.
            Aaron P Scooter Software