diff --git a/index.html b/index.html
index cce9947..140f242 100644
--- a/index.html
+++ b/index.html
@@ -1058,8 +1058,48 @@
EditContext Interface
-
- Replace the substring of [=text=] in the range of |rangeStart| and |rangeEnd| with |newText|
-
It's permissible that |rangeStart| > |rangeEnd|. The substring between the indices should be replaced in the same way as when |rangeStart| <= |rangeEnd|.
+ If |rangeStart| > |rangeEnd|, then swap the values of |rangeStart| and |rangeEnd|.
+
+ -
+ Replace the substring of [=text=] in the range of |rangeStart| and |rangeEnd| with |newText|.
+
+ -
+ If [=selection start=] is greater than |rangeEnd|, then set [=selection start=] to [=selection start=] plus the length of |newText| minus (|rangeEnd| minus |rangeStart|).
+
+ -
+ If [=selection start=] is greater than |rangeStart| and less than |rangeEnd|, then set [=selection start=] to |rangeStart| plus the length of |newText|.
+
+ -
+ If [=selection end=] is greater than |rangeEnd|, then set [=selection end=] to [=selection end=] plus the length of |newText| minus (|rangeEnd| minus |rangeStart|).
+
+ -
+ If [=selection end=] is greater than |rangeStart| and less than |rangeEnd|, then set [=selection end=] to |rangeStart| plus the length of |newText|.
+
+
+ In other words, both selection boundary points are updated such that if they were after the affected range, they're offset by the overall change to the text length. If they were within the affected range, they're moved to the end of the new text.
+ If they were before the affected range, they're left unchanged.
+
+ -
+ If [=is composing=] is true, then:
+
+ -
+ If min([=composition start=], [=composition end=]) is less than |rangeEnd| and max([=composition start=], [=composition end=]) is greater than |rangeStart|, then:
+
+ - Set [=is composing=] to false.
+
+
+ -
+ Otherwise:
+
+ -
+ If [=composition start=] is greater than |rangeEnd|, then set [=composition start=] to [=composition start=] plus the length of |newText| minus (|rangeEnd| minus |rangeStart|).
+
+ -
+ If [=composition end=] is greater than |rangeEnd|, then set [=composition end=] to [=composition end=] plus the length of |newText| minus (|rangeEnd| minus |rangeStart|).
+
+
+
+
@@ -1079,10 +1119,13 @@ EditContext Interface
-
- set [=selection start=] to |start|
+ If [=selection start=] is not equal to |start| or [=selection end=] is not equal to |end|, then set [=is composing=] to false.
+
+ -
+ Set [=selection start=] to |start|.
-
- set [=selection end=] to |end|
+ Set [=selection end=] to |end|.