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

Method moveToPreviousDiff

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

Source from the content-addressed store, hash-verified

166 }
167
168 moveToPreviousDiff() {
169 const cursorLineNumber = this.editor.getCursorBufferPosition().row + 1;
170 let previousDiffLineNumber = null;
171 let lastDiffLineNumber = null;
172 for (const { newStart } of this.diffs) {
173 if (newStart < cursorLineNumber) {
174 previousDiffLineNumber = Math.max(newStart - 1, previousDiffLineNumber);
175 }
176 lastDiffLineNumber = Math.max(newStart - 1, lastDiffLineNumber);
177 }
178
179 // Wrap around to the last diff in the file
180 if (
181 atom.config.get('git-diff.wrapAroundOnMoveToDiff') &&
182 previousDiffLineNumber === null
183 ) {
184 previousDiffLineNumber = lastDiffLineNumber;
185 }
186
187 this.moveToLineNumber(previousDiffLineNumber);
188 }
189
190 updateIconDecoration() {
191 const gutter = this.editorElement.querySelector('.gutter');

Callers

nothing calls this directly

Calls 3

moveToLineNumberMethod · 0.95
getMethod · 0.45

Tested by

no test coverage detected