mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-21 16:05:02 +02:00
Remove option used only for testing
This commit is contained in:
@@ -195,23 +195,16 @@ type drop_status struct {
|
||||
reading_data bool
|
||||
is_remote_client bool
|
||||
|
||||
root_remote_dir *remote_dir_entry
|
||||
open_remote_dir *remote_dir_entry
|
||||
current_remote_entry *remote_dir_entry // used for m=1 only
|
||||
pending_remote_dirs []*remote_dir_entry
|
||||
remote_dir_handle_counter int32
|
||||
root_remote_dir *remote_dir_entry
|
||||
open_remote_dir *remote_dir_entry
|
||||
current_remote_entry *remote_dir_entry // used for m=1 only
|
||||
pending_remote_dirs []*remote_dir_entry
|
||||
}
|
||||
|
||||
func (d *drop_status) next_dir_handle() int32 {
|
||||
d.remote_dir_handle_counter++
|
||||
for d.remote_dir_handle_counter == 0 || d.remote_dir_handle_counter == 1 {
|
||||
d.remote_dir_handle_counter++
|
||||
}
|
||||
return d.remote_dir_handle_counter
|
||||
func (d *drop_status) reset() {
|
||||
*d = drop_status{cell_x: -1, cell_y: -1}
|
||||
}
|
||||
|
||||
var reset_drop_status = drop_status{cell_x: -1, cell_y: -1}
|
||||
|
||||
func (root *remote_dir_entry) close_tree() {
|
||||
if root.base_dir != nil {
|
||||
root.base_dir = root.base_dir.unref()
|
||||
@@ -227,7 +220,7 @@ func (dnd *dnd) end_drop() {
|
||||
dnd.drop_status.root_remote_dir.close_tree()
|
||||
dnd.drop_status.root_remote_dir = nil
|
||||
}
|
||||
dnd.drop_status = reset_drop_status
|
||||
dnd.drop_status.reset()
|
||||
dnd.render_screen()
|
||||
}
|
||||
|
||||
@@ -246,7 +239,7 @@ func (dnd *dnd) all_mime_data_dropped() (err error) {
|
||||
}
|
||||
}
|
||||
if len(drop_status.uri_list) == 0 {
|
||||
*drop_status = reset_drop_status
|
||||
dnd.drop_status.reset()
|
||||
dnd.data_has_been_dropped = true
|
||||
dnd.render_screen()
|
||||
return
|
||||
@@ -335,7 +328,7 @@ func (dnd *dnd) on_drop_move(cell_x, cell_y int, has_more bool, offered_mimes st
|
||||
}
|
||||
dnd.drop_status.in_window = cell_x > -1 && cell_y > -1
|
||||
if !dnd.drop_status.in_window || dnd.drag_started { // disallow self drag and drop
|
||||
dnd.drop_status = reset_drop_status
|
||||
dnd.drop_status.reset()
|
||||
}
|
||||
mimes_changed := !slices.Equal(prev_status.accepted_mimes, dnd.drop_status.accepted_mimes)
|
||||
needs_rerender = prev_status.action != dnd.drop_status.action || mimes_changed
|
||||
|
||||
@@ -130,16 +130,16 @@ func (dnd *dnd) run_loop() (err error) {
|
||||
if dnd.lp, err = loop.New(); err != nil {
|
||||
return err
|
||||
}
|
||||
dnd.drop_status = reset_drop_status
|
||||
dnd.drop_status.reset()
|
||||
|
||||
dnd.lp.OnInitialize = func() (string, error) {
|
||||
dnd.lp.AllowLineWrapping(false)
|
||||
dnd.lp.SetCursorVisible(false)
|
||||
if dnd.allow_drops {
|
||||
dnd.lp.StartAcceptingDrops(dnd.opts.MachineId, slices.Collect(maps.Keys(dnd.drop_dests))...)
|
||||
dnd.lp.StartAcceptingDrops("", slices.Collect(maps.Keys(dnd.drop_dests))...)
|
||||
}
|
||||
if dnd.allow_drags {
|
||||
dnd.lp.StartOfferingDrags(dnd.opts.MachineId)
|
||||
dnd.lp.StartOfferingDrags("")
|
||||
}
|
||||
dnd.lp.SetWindowTitle("Drag and drop")
|
||||
return "", dnd.render_screen()
|
||||
@@ -199,9 +199,24 @@ func (dnd *dnd) run_loop() (err error) {
|
||||
switch string(cmd.Payload) {
|
||||
case "PING":
|
||||
dnd.send_test_response("PONG")
|
||||
case "SETUP":
|
||||
case "SETUP_LOCAL", "SETUP_REMOTE":
|
||||
dnd.in_test_mode = true
|
||||
dnd.lp.NoRoundtripToTerminalOnExit()
|
||||
dnd.drop_status.reset()
|
||||
dnd.lp.StopAcceptingDrops()
|
||||
dnd.lp.StopOfferingDrags()
|
||||
machine_id := ""
|
||||
if string(cmd.Payload) == "SETUP_REMOTE" {
|
||||
machine_id = "remote-client-for-test"
|
||||
}
|
||||
if dnd.allow_drops {
|
||||
dnd.lp.StartAcceptingDrops(machine_id, slices.Collect(maps.Keys(dnd.drop_dests))...)
|
||||
}
|
||||
if dnd.allow_drags {
|
||||
dnd.lp.StartOfferingDrags(machine_id)
|
||||
}
|
||||
dnd.render_screen()
|
||||
dnd.send_test_response("SETUP_DONE")
|
||||
case "GEOMETRY":
|
||||
dnd.send_test_response(fmt.Sprintf("GEOMETRY:%d:%d:%d:%d:%d:%d:%d:%d", dnd.copy_button_region.left, dnd.copy_button_region.top, dnd.copy_button_region.width, dnd.copy_button_region.height, dnd.move_button_region.left, dnd.move_button_region.top, dnd.move_button_region.width, dnd.move_button_region.height))
|
||||
case "DROP_MIMES":
|
||||
|
||||
@@ -33,12 +33,9 @@ default=disallowed
|
||||
type=choices
|
||||
Allow dropping anywhere, not just on the Copy or Move drop regions. Dropping anywhere will perform
|
||||
the specified action.
|
||||
|
||||
|
||||
--machine-id
|
||||
The machine id to use instead of the actual machine id.
|
||||
'''.format
|
||||
|
||||
|
||||
help_text = '''\
|
||||
Perform drag and drop operations, even over SSH.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user