MCPcopy Create free account
hub / github.com/pulsar-edit/pulsar / moveToNextDiff

Method moveToNextDiff

packages/git-diff/lib/git-diff-view.js:140–166  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

138 }
139
140 moveToNextDiff() {
141 const cursorLineNumber = this.editor.getCursorBufferPosition().row + 1;
142 let nextDiffLineNumber = null;
143 let firstDiffLineNumber = null;
144
145 for (const { newStart } of this.diffs) {
146 if (newStart > cursorLineNumber) {
147 if (nextDiffLineNumber == null) nextDiffLineNumber = newStart - 1;
148
149 nextDiffLineNumber = Math.min(newStart - 1, nextDiffLineNumber);
150 }
151
152 if (firstDiffLineNumber == null) firstDiffLineNumber = newStart - 1;
153
154 firstDiffLineNumber = Math.min(newStart - 1, firstDiffLineNumber);
155 }
156
157 // Wrap around to the first diff in the file
158 if (
159 atom.config.get('git-diff.wrapAroundOnMoveToDiff') &&
160 nextDiffLineNumber == null
161 ) {
162 nextDiffLineNumber = firstDiffLineNumber;
163 }
164
165 this.moveToLineNumber(nextDiffLineNumber);
166 }
167
168 moveToPreviousDiff() {
169 const cursorLineNumber = this.editor.getCursorBufferPosition().row + 1;

Callers

nothing calls this directly

Calls 3

moveToLineNumberMethod · 0.95
getMethod · 0.45

Tested by

no test coverage detected