mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-08 14:18:26 +02:00
diff kitten: Abort when run inside a terminal that does not support the kitty keyboard protocol
Fixes #8185
This commit is contained in:
@@ -93,6 +93,8 @@ Detailed list of changes
|
|||||||
|
|
||||||
- ssh kitten: Fix kitten not being on PATH when SSHing into Debian systems (:iss:`7160`)
|
- ssh kitten: Fix kitten not being on PATH when SSHing into Debian systems (:iss:`7160`)
|
||||||
|
|
||||||
|
- diff kitten: Abort when run inside a terminal that does not support the kitty keyboard protocol (:iss:`8185`)
|
||||||
|
|
||||||
0.38.1 [2024-12-26]
|
0.38.1 [2024-12-26]
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
|||||||
@@ -146,9 +146,16 @@ func main(_ *cli.Command, opts_ *Options, args []string) (rc int, err error) {
|
|||||||
lp.SetCursorShape(loop.BAR_CURSOR, true)
|
lp.SetCursorShape(loop.BAR_CURSOR, true)
|
||||||
lp.AllowLineWrapping(false)
|
lp.AllowLineWrapping(false)
|
||||||
lp.SetWindowTitle(fmt.Sprintf("%s vs. %s", left, right))
|
lp.SetWindowTitle(fmt.Sprintf("%s vs. %s", left, right))
|
||||||
|
lp.QueryCapabilities()
|
||||||
h.initialize()
|
h.initialize()
|
||||||
return "", nil
|
return "", nil
|
||||||
}
|
}
|
||||||
|
lp.OnCapabilitiesReceived = func(tc loop.TerminalCapabilities) error {
|
||||||
|
if !tc.KeyboardProtocol {
|
||||||
|
return fmt.Errorf("This terminal does not support the kitty keyboard protocol, or you are running inside a terminal multiplexer that is blocking querying for kitty keyboard protocol support. The diff kitten cannot function without it.")
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
lp.OnWakeup = h.on_wakeup
|
lp.OnWakeup = h.on_wakeup
|
||||||
lp.OnFinalize = func() string {
|
lp.OnFinalize = func() string {
|
||||||
lp.SetCursorVisible(true)
|
lp.SetCursorVisible(true)
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ type Loop struct {
|
|||||||
OnSIGTERM func() (bool, error)
|
OnSIGTERM func() (bool, error)
|
||||||
|
|
||||||
// Called when capabilities response is received
|
// Called when capabilities response is received
|
||||||
OnCapabilitiesReceived func(TerminalCapabilities)
|
OnCapabilitiesReceived func(TerminalCapabilities) error
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(options ...func(self *Loop)) (*Loop, error) {
|
func New(options ...func(self *Loop)) (*Loop, error) {
|
||||||
|
|||||||
@@ -128,7 +128,9 @@ func (self *Loop) handle_csi(raw []byte) (err error) {
|
|||||||
if strings.HasPrefix(csi, "?") && strings.HasSuffix(csi, "c") {
|
if strings.HasPrefix(csi, "?") && strings.HasSuffix(csi, "c") {
|
||||||
self.waiting_for_capabilities_response = false
|
self.waiting_for_capabilities_response = false
|
||||||
if self.OnCapabilitiesReceived != nil {
|
if self.OnCapabilitiesReceived != nil {
|
||||||
self.OnCapabilitiesReceived(self.TerminalCapabilities)
|
if err = self.OnCapabilitiesReceived(self.TerminalCapabilities); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if strings.HasPrefix(csi, "?997;") && strings.HasSuffix(csi, "n") {
|
} else if strings.HasPrefix(csi, "?997;") && strings.HasSuffix(csi, "n") {
|
||||||
switch csi[len(csi)-2] {
|
switch csi[len(csi)-2] {
|
||||||
|
|||||||
Reference in New Issue
Block a user