mirror of
https://github.com/carlrobertoh/ProxyAI.git
synced 2026-05-10 03:59:43 +00:00
fix: disable submission when current response is ongoing
This commit is contained in:
parent
dc8dcb1564
commit
71dd9463c4
2 changed files with 10 additions and 9 deletions
|
|
@ -65,12 +65,18 @@ class PromptTextField(
|
|||
IdeEventQueue.getInstance().addDispatcher(
|
||||
PromptTextFieldEventDispatcher(this, suggestionsPopupManager, appliedInlays) {
|
||||
onSubmit(text, appliedInlays)
|
||||
clear()
|
||||
},
|
||||
this
|
||||
)
|
||||
}
|
||||
|
||||
fun clear() {
|
||||
runInEdt {
|
||||
text = ""
|
||||
clearInlays()
|
||||
}
|
||||
}
|
||||
|
||||
fun addInlayElement(actionPrefix: String, text: String?, actionItem: SuggestionActionItem?) {
|
||||
editor?.let {
|
||||
var startOffset = it.document.text.lastIndexOf(AT_CHAR)
|
||||
|
|
@ -150,13 +156,6 @@ class PromptTextField(
|
|||
clear()
|
||||
}
|
||||
|
||||
private fun clear() {
|
||||
runInEdt {
|
||||
text = ""
|
||||
clearInlays()
|
||||
}
|
||||
}
|
||||
|
||||
private fun clearInlays() {
|
||||
runUndoTransparentWriteAction {
|
||||
appliedInlays.forEach { it.inlay.dispose() }
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ class UserInputPanel(
|
|||
) {
|
||||
override fun actionPerformed(e: AnActionEvent) {
|
||||
handleSubmit(promptTextField.text)
|
||||
promptTextField.clear()
|
||||
}
|
||||
}
|
||||
)
|
||||
|
|
@ -134,8 +135,9 @@ class UserInputPanel(
|
|||
override fun getInsets(): Insets = JBUI.insets(4)
|
||||
|
||||
private fun handleSubmit(text: String, appliedInlays: List<AppliedActionInlay>? = emptyList()) {
|
||||
if (text.isNotEmpty()) {
|
||||
if (text.isNotEmpty() && submitButton.isEnabled) {
|
||||
onSubmit(text, appliedInlays)
|
||||
promptTextField.clear()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue