Xcode has two kinds of source tabs. What are they?

Have you noticed that Xcode (15 for sure, I think 14 and earlier, too) has at least two kinds of source editor tabs. Some have the filename in regular text, some have it italicized.

When the name is italicized, selecting another file in the navigator replaces the contents of that tab with that other file. When the filename is regular, a new tab is opened if you select a different file.

When working with multiple related documents, I really dislike, in general, the browser model, wherein a windows contents are replaced by the thing you navigated to. But that's a whole separate rant.

For now, I just want to know how and when Xcode decides to make one tab type or the other, and how can I control the behavior?

It's easy.

Let's say you have no tabs open:

  • Single-click a file in the project view and the file is opened into a new tab, with the text italicised. Let's call this a View Tab.
  • If you then select any other file (single-click it), the tab is replaced with that file, and the text is still italicised.
  • Double-click a file in the project view instead, and the tab is replaced with the selected file, but the text is plain, not italicised. You've told Xcode to open this file and leave it open, so let's call this an Open Tab.

Similarly, if you have a View Tab and you double-click the tab itself, it becomes an Open Tab.

You can change this behaviour in the Settings. Just go to the Navigation tab, and at the bottom, in the "Double-click Navigation" dropdown:

  • "Uses Tab" is the behaviour described above.
  • "Same as click" means every file is opened as a View Tab, i.e. a tabs contents is replaced when you select a new file with a single- or double-click.
  • "Uses Separate Window" opens a file into a new window.
  • "Uses Separate Window Tab" opens a file into a new tab in a new window.

On my editors, the titles of the files are in the same font. However, the selected editor window which has the cursor in has the file title highlighted. When you click on a file in the navigator, then this is the editor window which will now have the selected file in.

Also, the file location breadcrumbs have the Xcode logo just to the left highlighted.

Sorry but I can't load a screenshot at the moment but hope this helps.

Xcode has two kinds of source tabs. What are they?
 
 
Q