fix: optional PTY emulation
This commit is contained in:
parent
4f4e33c577
commit
ec9d95eb10
3 changed files with 13 additions and 2 deletions
|
@ -17,6 +17,11 @@ Changelog structure reference:
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Project
|
||||||
|
- PTY emulation is now opt-in in run configurations
|
||||||
|
|
||||||
## [15.1.0]
|
## [15.1.0]
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
|
@ -57,7 +57,7 @@ public abstract class ProfileStateBase<T extends ZigExecConfigBase<T>> extends C
|
||||||
|
|
||||||
// TODO remove this check once JetBrains implements colored terminal in the debugger
|
// TODO remove this check once JetBrains implements colored terminal in the debugger
|
||||||
// https://youtrack.jetbrains.com/issue/CPP-11622/ANSI-color-codes-not-honored-in-Debug-Run-Configuration-output-window
|
// https://youtrack.jetbrains.com/issue/CPP-11622/ANSI-color-codes-not-honored-in-Debug-Run-Configuration-output-window
|
||||||
val cli = debug ? new GeneralCommandLine() : new PtyCommandLine();
|
val cli = configuration.emulateTerminal() && !debug ? new PtyCommandLine() : new GeneralCommandLine();
|
||||||
cli.setExePath(zigExecutablePath.toString());
|
cli.setExePath(zigExecutablePath.toString());
|
||||||
workingDirectory.getPath().ifPresent(x -> cli.setWorkDirectory(x.toFile()));
|
workingDirectory.getPath().ifPresent(x -> cli.setWorkDirectory(x.toFile()));
|
||||||
cli.setCharset(StandardCharsets.UTF_8);
|
cli.setCharset(StandardCharsets.UTF_8);
|
||||||
|
|
|
@ -38,6 +38,7 @@ import java.util.Optional;
|
||||||
@Getter
|
@Getter
|
||||||
public abstract class ZigExecConfigBase<T extends ZigExecConfigBase<T>> extends LocatableConfigurationBase<ProfileStateBase<T>> {
|
public abstract class ZigExecConfigBase<T extends ZigExecConfigBase<T>> extends LocatableConfigurationBase<ProfileStateBase<T>> {
|
||||||
private ZigConfigEditor.WorkDirectoryConfigurable workingDirectory = new ZigConfigEditor.WorkDirectoryConfigurable("workingDirectory");
|
private ZigConfigEditor.WorkDirectoryConfigurable workingDirectory = new ZigConfigEditor.WorkDirectoryConfigurable("workingDirectory");
|
||||||
|
private ZigConfigEditor.CheckboxConfigurable pty = new ZigConfigEditor.CheckboxConfigurable("pty", "Emulate Terminal", false);
|
||||||
public ZigExecConfigBase(@NotNull Project project, @NotNull ConfigurationFactory factory, @Nullable String name) {
|
public ZigExecConfigBase(@NotNull Project project, @NotNull ConfigurationFactory factory, @Nullable String name) {
|
||||||
super(project, factory, name);
|
super(project, factory, name);
|
||||||
workingDirectory.setPath(getProject().isDefault() ? null : Optional.ofNullable(ProjectUtil.guessProjectDir(getProject()))
|
workingDirectory.setPath(getProject().isDefault() ? null : Optional.ofNullable(ProjectUtil.guessProjectDir(getProject()))
|
||||||
|
@ -64,10 +65,15 @@ public abstract class ZigExecConfigBase<T extends ZigExecConfigBase<T>> extends
|
||||||
|
|
||||||
public abstract List<String> buildCommandLineArgs(boolean debug) throws ExecutionException;
|
public abstract List<String> buildCommandLineArgs(boolean debug) throws ExecutionException;
|
||||||
|
|
||||||
|
public boolean emulateTerminal() {
|
||||||
|
return pty.value;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public T clone() {
|
public T clone() {
|
||||||
val myClone = (ZigExecConfigBase<?>) super.clone();
|
val myClone = (ZigExecConfigBase<?>) super.clone();
|
||||||
myClone.workingDirectory = workingDirectory.clone();
|
myClone.workingDirectory = workingDirectory.clone();
|
||||||
|
myClone.pty = pty.clone();
|
||||||
return (T) myClone;
|
return (T) myClone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,6 +85,6 @@ public abstract class ZigExecConfigBase<T extends ZigExecConfigBase<T>> extends
|
||||||
throws ExecutionException;
|
throws ExecutionException;
|
||||||
|
|
||||||
public @NotNull List<ZigConfigEditor.@NotNull ZigConfigurable<?>> getConfigurables() {
|
public @NotNull List<ZigConfigEditor.@NotNull ZigConfigurable<?>> getConfigurables() {
|
||||||
return List.of(workingDirectory);
|
return List.of(workingDirectory, pty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue