Allow completions to overwrite prefixes
diff --git a/bundles/org.eclipse.orion.client.editor/web/orion/editor/contentAssist.js b/bundles/org.eclipse.orion.client.editor/web/orion/editor/contentAssist.js
index 3c23655..25d631d 100644
--- a/bundles/org.eclipse.orion.client.editor/web/orion/editor/contentAssist.js
+++ b/bundles/org.eclipse.orion.client.editor/web/orion/editor/contentAssist.js
@@ -129,15 +129,25 @@
 			if (!proposal) {

 				return false;

 			}

-			var offset = this.textView.getCaretOffset();

+	

+			// now handle prefixes

+			// if there is a non-empty selection, then replace it,

+			// if overwrite is truthy, then also replace the prefix

+			var sel = this.textView.getSelection();

+			var start = Math.min(sel.start, sel.end);

+			var end = Math.max(sel.start, sel.end);

+			if (proposal.overwrite) {

+				start = this.getPrefixStart(start);

+			}

+

 			var data = {

 				proposal: proposal,

-				start: offset,

-				end: offset

+				start: start,

+				end: end

 			};

 			this.setState(State.INACTIVE);

 			var proposalText = proposal.proposal || proposal;

-			this.textView.setText(proposalText, offset, offset);

+			this.textView.setText(proposalText, start, end);

 			this.dispatchEvent({type: "ProposalApplied", data: data});

 			return true;

 		},