Bug 4062 - Word completion doesn't work at end of word (unless last word)
Summary: Word completion doesn't work at end of word (unless last word)
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: 420+
Hardware: Mac OS X 10.4
: P2 Normal
Assignee: Dave Hyatt
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-07-18 15:01 PDT by Duncan Wilcox
Modified: 2005-11-28 14:39 PST (History)
1 user (show)

See Also:


Attachments
test case (1.43 KB, text/plain)
2005-07-18 15:07 PDT, Duncan Wilcox
no flags Details
proposed patch (use rangeByAlteringCurrentSelection) (3.48 KB, patch)
2005-10-27 12:12 PDT, Alexey Proskuryakov
no flags Details | Formatted Diff | Diff
proposed patch (use rangeByAlteringCurrentSelection) (967 bytes, patch)
2005-10-27 12:14 PDT, Alexey Proskuryakov
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Duncan Wilcox 2005-07-18 15:01:35 PDT
Pressing cmd+esc will invoke the webview complete: method, that will popup a list of words that 
complete the text typed so far.

This functionality only works if you hit cmd-esc after the last word on the page, or if you type cmd-esc 
while within a word. It doesn't work if you hit cmd-esc at the end of a word that is not the last one.

In the attached sample hit cmd-esc when the cursor is just after "one", you will get a NSBeep(). If you hit 
cmd-esc with the cursor after "three" it will work.

A rough guess is that this happens because -[WebTextCompleteController doCompletion] is calling 
[bridge rangeByExpandingSelectionWithGranularity:WebSelectByWord] that doesn't work when a space 
follows the cursor.

The spelling suggestion functionality appears to be filtered away by safari, so it's not testable with a 
plain web page.
Comment 1 Duncan Wilcox 2005-07-18 15:07:32 PDT
Created attachment 3007 [details]
test case

Create a cocoa app in xcode, replace main.m with the attachment and add the
WebKit.framework to the project.
Comment 2 Alexey Proskuryakov 2005-10-26 12:49:49 PDT
Confirmed with ToT (running Blot)
Comment 3 Alexey Proskuryakov 2005-10-27 12:12:48 PDT
Created attachment 4490 [details]
proposed patch (use rangeByAlteringCurrentSelection)

I have also thought about changing rangeByExpandingSelectionWithGranularity: to
work in this case, but this seems to require quite a number of changes to how a
selection's affinity is set in various places, which may or may not be
desirable...
Comment 4 Alexey Proskuryakov 2005-10-27 12:14:11 PDT
Created attachment 4491 [details]
proposed patch (use rangeByAlteringCurrentSelection)

An unrelated change sneaked into the patch...
Comment 5 Darin Adler 2005-10-27 21:47:12 PDT
Comment on attachment 4491 [details]
proposed patch (use rangeByAlteringCurrentSelection)

Looks fine. r=me