Index: uspace/app/edit/edit.c
===================================================================
--- uspace/app/edit/edit.c	(revision f2d6d44e532b223e21bff270aeb76d05b91d40c0)
+++ uspace/app/edit/edit.c	(revision be869b085d9cf2a89b4dcbe18311b0bcbb72f2cd)
@@ -40,5 +40,7 @@
 #include <errno.h>
 #include <gfx/color.h>
+#include <gfx/font.h>
 #include <gfx/render.h>
+#include <gfx/text.h>
 #include <io/kbd_event.h>
 #include <io/keycode.h>
@@ -56,4 +58,5 @@
 #include <ui/menubar.h>
 #include <ui/menuentry.h>
+#include <ui/resource.h>
 #include <ui/ui.h>
 #include <ui/window.h>
@@ -73,5 +76,6 @@
  *
  * A rectangular area of the screen used to edit a document. Different
- * panes can be possibly used to edit the same document.
+ * panes can be possibly used to edit the same document. This is a custom
+ * UI control.
  */
 typedef struct {
@@ -87,4 +91,7 @@
 	/** Pane rectangle */
 	gfx_rect_t rect;
+
+	/** Pane color */
+	gfx_color_t *color;
 
 	/* Pane dimensions */
@@ -178,7 +185,7 @@
 static void pane_fini(pane_t *);
 static ui_control_t *pane_ctl(pane_t *);
-static void pane_text_display(void);
+static errno_t pane_text_display(pane_t *);
 static void pane_row_display(void);
-static void pane_row_range_display(int r0, int r1);
+static errno_t pane_row_range_display(pane_t *, int r0, int r1);
 static void pane_status_display(void);
 static void pane_caret_display(void);
@@ -315,5 +322,5 @@
 	cursor_hide();
 //	console_clear(con);
-	pane_text_display();
+	pane_text_display(&pane);
 	pane_status_display();
 	if (new_file && doc.file_name != NULL)
@@ -347,5 +354,5 @@
 
 		if (pane.rflags & REDRAW_TEXT)
-			pane_text_display();
+			pane_text_display(&pane);
 		if (pane.rflags & REDRAW_ROW)
 			pane_row_display();
@@ -498,5 +505,4 @@
 static void edit_ui_destroy(edit_t *edit)
 {
-	pane_fini(&pane);
 	ui_window_destroy(edit->window);
 	ui_destroy(edit->ui);
@@ -978,4 +984,10 @@
 		return rc;
 
+	rc = gfx_color_new_ega(0x07, &pane->color);
+	if (rc != EOK) {
+		ui_control_delete(pane->control);
+		return rc;
+	}
+
 	pane->res = ui_window_get_res(window);
 	pane->window = window;
@@ -987,4 +999,7 @@
 	pane->rect.p1.y = arect.p1.y - 1;
 
+	pane->columns = pane->rect.p1.x - pane->rect.p0.x;
+	pane->rows = pane->rect.p1.y - pane->rect.p0.y;
+
 	return EOK;
 }
@@ -998,4 +1013,6 @@
 static void pane_fini(pane_t *pane)
 {
+	gfx_color_delete(pane->color);
+	pane->color = NULL;
 	ui_control_delete(pane->control);
 	pane->control = NULL;
@@ -1012,29 +1029,46 @@
 }
 
-static void pane_text_display(void)
-{
+/** Display pane text.
+ *
+ * @param pane Pane
+ * @return EOK on success or an error code
+ */
+static errno_t pane_text_display(pane_t *pane)
+{
+	gfx_rect_t rect;
+	gfx_context_t *gc;
+	errno_t rc;
 	int sh_rows, rows;
 
 	sheet_get_num_rows(doc.sh, &sh_rows);
-	rows = min(sh_rows - pane.sh_row + 1, pane.rows);
+	rows = min(sh_rows - pane->sh_row + 1, pane->rows);
 
 	/* Draw rows from the sheet. */
 
-//	console_set_pos(con, 0, 0);
-	pane_row_range_display(0, rows);
+	rc = pane_row_range_display(pane, 0, rows);
+	if (rc != EOK)
+		return rc;
 
 	/* Clear the remaining rows if file is short. */
 
-	int i;
-	sysarg_t j;
-	for (i = rows; i < pane.rows; ++i) {
-//		console_set_pos(con, 0, i);
-		for (j = 0; j < scr_columns; ++j)
-			putchar(' ');
-//		console_flush(con);
-	}
-
-	pane.rflags |= (REDRAW_STATUS | REDRAW_CARET);
-	pane.rflags &= ~REDRAW_ROW;
+	gc = ui_window_get_gc(pane->window);
+
+	rc = gfx_set_color(gc, pane->color);
+	if (rc != EOK)
+		goto error;
+
+	rect.p0.x = pane->rect.p0.x;
+	rect.p0.y = pane->rect.p0.y + rows;
+	rect.p1.x = pane->rect.p1.x;
+	rect.p1.y = pane->rect.p1.y;
+
+	rc = gfx_fill_rect(gc, &rect);
+	if (rc != EOK)
+		goto error;
+
+	pane->rflags &= ~REDRAW_ROW;
+	return EOK;
+error:
+	return rc;
 }
 
@@ -1050,25 +1084,45 @@
 
 	ridx = coord.row - pane.sh_row;
-	pane_row_range_display(ridx, ridx + 1);
+	(void) pane_row_range_display(&pane, ridx, ridx + 1);
 	pane.rflags |= (REDRAW_STATUS | REDRAW_CARET);
 }
 
-static void pane_row_range_display(int r0, int r1)
-{
-	int i, j, fill;
+/** Display a range of rows of text.
+ *
+ * @param r0 Start row (inclusive)
+ * @param r1 End row (exclusive)
+ * @return EOk on success or an error code
+ */
+static errno_t pane_row_range_display(pane_t *pane, int r0, int r1)
+{
+	int i, fill;
 	spt_t rb, re, dep, pt;
 	coord_t rbc, rec;
 	char row_buf[ROW_BUF_SIZE];
+	char cbuf[STR_BOUNDS(1) + 1];
 	char32_t c;
 	size_t pos, size;
+	size_t cpos;
 	int s_column;
 	coord_t csel_start, csel_end, ctmp;
+	gfx_font_t *font;
+	gfx_context_t *gc;
+	gfx_text_fmt_t fmt;
+	gfx_coord2_t tpos;
+	gfx_rect_t rect;
+	errno_t rc;
+
+	font = ui_resource_get_font(edit.ui_res);
+	gc = ui_window_get_gc(edit.window);
+
+	gfx_text_fmt_init(&fmt);
+	fmt.color = pane->color;
 
 	/* Determine selection start and end. */
 
-	tag_get_pt(&pane.sel_start, &pt);
+	tag_get_pt(&pane->sel_start, &pt);
 	spt_get_coord(&pt, &csel_start);
 
-	tag_get_pt(&pane.caret_pos, &pt);
+	tag_get_pt(&pane->caret_pos, &pt);
 	spt_get_coord(&pt, &csel_end);
 
@@ -1083,12 +1137,15 @@
 //	console_set_pos(con, 0, 0);
 	for (i = r0; i < r1; ++i) {
+		tpos.x = pane->rect.p0.x;
+		tpos.y = pane->rect.p0.y + i;
+
 		/* Starting point for row display */
-		rbc.row = pane.sh_row + i;
-		rbc.column = pane.sh_column;
+		rbc.row = pane->sh_row + i;
+		rbc.column = pane->sh_column;
 		sheet_get_cell_pt(doc.sh, &rbc, dir_before, &rb);
 
 		/* Ending point for row display */
-		rec.row = pane.sh_row + i;
-		rec.column = pane.sh_column + pane.columns;
+		rec.row = pane->sh_row + i;
+		rec.column = pane->sh_column + pane->columns;
 		sheet_get_cell_pt(doc.sh, &rec, dir_before, &re);
 
@@ -1108,5 +1165,5 @@
 		size = str_size(row_buf);
 		pos = 0;
-		s_column = pane.sh_column;
+		s_column = pane->sh_column;
 		while (pos < size) {
 			if ((csel_start.row == rbc.row) && (csel_start.column == s_column)) {
@@ -1124,13 +1181,34 @@
 			c = str_decode(row_buf, &pos, size);
 			if (c != '\t') {
-				printf("%lc", (wint_t) c);
+				cpos = 0;
+				rc = chr_encode(c, cbuf, &cpos, sizeof(cbuf));
+				if (rc != EOK)
+					return rc;
+
+				rc = gfx_puttext(font, &tpos, &fmt, cbuf);
+				if (rc != EOK)
+					return rc;
+
 				s_column += 1;
+				tpos.x++;
 			} else {
 				fill = 1 + ALIGN_UP(s_column, TAB_WIDTH) -
 				    s_column;
 
-				for (j = 0; j < fill; ++j)
-					putchar(' ');
+				rc = gfx_set_color(gc, fmt.color);
+				if (rc != EOK)
+					return rc;
+
+				rect.p0.x = tpos.x;
+				rect.p0.y = tpos.y;
+				rect.p1.x = tpos.x + fill;
+				rect.p1.y = tpos.y + 1;
+
+				rc = gfx_fill_rect(gc, &rect);
+				if (rc != EOK)
+					return rc;
+
 				s_column += fill;
+				tpos.x += fill;
 			}
 		}
@@ -1144,16 +1222,19 @@
 		/* Fill until the end of display area. */
 
-		if ((unsigned)s_column - 1 < scr_columns)
-			fill = scr_columns - (s_column - 1);
-		else
-			fill = 0;
-
-		for (j = 0; j < fill; ++j)
-			putchar(' ');
-//		console_flush(con);
-//		console_set_style(con, STYLE_NORMAL);
-	}
-
-	pane.rflags |= REDRAW_CARET;
+		rc = gfx_set_color(gc, fmt.color);
+		if (rc != EOK)
+			return rc;
+
+		rect.p0.x = tpos.x;
+		rect.p0.y = tpos.y;
+		rect.p1.x = pane->rect.p1.x;
+		rect.p1.y = tpos.y + 1;
+
+		rc = gfx_fill_rect(gc, &rect);
+		if (rc != EOK)
+			return rc;
+	}
+
+	return EOK;
 }
 
@@ -1282,5 +1363,4 @@
 {
 	pane_t *pane = (pane_t *)arg;
-	gfx_color_t *color = NULL;
 	gfx_context_t *gc;
 	errno_t rc;
@@ -1288,13 +1368,5 @@
 	gc = ui_window_get_gc(pane->window);
 
-	rc = gfx_color_new_ega(0x01, &color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_set_color(gc, color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_fill_rect(gc, &pane->rect);
+	rc = pane_text_display(pane);
 	if (rc != EOK)
 		goto error;
@@ -1304,9 +1376,5 @@
 		goto error;
 
-	gfx_color_delete(color);
-	return EOK;
 error:
-	if (color != NULL)
-		gfx_color_delete(color);
 	return rc;
 }
Index: uspace/lib/ui/include/ui/resource.h
===================================================================
--- uspace/lib/ui/include/ui/resource.h	(revision f2d6d44e532b223e21bff270aeb76d05b91d40c0)
+++ uspace/lib/ui/include/ui/resource.h	(revision be869b085d9cf2a89b4dcbe18311b0bcbb72f2cd)
@@ -39,4 +39,5 @@
 #include <errno.h>
 #include <gfx/context.h>
+#include <gfx/font.h>
 #include <stdbool.h>
 #include <types/ui/resource.h>
@@ -47,4 +48,5 @@
     void *);
 extern void ui_resource_expose(ui_resource_t *);
+extern gfx_font_t *ui_resource_get_font(ui_resource_t *);
 
 #endif
Index: uspace/lib/ui/src/resource.c
===================================================================
--- uspace/lib/ui/src/resource.c	(revision f2d6d44e532b223e21bff270aeb76d05b91d40c0)
+++ uspace/lib/ui/src/resource.c	(revision be869b085d9cf2a89b4dcbe18311b0bcbb72f2cd)
@@ -594,4 +594,14 @@
 }
 
+/** Get the UI font.
+ *
+ * @param resource UI resource
+ * @return UI font
+ */
+gfx_font_t *ui_resource_get_font(ui_resource_t *resource)
+{
+	return resource->font;
+}
+
 /** @}
  */
