• manukh's avatar
    [omnibox] [rich-autocompletion] Preserve cursor for split selections. · 8354c6e9
    manukh authored
    Split AC was added in CL crrev.com/c/2424985 . It allows e.g. the input
    'a c' to match the text 'a [b ]c[ d]'
    
    When generating the text selections from word matches, it removes empty
    matches and merges adjacent matches. E.g. the input 'a b' produces the
    selections 'a b[ c]' instead of 'a| |b[ c]'. This is desirable usually,
    but not desirable for the last selection which is used to determine the
    cursor position; merging or filtering the last selection incorrectly
    alters the cursor.
    
    This CL makes sure to preserve the last selection and, therefore, the
    correct cursor. E.g. the input 'a c' produces selections 'a [b ]c|'
    instead of 'a [b ]c'.
    
    Bug: 1062446
    Change-Id: Icfb13321d86454a8a2fbc89289fefda53287b770
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2601046
    Commit-Queue: manuk hovanesian <manukh@chromium.org>
    Reviewed-by: default avatarOrin Jaworski <orinj@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#839170}
    8354c6e9
autocomplete_match.cc 53.5 KB