user3423907
user3423907

Reputation:

git patch shows tab but file shows space

Git patch:

+#define SECT_4K                        BIT(0)
+#define E_FSR                  BIT(1)
+#define SST_WR                 BIT(2)
+#define WR_QPP                 BIT(3)

File:

#define SECT_4K                 BIT(0)
#define E_FSR                   BIT(1)
#define SST_WR                  BIT(2)
#define WR_QPP                  BIT(3)

The problem I've observed is when I edited the file on SECT_4K line it took 3 tabs to move BIT(0) in proper line, out of 3 tabs the when I did tab on first time it moves only space(not tab space) and then it moves two tabs positions correctly. ie the reason I have 3 tabs on git file and BIT(0) moved. I'm using vim editor and don't have any setting on ~/.vimrc file.

Upvotes: 0

Views: 195

Answers (1)

Vampire
Vampire

Reputation: 38669

I think both show tabs, and you just misinterpret what you are seeing.
Your tab size is configured to be 8 characters.
#define SECT_4K are 15 characters, so pressing Tab will move to character 16, again to 24, again to 32.

In the diff output, there is one more additional character in the beginning, the +, so +#define SECT_4K now has 16 characters, the first tab will move to 24, the second to 32 and the third to 40.

If you change your tab size, it will display differently. But ultimately I'd say everything is ok and you just misinterpret the output.

Upvotes: 1

Related Questions