mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-06 01:05:48 +02:00
Merge branch 'copilot/implement-exit-on-flag' of https://github.com/kovidgoyal/kitty
This commit is contained in:
@@ -227,7 +227,11 @@ func (dnd *dnd) on_drag_event(x, y, operation, Y int) (err error) {
|
||||
case 3:
|
||||
dnd.drag_status.dropped = true
|
||||
case 4:
|
||||
was_dropped := dnd.drag_status.dropped
|
||||
dnd.reset_drag()
|
||||
if was_dropped && dnd.has_exit_on("drag-finish") {
|
||||
dnd.lp.Quit(0)
|
||||
}
|
||||
case 5:
|
||||
if err = dnd.handle_data_request(y, Y == 1); err != nil {
|
||||
return err
|
||||
|
||||
@@ -467,6 +467,9 @@ func (dnd *dnd) end_drop(success bool) {
|
||||
}
|
||||
}
|
||||
dnd.reset_drop()
|
||||
if success && dnd.has_exit_on("drop-finish") {
|
||||
dnd.lp.Quit(0)
|
||||
}
|
||||
}
|
||||
|
||||
func (dnd *dnd) all_drop_data_received() (err error) {
|
||||
|
||||
@@ -103,6 +103,15 @@ func (dnd *dnd) send_test_response(payload string) {
|
||||
dnd.lp.DebugPrintln(payload)
|
||||
}
|
||||
|
||||
func (dnd *dnd) has_exit_on(event string) bool {
|
||||
for _, e := range strings.Split(dnd.opts.ExitOn, ",") {
|
||||
if strings.TrimSpace(e) == event {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (dnd *dnd) setup_base_dir(base_dir string) (err error) {
|
||||
if dnd.drop_output_dir != nil {
|
||||
dnd.drop_output_dir.Close()
|
||||
@@ -281,7 +290,11 @@ func (dnd *dnd) run_loop() (err error) {
|
||||
return dnd.drop_confirm(true)
|
||||
}
|
||||
}
|
||||
if e.MatchesPressOrRepeat("ctrl+c") || e.MatchesPressOrRepeat("esc") {
|
||||
if e.MatchesPressOrRepeat("ctrl+c") {
|
||||
dnd.lp.Quit(0)
|
||||
return
|
||||
}
|
||||
if e.MatchesPressOrRepeat("esc") && dnd.has_exit_on("esc-key") {
|
||||
dnd.lp.Quit(0)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user