Ignore:
Timestamp:
Feb 28, 2019, 4:17:24 AM (6 years ago)
Author:
ataylor
Message:

Improve DBCS string width calculations, other small tweaks.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Components/RichTextView.PAS

    r418 r420  
    472472  // ALT
    473473  Offset := FCursorOffset;
    474   MovetoCharacterBoundary( FText, SelectionStart, FCursorOffset, Offset, FLayout.Codepage );
     474  MoveToCharacterBoundary( FText, SelectionStart, FCursorOffset, Offset, FLayout.Codepage, false );
    475475
    476476  FSelectionStart := SelectionStart;
     
    493493  // ALT
    494494  Offset := FCursorOffset;
    495   MovetoCharacterBoundary( FText, SelectionEnd, FCursorOffset, Offset, FLayout.Codepage );
     495  MoveToCharacterBoundary( FText, SelectionEnd, FCursorOffset, Offset, FLayout.Codepage, false );
    496496
    497497  if FSelectionStart = -1 then
     
    12301230  Descender: longint;
    12311231  MaxDescender: longint;
     1232  Index: longint;       // ALT
     1233  RowStart: longint;    // ALT
    12321234begin
    12331235  RemoveCursor;
     
    12521254    // off top
    12531255    exit;
     1256
     1257  // ALT - move to nearest character boundary
     1258  Index := FLayout.GetCharIndex( Line.Text ) + FCursorOffset;
     1259  RowStart := FLayout.GetCharIndex( Line.Text );
     1260  MoveToCharacterBoundary( FText, Index, FCursorOffset, RowStart, FLayout.Codepage, false );
    12541261
    12551262  FLayout.GetXFromOffset( FCursorOffset, CursorRow, X );
     
    20352042//  InsideDBC: boolean;       // ALT
    20362043  RowStart: longint;        // ALT
     2044  MoveRight: boolean;       // ALT
    20372045  Index: longint;
    20382046begin
     
    20672075
    20682076  RowStart := FLayout.GetCharIndex( FLayout.FLines[ Row ].Text );
    2069   MoveToCharacterBoundary( FText, Index, Offset, RowStart, FLayout.Codepage );  // ALT
     2077
     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 );
    20702084
    20712085  FCursorOffset := Offset;
Note: See TracChangeset for help on using the changeset viewer.