How do I get Beyond Compare to Ignore non text characters - visual-studio

My problem is twofold. I'm using Beyond Compare integrated with Visual Studio 2015 as my Compare/Merge tool. While looking at my list of 'Pending Changes', I see a file which if I 'Right Click -> Source Control -> Compare with Latest Version', I can see no differences in the text compare as you can see below:
However, if I do a hex compare of the same, I get the following result:
I can see it's somehow gotten the EF BB BF at the starting and the Beyond Compare notes this difference with a red bar in the left side window.
On other occasions, I've seen files in 'Pending Changes' with 0d0a at the end which is apparently for a newline character but again Beyond Compare doesn't show this as a difference in Text Compare (I've seen Git GUi show it as a difference in the past).
How can I get Beyond Compare to ignore changes like these that don't show up in the Text Compare when it considers a particular file as a 'pending change' so I don't see it in the 'Pending Changes' window in the first place?
OR, if that's not at all possible,
How can I get Beyond Compare to show these changes in the default text compare so I can undo them easily?

To make the extra newline character show as a difference in the Text Compare:
Click the Rules toolbar button (referee icon).
In the Importance tab, check Compare line endings (PC/Mac/Unix).
To make it the default for new Text Compare sessions, change the dropdown from Use for this view only to Also update session defaults before you click OK.
If you turn on View > Visible Whitespace, the extra newline character will show as a red difference. When this setting is on, it will also show Windows style newline on one side and Unix style newline on the other side as a difference.
As AdrianHHH said, the EF BB BF is a UTF-8 byte order mark. It isn't possible to add or remove a BOM in the Text Compare. In the Hex Compare, it is possible to delete the BOM from a file.

Related

Notepad++ convert leading spaces to tabs upon entry

Very close to reverse of this question. I prefer coding with 2-whitespace indentation, but need to have files indented with tabs to align with project convention. What I would like to do is preferably automatically convert 2 spaces upon entry to tab symbol in Notepad++ and have the editor configured to tab length of 2.
A possible manual way for doing this could be Edit->Blank Operations->Space to TAB but this converts all of my spaces to tabs, even those of length 1 - which are, for example, spaces between function arguments, not just leading spaces.
In a perfect case scenario I'm trying to achieve formatting style as described in this question, but with typing just spaces and the editor taking care of the rest.
I'm on Notepad++ 6.0, but willing to upgrade if this helps
Let me complete the answer of Ari Okkonen to add a workaround to the problem commented by Sergii Zaskaleta of mixed tabs and spaces at the beginning of the line.
Settings->Preferences->Tab Settings->Tab size: 2 (if not already)
Edit->Blank Operations->Space to TAB (Leading)
Select a block of lines of text with the problem of mixed spaces and tabs. Press [Tab] and [Shift]+[Tab] to add and remove a tab from each line. In the process, the leading spaces had been converted to tabs.
A manual way that seems to work: After having edited the file before saving you may try (Works in Notepad++ v6.8.3):
Settings->Preferences->Tab Settings->Tab size: 2 (if not already)
Edit->Blank Operations->Space to TAB (Leading)

Beyond Compare 3.3.10 ignores checkboxes for 'leading whitespace" and "embedded whitespace"

I would expect that Beyond Compare would ignore differences based on tabs vs spaces if in the Session Settings/Importance Tab, I check the boxes labeled Leading Whitespace and Embedded Whitespace while comparing text files using the default format. Neither checked nor unchecked causes those differences to be ignored.
What am I missing?
The checkboxes there are controlling what's important to the comparison. Whitespace will be important if they're checked and unimportant if they're unchecked. They do only affect text that doesn't match something else in the grammar though. If you're comparing C++ code, for example, and the whitespace occurs at the end of a comment line it will be classified as a comment instead.
Assuming it's classified as "unimportant" correctly, BC will still show it as a difference, but will show it in blue rather than red. You can hide unimportant differences using the View->Ignore Unimportant Differences menu item, which will make them appear using the matching coloring and filter as such.
If you're still having trouble you'll have better luck getting support if you email support#scootersoftware.com or post in our support forums at http://www.scootersoftware.com/vbulletin/ with a bit more information.
Go to: Tools -> File formats -> Grammar. Add a grammar item (the +) and then mark the Regular expression check box.
There you can add a regex matching the items you want and define the severity of them.
In general, this is very useful when you have some differences that are not important to you.

Sublime behavior like in VS

How to do same behaving in Sublime Text as in Visual Studio, when using column selection
for example if there is a line break in a text, the cursor in Sublime go to beginning of a line
And this is behavior in Visual Studio desired behavior
Thanks
While you may want this functionality for other reasons, it seems like you are using it to adjust the indentation of code blocks. Fortunately, there is a much easier way of doing this. Select the text for which you want to change the indentation, then press Ctrl] to increase the indentation (move block right), or Ctrl[ to decrease indentation (move block left). You can also increase indentation by selecting the desired lines and hitting Tab, and using ShiftTab to decrease it. The one place I can think of where multiple selections would come in handy is if, for some reason, you need to indent/dedent by fewer spaces than are in your tab stop. For example, if I have some code that's indented 3 spaces, and I want to change it to 4 (using the Indent Using Spaces setting in the View -> Indentation menu), I would use a multiple selection to put a cursor on each line, then use Space or Backspace to adjust spacing appropriately.

Is there a way to indent lines (not format them) in Visual Studio?

In Eclipse, there are two distinct features: one to format a selection, one to just indent the lines, see e.g. Difference between Ctrl+Shift+F and Ctrl+I in Eclipse. I found the format feature in Visual Studio but how can I actually just indent the lines? Is there some built-in command for that or possibly a 3rd party add-on?
Note: I have asked a couple of friend that use VS daily and they all tried to persuade me that I am looking for the format feature. No I'm not. I tried to live with it for a while and it is just a different feature. I am after the indent/reindent only.
EDIT: I am looking for a clever indent, sometimes called reindent, which is different to just pressing Tab or Shift+Tab (increase/decrease indent level). The indent feature in Eclipse behaves like this:
It places a beginning of current line at the right position, no matter where that line was starting before. So instead of thinking whether you need to increase or descrease the indent level (Tab or Shift+Tab), you just invoke the indent command and it will do the right thing.
Invoking the indent command on an empty line places the caret at the right position for the user to start typing.
It never influences any character beyond the first non-whitespace character.
If you just want to indent some lines, you can
Select them.
Press Tab.
To un-indent them, replace the second step to: Shift+Tab.
You can find more VS shortcuts here.
There are toolbar buttons for this, with wonderfully inconsistent labels (at least in the Visual Studio 2013 I'm using)...
In the "Text Editor" toolbar (in my default setup), I have to buttons whose tooltips are:
"Decrease Line Indent"
"Increase Line Indent"
In the "Customize" dialog, on the "Commands" tab (with "Toolbar" set to "Text Editor") they appear in the list as:
"Line Unindent"
"Line Indent"
And finally, if you press the "Add Command..." button (on the "Customize" dialog) to produce the "Add Command" dialog and select the "Edit" category, you'll see these two entries:
"Outdent"
"Indent"
As far as I can tell, these are all the same two commands, which should do what you want.
They also appear in the Edit -> Advanced menu, at the very bottom.
----- Edit -----
I believe you might be able to turn off all of the "formatting" actions except for indentation, so that when you use the "auto-format" command, only the indentation is "formatted" for you. (Of course this prevents you from ever using the rest of the formatting features without turning them on again, but if you don't use them, this might work!)

Can TextMate show tab vs space characters?

Using TextMate on Mac, the "invisibles" can be displayed by using
View -> Show Invisibles
But the space vs tab characters are not shown, and Preferences doesn't seem to have any entry to change that either. Is there a way to show them? It is because some older coder may have tab or space mixed together so what looks good in the editor may actually be misaligned. (editor shows tab as 2 spaces)
Tab characters are shown, but spaces are not. What's probably happening is that you have Soft tabs turned on, in which case the tabs are converted into spaces automatically.
alt text http://grab.by/grabs/fabaea391dc8bc764636f0ca19a8c38d.png
In this picture there is a tab character, new line, tab character, new line, soft tab, new line
See this thread for an explanation as to why spaces are not shown.
Here is where you can change soft/real tabs.
alt text http://grab.by/grabs/783db3a88609a01c7702cbd250f495c6.png
If "Show invisibles" is activated, you will see a little triangle for each tab, which points to the right. Spaces are not shown at all, you can only see them indirectly, i.e. via the symbol which represents the line break. If the line break isn't the first character after your code of that line, there are spaces in between.
So to make a long answer short: You should already see tabs, however the symbols representing the invisibles are sometimes hard to see.

Resources