         return head + tail
     }
 
+
+    /// Move backward one character if `head` is non-empty
+    public mutating func left() {
+        if let char = dropLast(&head) {
+            tail.insert(char, atIndex: tail.startIndex)
+        }
+    }
+
+    /// Move forward one character if `tail` is non-empty
+    public mutating func right() {
+        if let char = dropFirst(&tail) {
+            head.append(char)
+        }
+    }
+
+    /// Moves to the start of `text`
+    public mutating func home() {
+        tail = head + tail
+        head = ""
+    }
+
+    /// Moves to the end of `text`
+    public mutating func end() {
+        head.extend(tail)
+        tail = ""
+    }
+
+
     /// Insert a new character at the end of `head`
     public mutating func insert(char: Character) {
         head.append(char)

    public mutating func insert(str: String) {
        head.extend(str)
    }
}

    /// Construct an empty `Editor`
    public init() {
    }

    /// Construct an `Editor` from `str` placing cursor at home
    public init(str: String) {
        tail = str
    }


    /// The prefix of the string
    public private(set) var head = ""
