From time to time I lose breakpoint functionality in Delphi.
I thought this to be a Delphi 2009 issue but now I have also it in Delphi XE.
In Delphi 2009 by
Here's one more reason to misaligned code vs breakpoint markers (blue/red "pill" in the gutter).
The editor recognices three different line endings,
Of these, CRLF
is the default in the editor.
The compiler however, doesn't seem to consider CR only
as a line ending, only CRLF
and LF only
. Thus if your source file happens to have one or more CR only
, the "blue pills" will be offset from the source.
You might have got source files with CR only
EOL (end of line) character from e.g. the internet. I recall MAC OS used CR only
as EOL.
To verify the EOL's in your file, you can turn on the displaying of EOL's in the editor
( Tools - Options - Editor options - Source options - Show line breaks)
.
The symbols look weird (see images below), but are just C on top of L for CRLF, C on top of R for CR and L on top of F for LF.
The following images show the normal EOL's (CRLF
) and the EOLS's after I forced CR only
for one line and LF only
for another line in a hex editor. As said above, it is the CR only
that offsets the break point markers from the source code.
Normal CRLF
EOL's:
One line with CR only
and one with LF only
:
Fix
To reset all EOL's to CRLF
, untick Preserve line ends
in Editor Options
( Tools - Options - Editor options)
,
make a trivial change, so that the file is marked as modified, close the file, save changes to XYZ.pas? YES, and reopen.
Now all line endings are CRLF. Rebuilt the project and all the breakpoint balls will be in the correct locations.