1
0
Fork 0

Route-manager dialog: default to appending

Rather than warning in the case where there is no selected, default
to appending new waypoints, since this is a fairly common case.
This commit is contained in:
James Turner 2019-01-16 11:12:23 +00:00
parent f6fd864394
commit 29ec71b3a6

View file

@ -44,11 +44,7 @@ command interface /autopilot/route-manager/input:
var insert = func {
var insertIndex = sel_index();
if (insertIndex < 0) {
var msg = "Select the waypoint after which new waypoints should be added";
setprop("sim/messages/copilot", msg);
return;
}
var appending = (insertIndex < 0);
# Input is a list of space-separated waypoint specifications
var argv = split(" ", input.getValue());
@ -56,8 +52,12 @@ command interface /autopilot/route-manager/input:
# When argument is not empty (caused by multiple space
# separators) insert *after* waypoint
if (size(arg) > 0) {
insertIndex += 1;
cmd.setValue("@insert" ~ insertIndex ~ ":" ~ arg);
if (appending) {
cmd.setValue(arg);
} else {
insertIndex += 1;
cmd.setValue("@insert" ~ insertIndex ~ ":" ~ arg);
}
}
}