Skip to content

Commit

Permalink
Fixes #49173
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdima committed May 29, 2018
1 parent 92a32b1 commit 7f0f6e1
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/vs/editor/common/model/textModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2505,10 +2505,10 @@ export class TextModel extends Disposable implements model.ITextModel {
const upLineNumber = lineNumber - distance;
const downLineNumber = lineNumber + distance;

if (upLineNumber < 1 || upLineNumber < minLineNumber) {
if (distance !== 0 && (upLineNumber < 1 || upLineNumber < minLineNumber)) {
goUp = false;
}
if (downLineNumber > lineCount || downLineNumber > maxLineNumber) {
if (distance !== 0 && (downLineNumber > lineCount || downLineNumber > maxLineNumber)) {
goDown = false;
}
if (distance > 50000) {
Expand Down
21 changes: 21 additions & 0 deletions src/vs/editor/test/common/model/textModelWithTokens.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -596,4 +596,25 @@ suite('TextModel.getLineIndentGuide', () => {
[0, 'include script'],
]);
});

test('issue #49173', () => {
let model = TextModel.createFromString([
'class A {',
' public m1(): void {',
' }',
' public m2(): void {',
' }',
' public m3(): void {',
' }',
' public m4(): void {',
' }',
' public m5(): void {',
' }',
'}',
].join('\n'));

const actual = model.getActiveIndentGuide(2, 4, 9);
assert.deepEqual(actual, { startLineNumber: 2, endLineNumber: 9, indent: 1 });
model.dispose();
});
});

0 comments on commit 7f0f6e1

Please sign in to comment.