forked from qt-creator/qt-creator
		
	Utils: Adjust column numbers affected by convertPosition change
convertPosition change was introduced in 931ec39f64.
It changed 0-based column to 1-based which is how it
naturally is in Qt Creator.
This fixed some usages but broke many more. This is an
attempt to fix the remaining use cases.
Fixes CppEditor auto-tests.
Change-Id: Ia8d14da0ebb035cd2fdd6da4ff6ec89c1c5121a8
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
			
			
This commit is contained in:
		| @@ -184,8 +184,9 @@ private: | ||||
|     { | ||||
|         CursorInfo result; | ||||
|  | ||||
|         // findLocalUses operates with 1-based line and 0-based column | ||||
|         const CppTools::SemanticInfo::LocalUseMap localUses | ||||
|                 = BuiltinCursorInfo::findLocalUses(m_document, m_line, m_column); | ||||
|                 = BuiltinCursorInfo::findLocalUses(m_document, m_line, m_column - 1); | ||||
|         result.localUses = localUses; | ||||
|         splitLocalUses(localUses, &result.useRanges, &result.unusedVariablesRanges); | ||||
|  | ||||
| @@ -216,8 +217,7 @@ private: | ||||
|             bool good = false; | ||||
|             foreach (const CppTools::SemanticInfo::Use &use, uses) { | ||||
|                 unsigned l = static_cast<unsigned>(m_line); | ||||
|                 // convertCursorPosition() returns a 0-based column number. | ||||
|                 unsigned c = static_cast<unsigned>(m_column + 1); | ||||
|                 unsigned c = static_cast<unsigned>(m_column); | ||||
|                 if (l == use.line && c >= use.column && c <= (use.column + use.length)) { | ||||
|                     good = true; | ||||
|                     break; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user