@@ -56,7 +56,9 @@ export class LoginDialogComponent extends Container implements Focusable {
|
||||
this.input = new Input();
|
||||
this.input.onSubmit = () => {
|
||||
if (this.inputResolver) {
|
||||
this.inputResolver(this.input.getValue());
|
||||
const value = this.input.getValue();
|
||||
this.replaceInputWithSubmittedText(value);
|
||||
this.inputResolver(value);
|
||||
this.inputResolver = undefined;
|
||||
this.inputRejecter = undefined;
|
||||
}
|
||||
@@ -73,6 +75,12 @@ export class LoginDialogComponent extends Container implements Focusable {
|
||||
return this.abortController.signal;
|
||||
}
|
||||
|
||||
private replaceInputWithSubmittedText(value: string): void {
|
||||
this.contentContainer.children = this.contentContainer.children.map((child) =>
|
||||
child === this.input ? new Text(`> ${value}`, 0, 0) : child,
|
||||
);
|
||||
}
|
||||
|
||||
private cancel(): void {
|
||||
this.abortController.abort();
|
||||
if (this.inputRejecter) {
|
||||
@@ -128,6 +136,7 @@ export class LoginDialogComponent extends Container implements Focusable {
|
||||
* Show input for manual code/URL entry (for callback server providers)
|
||||
*/
|
||||
showManualInput(prompt: string): Promise<string> {
|
||||
this.input.setValue("");
|
||||
this.contentContainer.addChild(new Spacer(1));
|
||||
this.contentContainer.addChild(new Text(theme.fg("dim", prompt), 1, 0));
|
||||
this.contentContainer.addChild(this.input);
|
||||
|
||||
Reference in New Issue
Block a user