View Issue Details

IDProjectCategoryView StatusLast Update
0004677JEDI VCL00 JVCL Componentspublic2009-04-29 12:11
ReporterhodgsoniAssigned Toobones 
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionnot fixable 
Product Version3.36 
Target VersionFixed in Version 
Summary0004677: JvRichEdit SelStart incorrect
DescriptionJvRichEdit.SelStart is one less than it should be for every line entered into the RichEdit. If you monit selstart and type into a richedit like so :
12345678 (SelStart = 8 which is correct)
12345678 (SelStart = 17, should be 18)
12345678 (SelStart = 26, should be 28)
etc
Additional InformationAs a workaround I am doing the following when I need to use SelStart:
  SelStartWorkAround := reEditor.SelStart + CharPos.Y - 1;

where CharPos.Y = current line number
TagsNo tags attached.

Activities

obones

2009-02-02 01:27

administrator   ~0015279

Please provide the zipped sources of a sample application showing this.

2009-02-02 03:14

 

JvRichEditBug.zip (8,756 bytes)

obones

2009-04-29 11:56

administrator   ~0015454

I'm seeing it as well, but don't know yet why it does this.

obones

2009-04-29 12:11

administrator   ~0015455

This is "as designed" because TJvRichEdit uses RichEdit 2 which uses a single "LF" as its internal end of line character. TRichEdit uses RichEdit 1 which uses a "CR/LF" pair, as documented here:

http://msdn.microsoft.com/en-us/library/bb787873.aspx

look after the table for RichEdit 2.
As a result, using SelStart inside "Text" is wrong and cannot be relied upon.
Fortunately, there is the GetTextRange function in TJvRichEdit that you can use:

    Label3.Caption := GetTextRange(SelStart, SelStart + 5 - 1);

This works just fine.

Issue History

Date Modified Username Field Change
2009-01-28 01:17 hodgsoni New Issue
2009-02-02 01:27 obones Note Added: 0015279
2009-02-02 01:27 obones Status new => feedback
2009-02-02 03:14 hodgsoni File Added: JvRichEditBug.zip
2009-04-29 11:56 obones Note Added: 0015454
2009-04-29 11:56 obones Status feedback => confirmed
2009-04-29 12:11 obones Note Added: 0015455
2009-04-29 12:11 obones Status confirmed => resolved
2009-04-29 12:11 obones Resolution open => not fixable
2009-04-29 12:11 obones Assigned To => obones