Index: uspace/dist/src/c/demos/edit/sheet.c
===================================================================
--- uspace/dist/src/c/demos/edit/sheet.c	(revision 6b9355aeec9359a8483c36268fb5c8b8f91b48e5)
+++ uspace/dist/src/c/demos/edit/sheet.c	(revision f857e8b0d7e7691bf604feaaf406a4154472a44a)
@@ -57,4 +57,5 @@
 
 #include "sheet.h"
+#include "sheet_impl.h"
 
 enum {
@@ -66,6 +67,12 @@
 
 /** Initialize an empty sheet. */
-int sheet_init(sheet_t *sh)
-{
+int sheet_create(sheet_t **rsh)
+{
+	sheet_t *sh;
+
+	sh = calloc(1, sizeof(sheet_t));
+	if (sh == NULL)
+		return ENOMEM;
+
 	sh->dbuf_size = INITIAL_SIZE;
 	sh->text_size = 0;
@@ -77,4 +84,5 @@
 	list_initialize(&sh->tags);
 
+	*rsh = sh;
 	return EOK;
 }
@@ -97,5 +105,4 @@
 	char *ipp;
 	size_t sz;
-	tag_t *tag;
 	char *newp;
 
@@ -120,7 +127,5 @@
 	/* Adjust tags. */
 
-	list_foreach(sh->tags, link) {
-		tag = list_get_instance(link, tag_t, link);
-
+	list_foreach(sh->tags, link, tag_t, tag) {
 		if (tag->b_off > pos->b_off)
 			tag->b_off += sz;
@@ -146,5 +151,4 @@
 	char *spp;
 	size_t sz;
-	tag_t *tag;
 	char *newp;
 	size_t shrink_size;
@@ -157,7 +161,5 @@
 
 	/* Adjust tags. */
-	list_foreach(sh->tags, link) {
-		tag = list_get_instance(link, tag_t, link);
-
+	list_foreach(sh->tags, link, tag_t, tag) {
 		if (tag->b_off >= epos->b_off)
 			tag->b_off -= sz;
@@ -264,5 +266,5 @@
 	sheet_get_cell_pt(sh, &coord, dir_before, &pt);
 	spt_get_coord(&pt, &coord);
-	*length = coord.column - 1;
+	*length = coord.column;
 }
 
@@ -315,4 +317,21 @@
 }
 
+/** Get a character at spt and return next spt */
+wchar_t spt_next_char(spt_t spt, spt_t *next)
+{
+	wchar_t ch = str_decode(spt.sh->data, &spt.b_off, spt.sh->text_size);
+	if (next)
+		*next = spt;
+	return ch;
+}
+
+wchar_t spt_prev_char(spt_t spt, spt_t *prev)
+{
+	wchar_t ch = str_decode_reverse(spt.sh->data, &spt.b_off, spt.sh->text_size);
+	if (prev)
+		*prev = spt;
+	return ch;
+}
+
 /** Place a tag on the specified s-point. */
 void sheet_place_tag(sheet_t *sh, spt_t const *pt, tag_t *tag)
