From 0264e97bceaca69d0b0232ac680bd7b26e2db66a Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Tue, 19 Sep 2017 10:07:20 -0400 Subject: Convert selection to use count instead of end index This CL changes the Text Edit Engine code to use a count instead of an end index for the selection range. Using count lets us differentiate a selection at the beginning of 1 character and an empty selection. A few new tests were added to test unicode word break behaviour, some are not working yet and are commented out. Change-Id: Icce8f5003102ef0a850151ccdf16d3c2226d94bf Reviewed-on: https://pdfium-review.googlesource.com/13491 Commit-Queue: dsinclair Reviewed-by: Henrique Nakashima --- xfa/fde/cfde_texteditengine.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'xfa/fde/cfde_texteditengine.h') diff --git a/xfa/fde/cfde_texteditengine.h b/xfa/fde/cfde_texteditengine.h index 750b62a2e1..40f12e5f76 100644 --- a/xfa/fde/cfde_texteditengine.h +++ b/xfa/fde/cfde_texteditengine.h @@ -140,12 +140,12 @@ class CFDE_TextEditEngine { size_t GetIndexAtEndOfLine(size_t pos) { return 0; } void SelectAll(); - void SetSelection(size_t start_idx, size_t end_idx); + void SetSelection(size_t start_idx, size_t count); void ClearSelection(); bool HasSelection() const { return has_selection_; } - // Returns indices of the selection. + // Returns of the selection. std::pair GetSelection() const { - return {selection_.start_idx, selection_.end_idx}; + return {selection_.start_idx, selection_.count}; } WideString GetSelectedText() const; WideString DeleteSelectedText( @@ -159,7 +159,7 @@ class CFDE_TextEditEngine { size_t GetWidthOfChar(size_t idx); // Non-const so we can force a Layout() if needed. size_t GetIndexForPoint(const CFX_PointF& point); - // + // std::pair BoundsForWordAt(size_t idx) const; // Returns @@ -197,7 +197,7 @@ class CFDE_TextEditEngine { struct Selection { size_t start_idx; - size_t end_idx; + size_t count; }; CFX_RectF contents_bounding_box_; -- cgit v1.2.3