Open cqx931 opened 4 years ago
When a unit is smaller than b unit
Make use of the margin-left & margin-right space. So the b unit will grow out of the current paragraph width, as wide as the last word can fit before the beginning of the next a unit.
When there is enough space for b overall, but not enough space for b before/after for the best shared span.
We can use the same strategy as above for this scenario if we want the shared span to always stay in the same position. Another potential way of solving this is to shift the b content more the left/right so that it can fit into space, but the anchored shared span has to move in this case.
When there is enough space for b overall, but word-wrap causes tiny overlaps between the overlay and the rest of the adiv.
We could potentially break up the word if necessary, but if that's not a good idea, we can still fall back to one of the solutions above.
I've been through these and for some of them made edits to the A_file
which hack out the particular anomaly. But of course it will be necessary to have an animation that can deal with longer (and eventually much longer) replacement texts.
The principle of using margin-left and margin-right space is possible for all instances we've found so far and might be the best way to go for now.
In a speculative future, we should be able to handle the situation that would arise when, for example, we swap these particular A and B files. (Interesting to do this, just by running the git dif command with a_file.txt
and b_file.txt
swapped.)
In this future – or maybe there's a not-so-difficult way to do this now? – A_file
units below the activated units would have to be shifted downwards by the number of typographic lines needed ... until mouse exit from the b_file
unit, when they'd be moved back.
Cases where there's not enough space before or after the best anchor:
I'm pushing a commit that fixes some of the specific things you found, but definitely leaves the instance in section 15 as is, for an implementation.
We still need to figure out the following positioning issues that haven't been addressed yet in the code:
Examples:
Section4:
Section 6:
Section 7:
Section 15: