Project

General

Profile

Actions

Defect #33707

closed

Highlighted code with 'diff' format converts tabs to spaces, which breaks IDEs

Added by Robert E2 over 4 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Text formatting
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Duplicate
Affected version:

Description

If I paste some code like a diff (patch format), then tabs are replaced by 4 spaces:

Index: web/SomeJs.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- web/SomeJs.js    (revision a772b73079dfedeaafa2a941b33b4bb03fc77b2a)
+++ web/SomeJs.js    (date 1593706024927)
@@ -7,13 +7,33 @@
 };

 SomeJs.prototype.isMobile = function () {
-    return /Foo/.test("a");

Please compare with raw format, where I got some <TAB> chars originally (edit the description to see that the tabs are still there):

Index: web/SomeJs.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- web/SomeJs.js<TAB>(revision a772b73079dfedeaafa2a941b33b4bb03fc77b2a)
+++ web/SomeJs.js<TAB>(date 1593706024927)
@@ -7,13 +7,33 @@
 };

 SomeJs.prototype.isMobile = function () {
-<TAB>return /Foo/.test("a");

This is annoying cause copying the diff from the visual view does not work. I have to copy from the Edit view and apply the patch in my IDE this way.


Related issues

Is duplicate of Redmine - Defect #28793: Redmine replaces tabs with spaces in code blocksConfirmed

Actions
Actions

Also available in: Atom PDF