Terminal hotfix.
This commit is contained in:
@@ -18,10 +18,10 @@ public class CH5 extends CSISequenceHandler { // Combined Handler 5 (XTSMPOINTER
|
||||
} else if (state.dollarSign) { // DECRQM
|
||||
int mode = args[0];
|
||||
if (state.questionMark) { // DECSET/DECRST
|
||||
terminal.putResponse("\033[?" + mode + ";" + (terminal.currentPrivateModeState.getMode(mode) ? 1 : 0) + "$y");
|
||||
terminal.putResponse("\033[?" + mode + ";" + terminal.currentPrivateModeState.getModeForRequest(mode) + "$y");
|
||||
}
|
||||
else { // SM/RM
|
||||
terminal.putResponse("\033[" + mode + ";" + (terminal.currentModeState.getMode(mode) ? 1 : 0) + "$y");
|
||||
terminal.putResponse("\033[" + mode + ";" + terminal.currentModeState.getModeForRequest(mode) + "$y");
|
||||
}
|
||||
} else { // XTPUSHSGR
|
||||
System.out.println("XTPUSHSGR not implemented");
|
||||
|
||||
@@ -9,13 +9,20 @@ public class ModeState {
|
||||
public boolean SRM = false;
|
||||
public boolean LNM = false;
|
||||
|
||||
public boolean getMode(int mode) {
|
||||
public int getModeForRequest(int mode) {
|
||||
Boolean modeState = getMode(mode);
|
||||
if (modeState == null) return 0;
|
||||
if (modeState) return 1;
|
||||
return 2;
|
||||
}
|
||||
|
||||
public Boolean getMode(int mode) {
|
||||
return switch (mode) {
|
||||
case 2 -> KAM;
|
||||
case 4 -> IRM;
|
||||
case 12 -> SRM;
|
||||
case 20 -> LNM;
|
||||
default -> throw new IndexOutOfBoundsException();
|
||||
default -> null;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package li.cil.oc2.common.vm.terminal.modes;
|
||||
|
||||
import li.cil.ceres.api.Serialized;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -82,7 +83,15 @@ public class PrivateModeState {
|
||||
public boolean APPLICATION_SYNC = false;
|
||||
public boolean APPLICATION_ESC_MODE = false;
|
||||
|
||||
public boolean getMode(int mode) {
|
||||
public int getModeForRequest(int mode) {
|
||||
Boolean modeState = getMode(mode);
|
||||
if (modeState == null) return 0;
|
||||
if (modeState) return 1;
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Boolean getMode(int mode) {
|
||||
return switch (mode) {
|
||||
case 1 -> DECCKM;
|
||||
case 2 -> DECANM;
|
||||
@@ -158,7 +167,7 @@ public class PrivateModeState {
|
||||
case 2006 -> ENABLE_READLINE_NEWLINE_PASTE;
|
||||
case 2026 -> APPLICATION_SYNC;
|
||||
case 7727 -> APPLICATION_ESC_MODE;
|
||||
default -> throw new IndexOutOfBoundsException();
|
||||
default -> null;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user