From 81ecb9183540f69a610ae940c0467f4f0de8b3c1 Mon Sep 17 00:00:00 2001 From: Ethanfel Date: Sun, 22 Feb 2026 18:34:59 +0100 Subject: [PATCH] Fix Clone Next inserting between parent and its sub-segments When cloning a parent sequence, the new sequence now inserts after the parent's last sub-segment instead of directly after the parent. Co-Authored-By: Claude Opus 4.6 --- tab_batch.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tab_batch.py b/tab_batch.py index ec13859..661aa8d 100644 --- a/tab_batch.py +++ b/tab_batch.py @@ -280,7 +280,11 @@ def render_batch_processor(data, file_path, json_files, current_dir, selected_fi if not is_subsegment(sn): max_sn = max(max_sn, sn) new_seq[KEY_SEQUENCE_NUMBER] = max_sn + 1 - batch_list.insert(i + 1, new_seq) + if not is_subsegment(seq_num): + insert_pos = find_insert_position(batch_list, i, int(seq_num)) + else: + insert_pos = i + 1 + batch_list.insert(insert_pos, new_seq) data[KEY_BATCH_DATA] = batch_list save_json(file_path, data) st.session_state.ui_reset_token += 1