Sublime Forum

SublimeFileDiffs gives unexisting differences

#1

I’m trying to find out why SublimeFileDiffs is giving me unexisting difference when copying content from a hard-disk file to a Sublime temporal view, please take a look:

showcase

As you can see in the demo, diffing between 2 temporal views will give no differences while if I try to diff between the file vs the temporal view I’ll get “unexisting” differences. Why is that? And the most important… how can i fix the behaviour?

Current installed version v2.8.0

0 Likes

#2

The problem was produced because I was using on my settings:

"translate_tabs_to_spaces": true,
"trim_trailing_white_space_on_save": true,

The original file contained tabs and when you copy this content to a new temporal view the tabs will be converted to spaces… not sure if this is the intended Sublime behaviour or a bug though :confused:

0 Likes

#3

I assume that’s intended behaviour because that setting controls what happens when a tab character is inserted into the buffer. For example, with it turned on, view.run_command("append", {"characters": "\t"}) inserts spaces and not a tab.

If you want to copy the data from one view into another one and have it be identical you probably need to ensure that the values of these settings in the source buffer is copied to the destination view before you do the paste so that the data is treated the same way.

0 Likes