Remove 1.17 version checks
MODIFY
lib/project/results-model.coffee
lib/project/results-model.coffee
@@ -256,16 +256,10 @@ class ResultsModel
return unless editor.getPath()
matches = []
- # the following condition is pretty hacky
- # it doesn't work correctly for e.g. version 1.2
- if parseFloat(atom.getVersion()) >= 1.17
leadingContextLineCount = atom.config.get('find-and-replace.searchContextLineCountBefore')
trailingContextLineCount = atom.config.get('find-and-replace.searchContextLineCountAfter')
editor.scan @regex, {leadingContextLineCount, trailingContextLineCount}, (match) ->
matches.push(match)
- else
- editor.scan @regex, (match) ->
- matches.push(match)
result = Result.create({filePath: editor.getPath(), matches})
@setResult(editor.getPath(), result)

MODIFY
spec/results-model-spec.js
spec/results-model-spec.js
@@ -35,9 +35,6 @@ describe("ResultsModel", () => {
expect(resultsModel.getPathCount()).toBe(1);
expect(resultsModel.getMatchCount()).toBe(6);
expect(resultsModel.getPaths()).toEqual([editor.getPath()]);
- // the following condition is pretty hacky
- // it doesn't work correctly for e.g. version 1.2
- if (parseFloat(atom.getVersion()) >= 1.17) {
expect(result.matches[0].leadingContextLines.length).toBe(1);
expect(result.matches[0].leadingContextLines[0]).toBe("var quicksort = function () {");
expect(result.matches[0].trailingContextLines.length).toBe(3);
@@ -46,7 +43,6 @@ describe("ResultsModel", () => {
expect(result.matches[0].trailingContextLines[2]).toBe(" while(items.length > 0) {");
expect(result.matches[5].leadingContextLines.length).toBe(2);
expect(result.matches[5].trailingContextLines.length).toBe(3);
- }
editor.setText("there are some items in here");
advanceClock(editor.buffer.stoppedChangingDelay);
@@ -58,12 +54,8 @@ describe("ResultsModel", () => {
expect(resultsModel.getMatchCount()).toBe(1);
expect(resultsModel.getPaths()).toEqual([editor.getPath()]);
expect(result.matches[0].lineText).toBe("there are some items in here");
- // the following condition is pretty hacky
- // it doesn't work correctly for e.g. version 1.2
- if (parseFloat(atom.getVersion()) >= 1.17) {
expect(result.matches[0].leadingContextLines.length).toBe(0);
expect(result.matches[0].trailingContextLines.length).toBe(0);
- }
editor.setText("no matches in here");
advanceClock(editor.buffer.stoppedChangingDelay);

MODIFY
spec/results-view-spec.js
spec/results-view-spec.js
@@ -745,9 +745,6 @@ describe('ResultsView', () => {
}
it('shows the context lines', async () => {
- // the following condition is pretty hacky
- // it doesn't work correctly for e.g. version 1.2
- if (parseFloat(atom.getVersion()) >= 1.17) {
// show no context lines
expect(resultsView.model.getFindOptions().leadingContextLineCount).toBe(0);
expect(resultsView.model.getFindOptions().trailingContextLineCount).toBe(0);
@@ -848,7 +845,6 @@ describe('ResultsView', () => {
expect(lineNodes[1]).toHaveClass('match-line');
expect(lineNodes[1].querySelector('.preview').textContent).toBe(' sort: (items) ->');
}
- }
});
});

Remove 1.17 version checks