Skip to content

Commit

Permalink
Make myInputInterceptor private
Browse files Browse the repository at this point in the history
  • Loading branch information
lippfi authored and AlexPl292 committed Jul 17, 2024
1 parent f4414de commit 90d36ee
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/main/java/com/maddyhome/idea/vim/ui/ex/ExEntryPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public class ExEntryPanel extends JPanel implements VimCommandLine {
private boolean isReplaceMode = false;
private WeakReference<Editor> weakEditor = null;

public VimInputInterceptor myInputInterceptor = null;
private VimInputInterceptor myInputInterceptor = null;
public Function1<String, Unit> inputProcessing = null;
public Character finishOn = null;

Expand Down Expand Up @@ -569,7 +569,7 @@ public void focus() {
IdeFocusManager.findInstance().requestFocus(entry, true);
}

@NotNull
@Nullable
public VimInputInterceptor<?> getInputInterceptor() {
return myInputInterceptor;
}
Expand All @@ -579,7 +579,7 @@ public void insertText(int offset, @NotNull String string) {
VimCommandLine.super.insertText(offset, string);
}

public void setInputInterceptor(@NotNull VimInputInterceptor<?> vimInputInterceptor) {
public void setInputInterceptor(@Nullable VimInputInterceptor<?> vimInputInterceptor) {
myInputInterceptor = vimInputInterceptor;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,21 +147,21 @@ class ExEntryPanelService : VimCommandLineServiceBase(), VimModalInputService {
}

override fun getCurrentModalInput(): VimModalInput? {
return ExEntryPanel.getInstanceWithoutShortcuts()?.takeIf { it.isActive && it.myInputInterceptor != null }?.let { WrappedAsModalInputExEntryPanel(it) }
return ExEntryPanel.getInstanceWithoutShortcuts()?.takeIf { it.isActive && it.inputInterceptor != null }?.let { WrappedAsModalInputExEntryPanel(it) }
}

override fun create(editor: VimEditor, context: ExecutionContext, label: String, inputInterceptor: VimInputInterceptor<*>): VimModalInput {
val panel = ExEntryPanel.getInstanceWithoutShortcuts()
panel.myInputInterceptor = inputInterceptor
panel.inputInterceptor = inputInterceptor
panel.activate(editor.ij, context.ij, label, "")
return WrappedAsModalInputExEntryPanel(panel)
}
}

internal class WrappedAsModalInputExEntryPanel(internal val exEntryPanel: ExEntryPanel) : VimModalInputBase() {
override var inputInterceptor: VimInputInterceptor<*>
get() = exEntryPanel.myInputInterceptor
set(value) { exEntryPanel.myInputInterceptor = value }
get() = exEntryPanel.inputInterceptor!!
set(value) { exEntryPanel.inputInterceptor = value }
override val caret: VimCommandLineCaret = exEntryPanel.caret
override val label: String = exEntryPanel.label

Expand Down

0 comments on commit 90d36ee

Please sign in to comment.