fix: keep measures_to_force_display a valid set of in-range indices - #576
Open
FelipeDefensor wants to merge 2 commits into
Open
fix: keep measures_to_force_display a valid set of in-range indices#576FelipeDefensor wants to merge 2 commits into
FelipeDefensor wants to merge 2 commits into
Conversation
force_display_measure_number appended unconditionally, so setting a measure number to a value it already had left a second entry in measures_to_force_display. unforce_display_measure_number removes a single occurrence, so one "Reset measure number" was no longer enough to hide the label again, and the duplicates were written to the .tla file. Easy to hit by accident: the number is applied to every selected measure, so re-confirming a number for one measure re-forces all of them.
reduce_measure_numbers popped from the tail of measures_to_force_display while the last index was out of range. The list is appended to in the order the user edits measures and is never sorted, so an out-of-range index sitting before an in-range one survived the pruning. Those stale indices are saved to the .tla file and resurface as spuriously displayed measure numbers once the timeline grows back.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two independent bugs in how
BeatTimelinemaintainsmeasures_to_force_display. The list is treated everywhere as a set of in-range measure indices, but nothing enforced either property.1. The same measure could be forced twice.
force_display_measure_numberappended unconditionally, so setting a measure number to a value it already had left a second entry.unforce_display_measure_numberremoves a single occurrence, so one "Reset measure number" was no longer enough to hide the label again — and the duplicates were written to the.tlafile.Easy to hit by accident, since the number is applied to every selected measure: re-confirming a number for one measure re-forces all of them.
2. Out-of-range indices survived pruning.
reduce_measure_numberspopped from the tail of the list while the last index was out of range. But the list is appended to in the order the user edits measures and is never sorted, so an out-of-range index sitting before an in-range one was left behind. Those stale indices are saved to the file and resurface as spuriously displayed measure numbers once the timeline grows back.Found while reviewing #480, but independent of it — opened off
devrather than folded into that branch.Test plan
test_set_measure_number_twice_forces_display_once— backend, fails ondevwith[1, 1] == [1]test_reset_measure_number_unforces_display_after_repeated_sets— backend, fails ondevwith[1, 1] == []test_reduce_measure_numbers_drops_forced_display_out_of_range— backend, fails ondevwith[4, 1] == [1]test_reset_measure_number_hides_label_set_more_than_once— end-to-end through the commands; fails ondevwith'2' == '', i.e. the label stays visible after ResetManual check
🤖 Generated with Claude Code