Changeset 421 for trunk/Components/RichTextView.PAS
- Timestamp:
- Mar 1, 2019, 8:09:20 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Components/RichTextView.PAS
r420 r421 87 87 FCursorRow: longint; 88 88 FCursorOffset: longint; 89 90 FCursorMoveRight: boolean; // ALT - TRUE if cursor is moving to the right 89 91 90 92 FSelectionStart: longint; … … 460 462 Procedure TRichTextView.SetSelectionStartInternal( SelectionStart: longint ); 461 463 var 464 Line: longint; // ALT 462 465 Offset: longint; // ALT 463 466 begin … … 470 473 ClearSelection; 471 474 472 // ALT 473 Offset := FCursorOffset; 474 MoveToCharacterBoundary( FText, SelectionStart, FCursorOffset, Offset, FLayout.Codepage, false ); 475 // Should already be ensured by this point? 476 // FLayout.FindCharacterBoundary( FText, SelectionStart, false ); // ALT 475 477 476 478 FSelectionStart := SelectionStart; … … 485 487 StartRedrawLine: longint; 486 488 EndRedrawLine: longint; 487 Offset: longint; // ALT 489 Offset: longint; // ALT 490 Line: longint; // ALT 488 491 OldClip: TRect; 489 492 begin … … 491 494 exit; 492 495 493 // ALT 494 Offset := FCursorOffset; 495 MoveToCharacterBoundary( FText, SelectionEnd, FCursorOffset, Offset, FLayout.Codepage, false ); 496 // Should already be ensured by this point? 497 // FLayout.FindCharacterBoundary( FText, SelectionEnd, false ); // ALT 496 498 497 499 if FSelectionStart = -1 then … … 955 957 Offset, 956 958 Link ); 959 957 960 end; 958 961 … … 1257 1260 // ALT - move to nearest character boundary 1258 1261 Index := FLayout.GetCharIndex( Line.Text ) + FCursorOffset; 1259 RowStart := FLayout.GetCharIndex( Line.Text ); 1260 MoveToCharacterBoundary( FText, Index, FCursorOffset, RowStart, FLayout.Codepage, false ); 1262 1263 FLayout.FindCharacterBoundary( FText, Index, FCursorMoveRight ); 1264 FCursorOffset := FLayout.GetOffsetFromCharIndex( Index, CursorRow ); 1265 FCursorMoveRight := false; 1266 // ALT 1261 1267 1262 1268 FLayout.GetXFromOffset( FCursorOffset, CursorRow, X ); … … 1998 2004 Row: longint; 1999 2005 begin 2006 FCursorMoveRight := false; // ALT 2007 2000 2008 if SelectionSet then 2001 2009 begin … … 2037 2045 PreserveSelection: boolean ); 2038 2046 var 2039 // P: PChar; // ALT2040 // NextP: PChar; // ALT2041 // Element: TTextElement; // ALT2042 // InsideDBC: boolean; // ALT2043 2047 RowStart: longint; // ALT 2044 2048 MoveRight: boolean; // ALT … … 2048 2052 2049 2053 Index := FLayout.GetCharIndex( FLayout.FLines[ Row ].Text ) + Offset; 2050 2051 // ALT2052 {2053 if ( Offset > 0 ) and2054 ( FLayout.Codepage in [ 932, 936, 942, 943, 949, 950, 1381, 1386 ]) then2055 begin2056 RowStart := FLayout.GetCharIndex( FLayout.FLines[ Row ].Text );2057 P := FText + RowStart;2058 InsideDBC := false;2059 while RowStart < Index do2060 begin2061 Element := ExtractNextTextElement( P, NextP );2062 CheckSpecialElementType( Element.Character, Element.ElementType, InsideDBC, FLayout.Codepage );2063 P := NextP;2064 inc( RowStart );2065 end;2066 Element := ExtractNextTextElement( P, NextP );2067 CheckSpecialElementType( Element.Character, Element.ElementType, InsideDBC, FLayout.Codepage );2068 if InsideDBC then2069 begin2070 dec( Index );2071 dec( Offset );2072 end;2073 end;2074 }2075 2076 2054 RowStart := FLayout.GetCharIndex( FLayout.FLines[ Row ].Text ); 2077 2055 2078 // ALT 2079 if Offset = ( FCursorOffset + 1 ) then 2080 MoveRight := true 2081 else 2082 MoveRight := false; 2083 MoveToCharacterBoundary( FText, Index, Offset, RowStart, FLayout.Codepage, MoveRight ); 2084 2085 FCursorOffset := Offset; 2056 Offset := FLayout.FindCharacterBoundary( FText, Index, FCursorMoveRight ); // ALT 2057 FCursorOffset := FLayout.GetOffsetFromCharIndex( Index, Row ); 2086 2058 FCursorRow := Row; 2087 2059 … … 2106 2078 Line: TLayoutLine; 2107 2079 begin 2080 FCursorMoveRight := true; 2108 2081 P := FText + CursorIndex; 2109 2082 … … 2423 2396 begin 2424 2397 CursorVisible := FSelectionStart <> -1; 2398 FCursorMoveRight := false; 2425 2399 2426 2400 Case KeyCode of
Note:
See TracChangeset
for help on using the changeset viewer.