-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Position coincident page marks in the correct order #1274
Position coincident page marks in the correct order #1274
Conversation
If Pg123 and Pg124 were at the same location in the file, usually because Pg123 is blank, then when the page locations are loaded from the bin file and positioned in the text widget using "marks", the mark for Pg124 was inserted at the location where Pg123's mark was, and ended up before it in the text widget's internal list of marks. Loading the marks in reverse order means that coincident marks appear in alphanumeric order, which is preferable. This was assumed to be the case by the HTML generation code when set to skip coincident pagenum spans. So this fixes DistributedProofreaders#1272
This reverts commit f366b5e.
Although `markNext` iterates through the marks in order of their location, it does not guarantee an order when two marks have the same location. This could lead to some page numbers that directly followed blank pages not being output to the HTML file. To resolve it, just sort a list of page markers and use that, rather than iterating through the markers in the file. Fixes DistributedProofreaders#1272
Apologies - although the previous commit appeared to fix the problem, it only fixed some coincident page markers and broke others. The order of coincident marks does not appear to be well defined in Tk, regardless of the order they were created or their "gravity" setting. This commit just gets all the marks and sorts them by png name, so the list is guaranteed to be in page order. |
@@ -1245,20 +1245,19 @@ sub html_convert_sidenotes { | |||
sub html_convert_pageanchors { | |||
my $textwindow = $::textwindow; | |||
::working("Inserting Page Number Markup"); | |||
$|++; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this even do? (perl, you are weird)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also known as $OUTPUT_AUTOFLUSH
it apparently forces immediate flushing on every write
or print
. I did wonder (given the relative infrequency that I would have thought it is needed) why someone though it necessary to have $|
as a short version of the full variable name. At the bottom of the docs, it had this explanation:
Mnemonic: when you want your pipes to be piping hot.
As you say, perl is weird 🤣
Testing notes for @srjfoo |
If Pg123 and Pg124 were at the same location in the file, usually because Pg123 is blank, then when the page locations are loaded from the bin file and positioned in the text widget using "marks", the mark for Pg124 was inserted at the location where Pg123's mark was, and ended up before it in the text widget's internal list of marks.
Loading the marks in reverse order means that coincident marks appear in alphanumeric order, which is preferable.
This was assumed to be the case by the HTML generation code when set to skip coincident pagenum spans. So this fixes #1272