rename options and members
MODIFY
lib/project/match-view.js
lib/project/match-view.js
@@ -41,7 +41,7 @@ class MatchView {
const matchEnd = range.end.column - this.match.lineTextOffset;
const prefix = this.match.lineText.slice(0, matchStart).trimLeft();
const suffix = this.match.lineText.slice(matchEnd);
- const {linesBefore, linesAfter} = this.match;
+ const {leadingContextLines, trailingContextLines} = this.match;
let replacementText = ''
if (this.replacePattern && this.regex) {
@@ -65,9 +65,9 @@ class MatchView {
},
$.ul({className: 'list-tree'},
- linesBefore ? linesBefore.map((line, index) =>
+ leadingContextLines ? leadingContextLines.map((line, index) =>
$.li({className: 'list-item'},
- $.span({className: 'line-number text-subtle'}, range.start.row + 1 - linesBefore.length + index),
+ $.span({className: 'line-number text-subtle'}, range.start.row + 1 - leadingContextLines.length + index),
$.span({className: 'preview'}, $.span({}, line))
)
) : null,
@@ -89,7 +89,7 @@ class MatchView {
)
),
- linesAfter ? linesAfter.map((line, index) =>
+ trailingContextLines ? trailingContextLines.map((line, index) =>
$.li({className: 'list-item'},
$.span({className: 'line-number text-subtle'}, range.end.row + 1 + index + 1),
$.span({className: 'preview'}, $.span({}, line))

MODIFY
lib/project/result-view.js
lib/project/result-view.js
@@ -129,8 +129,8 @@ class ResultView {
for (; i < this.matches.length; i++) {
const match = this.matches[i];
let itemBottomPosition = itemTopPosition + this.matchHeight;
- if (match.linesBefore) itemBottomPosition += match.linesBefore.length * this.contextLineHeight;
- if (match.linesAfter) itemBottomPosition += match.linesAfter.length * this.contextLineHeight;
+ if (match.leadingContextLines) itemBottomPosition += match.leadingContextLines.length * this.contextLineHeight;
+ if (match.trailingContextLines) itemBottomPosition += match.trailingContextLines.length * this.contextLineHeight;
if (itemBottomPosition > top) break;
itemTopPosition = itemBottomPosition;
@@ -139,8 +139,8 @@ class ResultView {
for (; i < this.matches.length; i++) {
const match = this.matches[i];
let itemBottomPosition = itemTopPosition + this.matchHeight;
- if (match.linesBefore) itemBottomPosition += match.linesBefore.length * this.contextLineHeight;
- if (match.linesAfter) itemBottomPosition += match.linesAfter.length * this.contextLineHeight;
+ if (match.leadingContextLines) itemBottomPosition += match.leadingContextLines.length * this.contextLineHeight;
+ if (match.trailingContextLines) itemBottomPosition += match.trailingContextLines.length * this.contextLineHeight;
children.push(
etch.dom(MatchView, {

MODIFY
lib/project/results-model.coffee
lib/project/results-model.coffee
@@ -11,8 +11,8 @@ class Result
lineText: m.lineText,
lineTextOffset: m.lineTextOffset,
range: m.range,
- linesBefore: m.linesBefore,
- linesAfter: m.linesAfter
+ leadingContextLines: m.leadingContextLines,
+ trailingContextLines: m.trailingContextLines
}
)
new Result({filePath: result.filePath, matches})
@@ -128,9 +128,9 @@ class ResultsModel
onPathsSearched = (numberOfPathsSearched) =>
@emitter.emit 'did-search-paths', numberOfPathsSearched
- lineCountBefore = atom.config.get('find-and-replace.searchContextLineCountBefore')
- lineCountAfter = atom.config.get('find-and-replace.searchContextLineCountAfter')
- @inProgressSearchPromise = atom.workspace.scan @regex, {paths: searchPaths, onPathsSearched, lineCountBefore, lineCountAfter}, (result, error) =>
+ leadingContextLineCount = atom.config.get('find-and-replace.searchContextLineCountBefore')
+ trailingContextLineCount = atom.config.get('find-and-replace.searchContextLineCountAfter')
+ @inProgressSearchPromise = atom.workspace.scan @regex, {paths: searchPaths, onPathsSearched, leadingContextLineCount, trailingContextLineCount}, (result, error) =>
if result
@setResult(result.filePath, Result.create(result))
else
@@ -247,9 +247,9 @@ class ResultsModel
return unless editor.getPath()
matches = []
- lineCountBefore = atom.config.get('find-and-replace.searchContextLineCountBefore')
- lineCountAfter = atom.config.get('find-and-replace.searchContextLineCountAfter')
- editor.scan @regex, {lineCountBefore, lineCountAfter}, (match) ->
+ 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)
result = Result.create({filePath: editor.getPath(), matches})

MODIFY
lib/project/results-view.js
lib/project/results-view.js
@@ -89,8 +89,8 @@ class ResultsView {
filePath: 'fake-file-path',
matches: [{
range: [[0, 1], [0, 2]],
- linesBefore: ['test-line-before'],
- linesAfter: ['test-line-after'],
+ leadingContextLines: ['test-line-before'],
+ trailingContextLines: ['test-line-after'],
lineTextOffset: 1,
lineText: 'fake-line-text',
matchText: 'fake-match-text',
@@ -137,8 +137,8 @@ class ResultsView {
for (let i = 0, n = searchResult.matches.length; i < n; i++) {
const match = searchResult.matches[i];
result += this.matchHeight;
- if (match.linesBefore) result += this.contextLineHeight * match.linesBefore.length;
- if (match.linesAfter) result += this.contextLineHeight * match.linesAfter.length;
+ if (match.leadingContextLines) result += this.contextLineHeight * match.leadingContextLines.length;
+ if (match.trailingContextLines) result += this.contextLineHeight * match.trailingContextLines.length;
}
}
return result;
@@ -255,12 +255,12 @@ class ResultsView {
for (let j = 0; j < this.selectedMatchIndex; j++) {
const match = selectedResult.matches[j];
result += this.matchHeight;
- if (match.linesBefore) result += this.contextLineHeight * match.linesBefore.length;
- if (match.linesAfter) result += this.contextLineHeight * match.linesAfter.length;
+ if (match.leadingContextLines) result += this.contextLineHeight * match.leadingContextLines.length;
+ if (match.trailingContextLines) result += this.contextLineHeight * match.trailingContextLines.length;
}
const selectedMatch = selectedResult.matches[this.selectedMatchIndex];
- if (selectedMatch.linesBefore) result += this.contextLineHeight * selectedMatch.linesBefore.length;
+ if (selectedMatch.leadingContextLines) result += this.contextLineHeight * selectedMatch.leadingContextLines.length;
}
return result;
@@ -292,8 +292,8 @@ class ResultsView {
for (let j = 0; j < searchResult.matches.length; j++) {
const match = searchResult.matches[j];
bottom = top + this.matchHeight;
- if (match.linesBefore) bottom += this.contextLineHeight * match.linesBefore.length;
- if (match.linesAfter) bottom += this.contextLineHeight * match.linesAfter.length;
+ if (match.leadingContextLines) bottom += this.contextLineHeight * match.leadingContextLines.length;
+ if (match.trailingContextLines) bottom += this.contextLineHeight * match.trailingContextLines.length;
if (bottom > position) {
this.selectedResultIndex = i;

rename options and members