Skip to content

Commit dcce777

Browse files
committed
fix: fix terminal key protocol selection logic
This change was merged to main already, but we need it for v2 as well. This fixes things for both WezTerm and for win32-input-mode in general.
1 parent 7631923 commit dcce777

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

tscreen.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -320,21 +320,17 @@ func (t *tScreen) prepareExtendedOSC() {
320320
}
321321

322322
if t.enableCsiU == "" && t.ti.XTermLike {
323-
if runtime.GOOS == "windows" && (os.Getenv("TERM") == "" || os.Getenv("TERM_PROGRAM") == "WezTerm") {
323+
if runtime.GOOS == "windows" && os.Getenv("TERM") == "" {
324324
// on Windows, if we don't have a TERM, use only win32-input-mode
325325
t.enableCsiU = "\x1b[?9001h"
326326
t.disableCsiU = "\x1b[?9001l"
327-
} else if os.Getenv("TERM_PROGRAM") == "WezTerm" {
328-
// WezTerm is unhappy if we ask for other modes
329-
t.enableCsiU = "\x1b[>1u"
330-
t.disableCsiU = "\x1b[<u"
331327
} else {
332328
// three advanced keyboard protocols:
333329
// - xterm modifyOtherKeys (uses CSI 27 ~ )
334330
// - kitty csi-u (uses CSI u)
335331
// - win32-input-mode (uses CSI _)
336-
t.enableCsiU = "\x1b[>4;2m" + "\x1b[>1u" + "\x1b[9001h"
337-
t.disableCsiU = "\x1b[9001l" + "\x1b[<u" + "\x1b[>4;0m"
332+
t.enableCsiU = "\x1b[>4;2m" + "\x1b[>1u" + "\x1b[?9001h"
333+
t.disableCsiU = "\x1b[?9001l" + "\x1b[<u" + "\x1b[>4;0m"
338334
}
339335
}
340336
}

0 commit comments

Comments
 (0)