Merge 6e92fca7ed
into 7dfcd74e63
This commit is contained in:
commit
d51cb9353b
|
@ -627,6 +627,11 @@ const editorConfiguration: IConfigurationNode = {
|
|||
nls.localize('wordWrap.on', "Lines will wrap at the viewport width."),
|
||||
nls.localize('wordWrap.inherit', "Lines will wrap according to the `#editor.wordWrap#` setting."),
|
||||
]
|
||||
},
|
||||
'diffEditor.findLoop': {
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
description: nls.localize('diffEditor.findLoop', "Controls whether the diff editor search automatically restarts from the beginning (or the end) when no further matches can be found.")
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -480,6 +480,15 @@ export class GotoPreviousChangeAction extends EditorAction {
|
|||
const index = model.findPreviousClosestChange(lineNumber, false);
|
||||
const change = model.changes[index];
|
||||
|
||||
// lineNumber is the original current line number
|
||||
// change.modifiedStartLineNumber is the start line number of the previous change
|
||||
if (change.modifiedStartLineNumber > lineNumber) {
|
||||
// findLoop option is stored in the model
|
||||
if (model.findLoop === false) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const position = new Position(change.modifiedStartLineNumber, 1);
|
||||
outerEditor.setPosition(position);
|
||||
outerEditor.revealPositionInCenter(position);
|
||||
|
@ -522,6 +531,15 @@ export class GotoNextChangeAction extends EditorAction {
|
|||
const index = model.findNextClosestChange(lineNumber, false);
|
||||
const change = model.changes[index];
|
||||
|
||||
// lineNumber is the original current line number
|
||||
// change.modifiedStartLineNumber is the start line number of the next change
|
||||
if (change.modifiedStartLineNumber < lineNumber) {
|
||||
// findLoop option is stored in the model
|
||||
if (model.findLoop === false) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const position = new Position(change.modifiedStartLineNumber, 1);
|
||||
outerEditor.setPosition(position);
|
||||
outerEditor.revealPositionInCenter(position);
|
||||
|
@ -934,6 +952,7 @@ class DirtyDiffDecorator extends Disposable {
|
|||
const gutter = decorations === 'all' || decorations === 'gutter';
|
||||
const overview = decorations === 'all' || decorations === 'overview';
|
||||
const minimap = decorations === 'all' || decorations === 'minimap';
|
||||
const findLoop = configurationService.getValue<boolean>('diffEditor.findLoop');
|
||||
|
||||
this.modifiedOptions = DirtyDiffDecorator.createDecoration('dirty-diff-modified', {
|
||||
gutter,
|
||||
|
@ -953,6 +972,7 @@ class DirtyDiffDecorator extends Disposable {
|
|||
minimap: { active: minimap, color: minimapGutterDeletedBackground },
|
||||
isWholeLine: false
|
||||
});
|
||||
this.model.findLoop = findLoop;
|
||||
|
||||
this._register(model.onDidChange(this.onDidChange, this));
|
||||
}
|
||||
|
@ -1084,6 +1104,10 @@ export class DirtyDiffModel extends Disposable {
|
|||
private _changes: IChange[] = [];
|
||||
get changes(): IChange[] { return this._changes; }
|
||||
|
||||
private _findLoop: boolean = true;
|
||||
get findLoop(): boolean { return this._findLoop; }
|
||||
set findLoop(value: boolean) { this._findLoop = value; }
|
||||
|
||||
constructor(
|
||||
textFileModel: IResolvedTextFileEditorModel,
|
||||
@ISCMService private readonly scmService: ISCMService,
|
||||
|
|
Loading…
Reference in a new issue