@@ -27,31 +27,26 @@ object ErrorMessageProcessor {
27
27
val editor = event.getData(CommonDataKeys .EDITOR ) ? : return null
28
28
val selectionModel = editor.selectionModel
29
29
val text = selectionModel.selectedText ? : return null
30
- val selectionStartPosition = selectionModel.selectionStartPosition ? : return null
30
+ val position = selectionModel.selectionStartPosition ? : return null
31
31
32
- val lineFrom = selectionStartPosition.line
33
- val selectionEndPosition = selectionModel.selectionEndPosition ? : return null
34
- val lineTo = selectionEndPosition.line
35
- return ErrorDescription (text, lineFrom, lineTo, editor)
32
+ val endPosition = selectionModel.selectionEndPosition ? : return null
33
+ return ErrorDescription (text, position.line, endPosition.line, editor)
36
34
}
37
35
38
36
private fun extractTextFromRunPanel (
39
37
project : Project , lineFrom : Int ,
40
38
lineTo : Int? ,
41
39
consoleEditor : Editor ? ,
42
40
): String? {
43
- var editor = consoleEditor
44
- if (editor == null ) editor = getConsoleEditor(project)
45
- if (editor == null ) return null
46
-
41
+ val editor = consoleEditor ? : getConsoleEditor(project) ? : return null
47
42
val document = editor.document
48
43
49
- return document.getText(
50
- TextRange (
51
- document.getLineStartOffset(lineFrom),
52
- document.getLineEndOffset(lineTo ? : (document.lineCount - 1 ))
53
- )
44
+ val textRange = TextRange (
45
+ document.getLineStartOffset(lineFrom),
46
+ document.getLineEndOffset(lineTo ? : (document.lineCount - 1 ))
54
47
)
48
+
49
+ return document.getText(textRange)
55
50
}
56
51
57
52
private fun getConsoleEditor (project : Project ): Editor ? {
0 commit comments