-
Notifications
You must be signed in to change notification settings - Fork 809
Expand file tree
/
Copy pathOutputPanelScopeImpl.kt
More file actions
51 lines (40 loc) · 1.46 KB
/
OutputPanelScopeImpl.kt
File metadata and controls
51 lines (40 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
* Copyright 2003-2025 The IdeaVim authors
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE.txt file or at
* https://opensource.org/licenses/MIT.
*/
package com.maddyhome.idea.vim.thinapi
import com.intellij.vim.api.scopes.OutputPanelScope
import com.maddyhome.idea.vim.api.ExecutionContext
import com.maddyhome.idea.vim.api.VimEditor
import com.maddyhome.idea.vim.api.VimOutputPanel
import com.maddyhome.idea.vim.api.injector
object OutputPanelScopeImpl : OutputPanelScope {
private val vimEditor: VimEditor
get() = injector.editorGroup.getFocusedEditor()!!
private val vimContext: ExecutionContext
get() = injector.executionContextManager.getEditorExecutionContext(vimEditor)
private val outputPanel: VimOutputPanel
get() = injector.outputPanel.getOrCreate(vimEditor, vimContext)
override val text: String
get() = outputPanel.text
override val label: String
get() = outputPanel.label
override fun setText(text: String) {
outputPanel.setContent(text)
outputPanel.show() // has to be called to update the text
}
override fun appendText(text: String, startNewLine: Boolean) {
outputPanel.addText(text, startNewLine)
outputPanel.show() // has to be called to update the text
}
override fun setLabel(label: String) {
outputPanel.label = label
}
override fun clearText() {
outputPanel.clearText()
outputPanel.show() // has to be called to update the text
}
}