Skip to content

Commit e38396d

Browse files
committed
fixes #149, fixes #160, fixes #143
1 parent b1f08dd commit e38396d

File tree

5 files changed

+25
-87
lines changed

5 files changed

+25
-87
lines changed

CHANGELOG.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
## 1.6.0 - 2019-XX-XX
1+
## 1.6.0 - 2019-01-24
22
* Added ability to disable automatic diff #139
3-
* Fixed bug where toggling "Ignore Whitespace" from Atom settings didn't update the checkbox in the footer UI
3+
* Changed loading indicator to appear in footer UI instead of as a modal that covered both editors #149
4+
* Fixed toggling "Ignore Whitespace" from Atom settings didn't update the checkbox in the footer UI
5+
* Fixed "Diff with Active File" not highlighting syntax in newly created tab (missed part of #151)
6+
* Fixed "Diff with Active File" of new, unsaved tab creating a new tab with editor hooked up to shared text buffer #160
7+
* Fixed "Remove Soft Wrap" setting not working for quick git diff #143
48

59
## 1.5.4 - 2019-01-08
610
* Fixed bug with setting the grammar for second editor #151 - thanks hSaria!

lib/split-diff.coffee

+11-13
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{CompositeDisposable, Directory, File} = require 'atom'
22
DiffView = require './diff-view'
3-
LoadingView = require './ui/loading-view'
43
FooterView = require './ui/footer-view'
54
SyncScroll = require './sync-scroll'
65
StyleCalculator = require './style-calculator'
@@ -126,9 +125,6 @@ module.exports = SplitDiff =
126125
if @footerView?
127126
@footerView.destroy()
128127
@footerView = null
129-
if @loadingView?
130-
@loadingView.destroy()
131-
@loadingView = null
132128

133129
if @syncScroll?
134130
@syncScroll.dispose()
@@ -298,14 +294,18 @@ module.exports = SplitDiff =
298294
@process.kill()
299295
@process = null
300296

297+
# force softwrap to be off if it somehow turned back on #143
298+
turnOffSoftWrap = @options.turnOffSoftWrap ? @_getConfig('turnOffSoftWrap')
299+
if turnOffSoftWrap
300+
if editors.editor1.isSoftWrapped()
301+
editors.editor1.setSoftWrapped(false)
302+
if editors.editor2.isSoftWrapped()
303+
editors.editor2.setSoftWrapped(false)
304+
301305
ignoreWhitespace = @options.ignoreWhitespace ? @_getConfig('ignoreWhitespace')
302306
editorPaths = @_createTempFiles(editors)
303307

304-
# create the loading view if it doesn't exist yet
305-
if !@loadingView?
306-
@loadingView = new LoadingView()
307-
@loadingView.createModal()
308-
@loadingView.show()
308+
@footerView?.setLoading()
309309

310310
# --- kick off background process to compute diff ---
311311
{BufferedNodeProcess} = require 'atom'
@@ -317,13 +317,10 @@ module.exports = SplitDiff =
317317
computedDiff = JSON.parse(output)
318318
@process.kill()
319319
@process = null
320-
@loadingView?.hide()
321320
@_resumeUpdateDiff(editors, computedDiff)
322321
stderr = (err) =>
323322
theOutput = err
324323
exit = (code) =>
325-
@loadingView?.hide()
326-
327324
if code != 0
328325
console.log('BufferedNodeProcess code was ' + code)
329326
console.log(theOutput)
@@ -425,9 +422,10 @@ module.exports = SplitDiff =
425422
editor2Promise = atom.workspace.openURIInPane(filePath, rightPane)
426423

427424
return editor2Promise.then (editor2) ->
425+
editor2.getBuffer().setLanguageMode(atom.grammars.languageModeForGrammarAndBuffer(editor1.getGrammar(), editor2.getBuffer()))
428426
return {editor1: editor1, editor2: editor2}
429427
else if editorWithoutPath
430-
editor2 = editorWithoutPath.copy()
428+
editor2 = atom.workspace.buildTextEditor({autoHeight: false})
431429
rightPane.addItem(editor2)
432430

433431
return Promise.resolve({editor1: editor1, editor2: editor2})

lib/ui/footer-view.coffee

+6-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class FooterView
4646
# create number of differences value
4747
@numDifferencesValue = document.createElement('span')
4848
@numDifferencesValue.classList.add('num-diff-value')
49-
@numDifferencesValue.textContent = '...'
49+
@numDifferencesValue.classList.add('split-diff-loading-icon')
5050
# create number of differences text
5151
@numDifferencesText = document.createElement('span')
5252
@numDifferencesText.textContent = 'differences'
@@ -166,8 +166,13 @@ class FooterView
166166
hide: ->
167167
@footerPanel.hide()
168168

169+
setLoading: ->
170+
@numDifferencesValue.textContent = null
171+
@numDifferencesValue.classList.add('split-diff-loading-icon')
172+
169173
# set the number of differences value
170174
setNumDifferences: (num) ->
175+
@numDifferencesValue.classList.remove('split-diff-loading-icon')
171176
if num == 1
172177
@numDifferencesText.textContent = 'difference'
173178
else

lib/ui/loading-view.coffee

-37
This file was deleted.

styles/split-diff.less

+2-34
Original file line numberDiff line numberDiff line change
@@ -32,42 +32,14 @@ atom-text-editor {
3232
}
3333
}
3434

35-
/* loading modal */
36-
@keyframes delay-modal {
37-
0% {
38-
opacity: 0;
39-
}
40-
99% {
41-
opacity: 0;
42-
}
43-
100% {
44-
opacity: 1;
45-
}
46-
}
47-
48-
// animation needs to be on the outer modal element and not its contents
49-
.split-diff-hide-mask {
50-
animation: delay-modal 1s forwards;
51-
}
52-
53-
.split-diff-modal {
54-
padding: 14px;
55-
text-align: center;
56-
}
57-
58-
.split-diff-message {
59-
font-size: 26px;
60-
display: inline-block;
61-
}
62-
6335
@spinner-duration: 1.2s;
6436
@spinner-color: mix( hsv( 220, 100%, 66%), hsl( 220, 100%, 70%), luma( hsl(220, 50%, 50%) ) );
65-
.split-diff-icon {
37+
.split-diff-loading-icon {
6638
position: relative;
6739
display: inline-block;
6840
width: 1em;
6941
height: 1em;
70-
font-size: 48px;
42+
vertical-align: middle;
7143
background: radial-gradient(@spinner-color .1em, transparent .11em);
7244

7345
&::before,
@@ -100,10 +72,6 @@ atom-text-editor {
10072
100% { transform: rotateZ(360deg); }
10173
}
10274

103-
.split-diff-hide-mask:after {
104-
display: none;
105-
}
106-
10775
/* bottom panel UI */
10876
.split-diff-ui {
10977
padding: 2px 10px 2px 10px;

0 commit comments

Comments
 (0)