Hi Jason,
Sounds like you don't need it, but I think this should work (this was similar to a previous question I've asked). get_selection_oids() should return an array of all the oids in the selection. The first while loop bothers me, but so far so good:
function get_selection_oids($oids[]) {
if (!selected()) { return 0; }
local $o1 = selection_start($p1);
local $o2 = selection_end($p2);
local $cur_oid = oid_forward($o1);
$cur_oid = oid_forward($o1);
while (!oid_in_selection($cur_oid)) {
$cur_oid = oid_forward($cur_oid);
}
while (oid_in_selection($cur_oid)) {
$oids[high_bound($oids) + 1] = $cur_oid;
$cur_oid = oid_forward($cur_oid);
}
}
function oid_in_selection(oid) {
if (!selected()) { return 0; }
$o1 = selection_start($p1);
$o2 = selection_end($p2);
$offset_from_start = oid_offset($o1, $p1, $oid, 0);
$offset_from_end = oid_offset($o2, $p2, $oid, 0);
return ($offset_from_start >= 0 && $offset_from_end <= 0);
}
-James