feat: revert, clear and the source's own line, under the text box - #106
Merged
Conversation
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
The row of four under the text box, which is where the reference puts it and where Sublore had nothing. Revert puts the line back to what it was when the cursor arrived on it. Clear empties it. Clear text keeps every braced run where it stands and drops only the words a reader sees. Insert original puts the source's line for that row where the caret is.
The two clears are one planner edit,
Edit::ClearText { cue, keep_tags }, because keeping the runs needs the block scanner that already lives insublore-formatsand the difference between the two is one filter. They are their own edit kind, so a clear and the typing around it can never coalesce into one undo step.Insert original is what M2.6's source document made possible: before it, the reference's own answer was a remembered string and Sublore had nothing to remember. It splices in UTF-8 bytes rather than code units, because the caret the backend reports is counted in bytes and a code-unit slice lands in the wrong place the moment a line carries a character outside the Latin block, which a translation usually does.
One thing came out of writing the checks: the condition the style buttons grey on wanted ASS, and Insert original is not a tag write, so the two are now separate. A caret on the cursor's row is what both need; only the tag writes additionally need a format that carries tags.
Changes
Edit::ClearTextandplan_clear_text, which keeps every block that is not words when asked.subtitle_clear_text, registered.clearText.How to verify it by using the app
fixtures/subtitles/ass/clean/speakers.ass. Under the text box there are four buttons: Revert, Clear, Clear text, Insert original.{\b1}bold{\b0} and plaininto the box and commit it the same way. Click Clear text: the words go and{\b1}{\b0}stays. Click Clear: the rest goes too. Ctrl+Z once puts back exactly what Clear text left, because they are two steps.Verified on Linux: full gate green step by step, and the battery green at 35 spec files of 35 with 291 checks. Two mutations each reddened its own check first, a Clear text that keeps the words instead of the runs, and an insert that lands at the end of the line instead of at the caret.