@@ -55,8 +55,9 @@ class SingleFileDiffView(
55
55
private val mainPanel: JPanel = JPanel (VerticalLayout (5 ))
56
56
private val myHeaderPanel: JPanel = JPanel (BorderLayout ())
57
57
private var patchActionPanel: JPanel ? = null
58
- private val appliedPatch = GenericPatchApplier .apply (currentFile.readText(), patch.hunks)
59
58
private val oldCode = currentFile.readText()
59
+ private val appliedPatch = GenericPatchApplier .apply (oldCode, patch.hunks)
60
+ private val newCode = appliedPatch?.patchedText
60
61
61
62
init {
62
63
val contentPanel = JPanel (BorderLayout ())
@@ -97,15 +98,14 @@ class SingleFileDiffView(
97
98
foreground = JBColor (0xFF0000 , 0xFF0000 )
98
99
}
99
100
100
- val filePanel: JPanel
101
- if (patch.beforeFileName != null ) {
102
- filePanel = JPanel (BorderLayout ()).apply {
101
+ val filePanel: JPanel = if (patch.beforeFileName != null ) {
102
+ JPanel (BorderLayout ()).apply {
103
103
add(filepathLabel, BorderLayout .WEST )
104
104
add(addLabel, BorderLayout .CENTER )
105
105
add(removeLabel, BorderLayout .EAST )
106
106
}
107
107
} else {
108
- filePanel = JPanel (BorderLayout ()).apply {
108
+ JPanel (BorderLayout ()).apply {
109
109
add(filepathLabel, BorderLayout .WEST )
110
110
}
111
111
}
0 commit comments