diff options
| author | Christoph Schlosser <christoph@linux.com> | 2018-03-01 18:19:47 +0100 |
|---|---|---|
| committer | Christoph Schlosser <christophschlosser@users.noreply.github.com> | 2018-03-02 20:24:28 +0100 |
| commit | 516675facd3c16bd2f42f78783a1da0f9c9e1866 (patch) | |
| tree | fad2be45b4947ebb960b78e178d08f4a4e837a1d | |
| parent | f41d471874c07e78a6541994b09e9f8bf751bfe5 (diff) | |
| download | doxdocgen-516675facd3c16bd2f42f78783a1da0f9c9e1866.tar.gz | |
Dont select negative values
| -rw-r--r-- | src/Lang/Cpp/CppDocGen.ts | 4 | ||||
| -rw-r--r-- | src/test/CppTests/Con-AndDestructor.test.ts | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/Lang/Cpp/CppDocGen.ts b/src/Lang/Cpp/CppDocGen.ts index a7994eb..b825570 100644 --- a/src/Lang/Cpp/CppDocGen.ts +++ b/src/Lang/Cpp/CppDocGen.ts @@ -311,8 +311,8 @@ export class CppDocGen implements IDocGen { line = baseLine; character = baseCharacter; } - - const from: Position = new Position(line, character - this.smartTextLength - 1); + const start = character - this.smartTextLength - 1; + const from: Position = new Position(line, (start > 0 ? start : 0)); const to: Position = new Position(line, character); this.activeEditor.selection = new Selection(from, to); } diff --git a/src/test/CppTests/Con-AndDestructor.test.ts b/src/test/CppTests/Con-AndDestructor.test.ts index 6bf3242..7858c30 100644 --- a/src/test/CppTests/Con-AndDestructor.test.ts +++ b/src/test/CppTests/Con-AndDestructor.test.ts @@ -15,6 +15,8 @@ import TestSetup from "./TestSetup"; suite("C++ - Con- and Destructor Tests", () => { const testSetup: TestSetup = new TestSetup("void foo();"); + testSetup.cfg.generateSmartText = false; + // Tests test("Normal Constructor", () => { const result = testSetup.SetLine("Foo(int a);").GetResult(); |