[PATCH] SynEdit selects improper part of UTF8 text when Persistent Block option is active
Original Reporter info from Mantis: Bartek Dajewski
-
Reporter name: Bartek Dajewski
Original Reporter info from Mantis: Bartek Dajewski
- Reporter name: Bartek Dajewski
Description:
Hello,
TSynEdit component selects improper part of text if there are UTF8 characters before the caret. So does the IDE source editor. This behaviour depends on "Persistent block" option (or eoPersistentBlock in TSynEdit component).
The attached patch resolved this issue for me.
[OT] English is not my native language, so I apologize for any possible spelling and grammar mistakes.
Steps to reproduce:
Make sure the "Persistent block" option is active (Tools/Options/Editor).
- Place some text containing UTF8 characters in the editor window. Ex.:
e=mc², A=πr², e^(πi)+1=0
- Place the caret at the end of that line.
- Press Shift+Left Arrow
or
try to select last "0" with mouse.
Editor should select last character ("0"), but instead it selects three characters to the left of the caret ("+1="). Zero remains unselected.
Additional information:
Attached patch changes one line in TSynEditSelection.DoCaretChanged method:
StartLineBytePos := FCaret.OldLineBytePos;
instead of previous:
StartLineBytePos := Point(FCaret.OldCharPos, FCaret.OldLinePos);
Modified method is using only (...)BytePos coordinates without mixing them with (...)CharPos.
Mantis conversion info:
- Mantis ID: 32667
- Version: 1.6
- Fixed in revision: r56357 (#9ac7781f)