--- /dev/null
+EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 3 of DIV > BODY > HTML > #document
+EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldDeleteDOMRange:range from 6 of #text > DIV > DIV > BODY > HTML > #document to 7 of #text > DIV > DIV > BODY > HTML > #document
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 7 of #text > DIV > DIV > BODY > HTML > #document to 7 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 6 of #text > DIV > DIV > BODY > HTML > #document to 6 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x584
+ RenderBlock {DIV} at (0,0) size 784x184 [border: (2px solid #0000FF)]
+ RenderBlock {DIV} at (14,14) size 756x56
+ RenderText {#text} at (0,0) size 67x28
+ text run at (0,0) width 67: "Tests: "
+ RenderBR {BR} at (0,0) size 0x0
+ RenderText {#text} at (0,28) size 544x28
+ text run at (0,28) width 544: "Cntl-y at caret selection when nothing is in the kill ring."
+ RenderBlock {DIV} at (14,86) size 756x84
+ RenderText {#text} at (0,0) size 189x28
+ text run at (0,0) width 189: "Expected Results: "
+ RenderBR {BR} at (189,22) size 0x0
+ RenderText {#text} at (0,28) size 291x28
+ text run at (0,28) width 291: "Deletes a character, yielding: "
+ RenderBR {BR} at (291,50) size 0x0
+ RenderText {#text} at (0,56) size 166x28
+ text run at (0,56) width 166: "one tw three four"
+ RenderBlock {DIV} at (0,208) size 784x32
+ RenderBlock {DIV} at (0,0) size 784x32 [border: (2px solid #FF0000)]
+ RenderText {#text} at (2,2) size 166x28
+ text run at (2,2) width 166: "one tw three four"
+caret: position 6 of child 0 {#text} of child 1 {DIV} of child 3 {DIV} of child 1 {BODY} of child 0 {HTML} of document
--- /dev/null
+<html>
+<head>
+
+<style>
+.editing {
+ border: 2px solid red;
+ font-size: 24px;
+}
+.explanation {
+ border: 2px solid blue;
+ padding: 12px;
+ font-size: 24px;
+ margin-bottom: 24px;
+}
+.scenario { margin-bottom: 16px;}
+.scenario:first-line { font-weight: bold; margin-bottom: 16px;}
+.expected-results:first-line { font-weight: bold }
+</style>
+<script src=../editing.js language="JavaScript" type="text/JavaScript" ></script>
+
+<script>
+
+function editingTest() {
+ moveSelectionForwardByWordCommand();
+ moveSelectionForwardByWordCommand();
+ if (window.eventSender)
+ eventSender.keyDown("y", ["ctrlKey"]);
+}
+
+</script>
+
+<title>Editing Test</title>
+</head>
+<body>
+
+<div class="explanation">
+<div class="scenario">
+Tests:
+<br>
+Cntl-y at caret selection when nothing is in the kill ring.
+</div>
+<div class="expected-results">
+Expected Results:
+<br>
+Deletes a character, yielding:
+<BR>
+one tw three four
+</div>
+</div>
+
+<div contenteditable id="root" style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space;">
+<div id="test" class="editing">one two three four</div>
+</div>
+
+<script>
+runEditingTest();
+</script>
+
+</body>
+</html>
+2006-09-26 David Harrison <harrison@apple.com>
+
+ Reviewed by John and TimH.
+
+ <rdar://problem/4743256> Seed: Ctrl-Y key binding does nothing when kill ring is empty
+
+ Use deleteBackward: when the killring string is empty. Was always using insertText:,
+ but that ends up early-returning if the string to insert is empty.
+
+ * WebView/WebHTMLView.m:
+ (-[NSArray yank:]):
+ (-[NSArray yankAndSelect:]):
+
2006-09-25 Timothy Hatcher <timothy@apple.com>
Reviewed by Brady.
{
if (![self _canEdit])
return;
-
- [self insertText:_NSYankFromKillRing()];
+
+ NSString* yankee = _NSYankFromKillRing();
+ if ([yankee length])
+ [self insertText:yankee];
+ else
+ [self deleteBackward:nil];
+
_NSSetKillRingToYankedState();
}
if (![self _canEdit])
return;
- [self _insertText:_NSYankPreviousFromKillRing() selectInsertedText:YES];
+ NSString* yankee = _NSYankPreviousFromKillRing();
+ if ([yankee length])
+ [self _insertText:yankee selectInsertedText:YES];
+ else
+ [self deleteBackward:nil];
+
_NSSetKillRingToYankedState();
}