1
0
mirror of https://github.com/chylex/IntelliJ-IdeaVim.git synced 2025-08-01 15:59:06 +02:00

Add label field to VimOutputPanel

This commit is contained in:
Filipp Vakhitov 2024-07-08 05:24:54 +03:00 committed by Alex Pláte
parent 9cc69e41ee
commit e515278ba3
3 changed files with 17 additions and 1 deletions
src/main/java/com/maddyhome/idea/vim
vim-engine/src/main/kotlin/com/maddyhome/idea/vim/api

View File

@ -85,6 +85,17 @@ class ExOutputModel(private val myEditor: WeakReference<Editor>) : VimOutputPane
isActiveInTestMode = newValue.isNotEmpty()
}
}
override var label: String
get() {
val notNullEditor = editor ?: return ""
val panel = ExOutputPanel.getNullablePanel(notNullEditor) ?: return ""
return panel.myLabel.text
}
set(value) {
val notNullEditor = editor ?: return
val panel = ExOutputPanel.getNullablePanel(notNullEditor) ?: return
panel.myLabel.text = value
}
fun output(text: String) {
this.text = text

View File

@ -47,7 +47,7 @@ import static com.maddyhome.idea.vim.api.VimInjectorKt.injector;
public class ExOutputPanel extends JPanel {
private final @NotNull Editor myEditor;
private final @NotNull JLabel myLabel = new JLabel("more");
public final @NotNull JLabel myLabel = new JLabel("more");
private final @NotNull JTextArea myText = new JTextArea();
private final @NotNull JScrollPane myScrollPane =
new JBScrollPane(myText, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);

View File

@ -17,6 +17,11 @@ interface VimOutputPanel {
*/
val text: String
/**
* The text in the bottom of the output panel, e.g. `-- MORE --`
*/
var label: String
/**
* Appends the specified text to the existing content of the output panel.
* If 'isNewLine' is true, the text will begin on a new line.