editor, keyboard: Add support for arrow keys

Add support for arrow keys on the virtual keyboard and make it possible
to move around the cursor in the editor example.
diff --git a/clients/editor.c b/clients/editor.c
index 301cbe2..5ad1aa2 100644
--- a/clients/editor.c
+++ b/clients/editor.c
@@ -288,13 +288,12 @@
                uint32_t key,
                uint32_t state)
 {
+	struct text_entry *entry = data;
 	const char *state_label;
-	const char *key_label;
+	const char *key_label = "released";
 
 	if (state == WL_KEYBOARD_KEY_STATE_PRESSED) {
 		state_label = "pressed";
-	} else {
-		state_label = "released";
 	}
 
 	switch (key) {
@@ -304,6 +303,20 @@
 		case XKB_KEY_KP_Enter:
 			key_label = "Enter";
 			break;
+		case XKB_KEY_Left:
+			if (entry->cursor > 0) {
+				entry->cursor--;
+				entry->anchor = entry->cursor;
+				widget_schedule_redraw(entry->widget);
+			}
+			break;
+		case XKB_KEY_Right:
+			if (entry->cursor < strlen(entry->text)) {
+				entry->cursor++;
+				entry->anchor = entry->cursor;
+				widget_schedule_redraw(entry->widget);
+			}
+			break;
 		default:
 			key_label = "Unknown";
 	}