diff --git a/packages/slate/src/interfaces/editor.ts b/packages/slate/src/interfaces/editor.ts
index 2bddceb05..8b03bd7c9 100755
--- a/packages/slate/src/interfaces/editor.ts
+++ b/packages/slate/src/interfaces/editor.ts
@@ -1295,8 +1295,8 @@ export const Editor: EditorInterface = {
}
while (true) {
- // If there's no more string, continue to the next block.
- if (string === '') {
+ // If there's no more string and there is no more characters to skip, continue to the next block.
+ if (string === '' && distance === null) {
break
} else {
advance()
diff --git a/packages/slate/test/interfaces/Editor/positions/all/inline-fragmentation-empty-text.tsx b/packages/slate/test/interfaces/Editor/positions/all/inline-fragmentation-empty-text.tsx
new file mode 100644
index 000000000..b474044e9
--- /dev/null
+++ b/packages/slate/test/interfaces/Editor/positions/all/inline-fragmentation-empty-text.tsx
@@ -0,0 +1,29 @@
+/** @jsx jsx */
+import { Editor } from 'slate'
+import { jsx } from '../../../..'
+
+export const input = (
+
+
+
+
+
+
+
+
+
+
+
+
+
+)
+export const test = editor => {
+ return Array.from(Editor.positions(editor, { at: [] }))
+}
+export const output = [
+ { path: [0, 0], offset: 0 },
+ { path: [0, 1, 0], offset: 0 },
+ { path: [0, 1, 1, 0], offset: 0 },
+ { path: [0, 1, 2], offset: 0 },
+ { path: [0, 2], offset: 0 },
+]
diff --git a/packages/slate/test/interfaces/Editor/positions/all/inline-fragmentation-reverse.tsx b/packages/slate/test/interfaces/Editor/positions/all/inline-fragmentation-reverse.tsx
new file mode 100644
index 000000000..bb30c1737
--- /dev/null
+++ b/packages/slate/test/interfaces/Editor/positions/all/inline-fragmentation-reverse.tsx
@@ -0,0 +1,23 @@
+/** @jsx jsx */
+import { Editor } from 'slate'
+import { jsx } from '../../../..'
+
+export const input = (
+
+
+ 123
+
+
+)
+export const test = editor => {
+ return Array.from(Editor.positions(editor, { at: [], reverse: true }))
+}
+
+export const output = [
+ { path: [0, 2], offset: 1 },
+ { path: [0, 2], offset: 0 },
+ { path: [0, 1, 0], offset: 1 },
+ { path: [0, 1, 0], offset: 0 },
+ { path: [0, 0], offset: 1 },
+ { path: [0, 0], offset: 0 },
+]
diff --git a/packages/slate/test/interfaces/Editor/positions/all/inline-fragmentation.tsx b/packages/slate/test/interfaces/Editor/positions/all/inline-fragmentation.tsx
new file mode 100644
index 000000000..2f7af6b7d
--- /dev/null
+++ b/packages/slate/test/interfaces/Editor/positions/all/inline-fragmentation.tsx
@@ -0,0 +1,23 @@
+/** @jsx jsx */
+import { Editor } from 'slate'
+import { jsx } from '../../../..'
+
+export const input = (
+
+
+ 123
+
+
+)
+export const test = editor => {
+ return Array.from(Editor.positions(editor, { at: [] }))
+}
+
+export const output = [
+ { path: [0, 0], offset: 0 },
+ { path: [0, 0], offset: 1 },
+ { path: [0, 1, 0], offset: 0 },
+ { path: [0, 1, 0], offset: 1 },
+ { path: [0, 2], offset: 0 },
+ { path: [0, 2], offset: 1 },
+]
diff --git a/packages/slate/test/interfaces/Editor/positions/all/unit-character-inline-fragmentation-multibyte.tsx b/packages/slate/test/interfaces/Editor/positions/all/unit-character-inline-fragmentation-multibyte.tsx
new file mode 100644
index 000000000..4c4d41fcb
--- /dev/null
+++ b/packages/slate/test/interfaces/Editor/positions/all/unit-character-inline-fragmentation-multibyte.tsx
@@ -0,0 +1,21 @@
+/** @jsx jsx */
+import { Editor } from 'slate'
+import { jsx } from '../../../..'
+
+export const input = (
+
+
+ 😀😀😀
+
+
+)
+export const test = editor => {
+ return Array.from(Editor.positions(editor, { at: [], unit: 'character' }))
+}
+
+export const output = [
+ { path: [0, 0], offset: 0 },
+ { path: [0, 0], offset: 2 },
+ { path: [0, 1, 0], offset: 2 },
+ { path: [0, 2], offset: 2 },
+]
diff --git a/packages/slate/test/interfaces/Editor/positions/all/unit-character-inline-fragmentation-reverse.tsx b/packages/slate/test/interfaces/Editor/positions/all/unit-character-inline-fragmentation-reverse.tsx
new file mode 100644
index 000000000..effe05bd2
--- /dev/null
+++ b/packages/slate/test/interfaces/Editor/positions/all/unit-character-inline-fragmentation-reverse.tsx
@@ -0,0 +1,23 @@
+/** @jsx jsx */
+import { Editor } from 'slate'
+import { jsx } from '../../../..'
+
+export const input = (
+
+
+ 123
+
+
+)
+export const test = editor => {
+ return Array.from(
+ Editor.positions(editor, { at: [], unit: 'character', reverse: true })
+ )
+}
+
+export const output = [
+ { path: [0, 2], offset: 1 },
+ { path: [0, 2], offset: 0 },
+ { path: [0, 1, 0], offset: 0 },
+ { path: [0, 0], offset: 0 },
+]
diff --git a/packages/slate/test/interfaces/Editor/positions/all/unit-character-inline-fragmentation.tsx b/packages/slate/test/interfaces/Editor/positions/all/unit-character-inline-fragmentation.tsx
new file mode 100644
index 000000000..b03e8391d
--- /dev/null
+++ b/packages/slate/test/interfaces/Editor/positions/all/unit-character-inline-fragmentation.tsx
@@ -0,0 +1,21 @@
+/** @jsx jsx */
+import { Editor } from 'slate'
+import { jsx } from '../../../..'
+
+export const input = (
+
+
+ 123
+
+
+)
+export const test = editor => {
+ return Array.from(Editor.positions(editor, { at: [], unit: 'character' }))
+}
+
+export const output = [
+ { path: [0, 0], offset: 0 },
+ { path: [0, 0], offset: 1 },
+ { path: [0, 1, 0], offset: 1 },
+ { path: [0, 2], offset: 1 },
+]
diff --git a/packages/slate/test/interfaces/Editor/positions/all/unit-line-inline-fragmentation-reverse.tsx b/packages/slate/test/interfaces/Editor/positions/all/unit-line-inline-fragmentation-reverse.tsx
new file mode 100644
index 000000000..648b8086c
--- /dev/null
+++ b/packages/slate/test/interfaces/Editor/positions/all/unit-line-inline-fragmentation-reverse.tsx
@@ -0,0 +1,21 @@
+/** @jsx jsx */
+import { Editor } from 'slate'
+import { jsx } from '../../../..'
+
+export const input = (
+
+
+ hello world
+
+
+)
+export const test = editor => {
+ return Array.from(
+ Editor.positions(editor, { at: [], unit: 'line', reverse: true })
+ )
+}
+
+export const output = [
+ { path: [0, 4], offset: 1 },
+ { path: [0, 0], offset: 0 },
+]
diff --git a/packages/slate/test/interfaces/Editor/positions/all/unit-line-inline-fragmentation.tsx b/packages/slate/test/interfaces/Editor/positions/all/unit-line-inline-fragmentation.tsx
new file mode 100644
index 000000000..e2b21f498
--- /dev/null
+++ b/packages/slate/test/interfaces/Editor/positions/all/unit-line-inline-fragmentation.tsx
@@ -0,0 +1,19 @@
+/** @jsx jsx */
+import { Editor } from 'slate'
+import { jsx } from '../../../..'
+
+export const input = (
+
+
+ hello world
+
+
+)
+export const test = editor => {
+ return Array.from(Editor.positions(editor, { at: [], unit: 'line' }))
+}
+
+export const output = [
+ { path: [0, 0], offset: 0 },
+ { path: [0, 4], offset: 1 },
+]
diff --git a/packages/slate/test/interfaces/Editor/positions/all/unit-word-inline-fragmentation.tsx b/packages/slate/test/interfaces/Editor/positions/all/unit-word-inline-fragmentation.tsx
new file mode 100644
index 000000000..315b77a5c
--- /dev/null
+++ b/packages/slate/test/interfaces/Editor/positions/all/unit-word-inline-fragmentation.tsx
@@ -0,0 +1,20 @@
+/** @jsx jsx */
+import { Editor } from 'slate'
+import { jsx } from '../../../..'
+
+export const input = (
+
+
+ hello world
+
+
+)
+export const test = editor => {
+ return Array.from(Editor.positions(editor, { at: [], unit: 'word' }))
+}
+
+export const output = [
+ { path: [0, 0], offset: 0 },
+ { path: [0, 2], offset: 1 },
+ { path: [0, 4], offset: 1 },
+]