View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0032667 | Lazarus | IDE | public | 2017-11-09 00:54 | 2018-12-18 21:15 |
Reporter | Bartek Dajewski | Assigned To | Juha Manninen | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | 1.6 | ||||
Summary | 0032667: [PATCH] SynEdit selects improper part of UTF8 text when Persistent Block option is active | ||||
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). 1. Place some text containing UTF8 characters in the editor window. Ex.: e=mc², A=πr², e^(πi)+1=0 2. Place the caret at the end of that line. 3. 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. | ||||
Tags | No tags attached. | ||||
Fixed in Revision | r56357 | ||||
LazTarget | - | ||||
Widgetset | |||||
Attached Files |
|
|
TSynEditSelection.diff (591 bytes)
Index: lazarus/components/synedit/syneditpointclasses.pas =================================================================== --- lazarus/components/synedit/syneditpointclasses.pas (wersja 56337) +++ lazarus/components/synedit/syneditpointclasses.pas (kopia robocza) @@ -1736,7 +1736,7 @@ FAltStartBytePos := -1; end else begin - StartLineBytePos := Point(FCaret.OldCharPos, FCaret.OldLinePos); + StartLineBytePos := FCaret.OldLineBytePos; EndLineBytePos := FCaret.LineBytePos; if Persistent and IsBackwardSel then SortSelectionPoints; |
|
I cannot reproduce with Lazarus trunk. I tested on Linux with GTK2 and QT bindings, and on Windows with Win32 bindings. Please test again with trunk or Lazarus 1.8RCx. |
|
That's strange... I cannot not reproduce it ;-) I've checked it once more from the very beginning. Describing step by step: - I’ve downloaded https://sourceforge.net/projects/lazarus/files/Lazarus%20Zip%20_%20GZip/Lazarus%201.8.0RC5/ - make clean bigide - lazarus.exe --pcp=MyTempConfDir (empty project started as usual) - Then I’ve set "Persistent block" checkbox in Tools->Options->Editor. - Finally I've pasted example text, i.e. "e=mc², A=πr², e^(πi)+1=0" into an empty line in the source editor window and pressed Shift+Left Arrow That's all. Selected fragment is "+1=" Now tested on Windows 10 64bit, but before it was checked by me on the Win7/64 and WinXP/32 as well. Reproduced with lazarus 1.6.0, 1.6.2 binaries on all above Windows versions and with fresh compilation of 1.9.0 trunk (rev 56337). |
|
Oops, it was poorly tested from my side. The bug is real and your patch actually helps. Applied, thanks. |
Date Modified | Username | Field | Change |
---|---|---|---|
2017-11-09 00:54 | Bartek Dajewski | New Issue | |
2017-11-09 00:54 | Bartek Dajewski | File Added: TSynEditSelection.diff | |
2017-11-10 10:52 | Juha Manninen | LazTarget | => - |
2017-11-10 10:52 | Juha Manninen | Note Added: 0103991 | |
2017-11-10 10:52 | Juha Manninen | Assigned To | => Juha Manninen |
2017-11-10 10:52 | Juha Manninen | Status | new => feedback |
2017-11-10 22:27 | Bartek Dajewski | Note Added: 0103995 | |
2017-11-10 22:27 | Bartek Dajewski | Status | feedback => assigned |
2017-11-11 00:11 | Juha Manninen | Fixed in Revision | => r56357 |
2017-11-11 00:11 | Juha Manninen | Note Added: 0103996 | |
2017-11-11 00:11 | Juha Manninen | Status | assigned => resolved |
2017-11-11 00:11 | Juha Manninen | Resolution | open => fixed |