pyscripter / SynEdit

SynEdit is a syntax highlighting edit control, not based on the Windows common controls.
26 stars 11 forks source link

Printing seems to ignore final line if not terminated with a CRLF. #74

Closed MShark67 closed 2 weeks ago

MShark67 commented 11 months ago

I just noticed this the other day. This can be tested with the TestPP project in the print demo. Just type a single line and don't press enter at the end. Then print preview (or print) and see that the line text does not get printed. If you type more lines, any non-terminated final line will not be in the print preview.

MShark67 commented 10 months ago

A very tentative change that might fix it. I haven't tested this extensively. In SynEditPrint lines 547-548. I just changed the 1 to a 0 in that second line.

      if YPos + LayoutRowCount * FLineHeight >= ClipR.Top then
        if (I = FPages[Num - 1].FirstLine) and (FPages[Num - 1].FirstRow > 0) then

-Mark (My environment is in flux right now with the switch to Delphi 12 btw.

pyscripter commented 10 months ago

@MShark67 Actually the problem is in CalcPages.

The issue should be solved (please confirm) if you replace

    if I = iEndLine then
      PageLine.LastLine := I;

with

    if I = iEndLine then
    begin
      PageLine.LastLine := I;
      PageLine.LastRow := LayoutRowCount;
    end;

at the end of the routine. I have applied this and a couple of more fixes of corner cases to the multicaret branch (teaser). They will be eventually merged to master.

MShark67 commented 10 months ago

Confirming your fix works great and that's quite the teaser! Nicely done!

pyscripter commented 2 weeks ago

The multicaret stuff has been moving slowly, so I merged the SynEditPrint changes back to master. Could you please check one more time?