Index: uspace/lib/ui/include/ui/wdecor.h
===================================================================
--- uspace/lib/ui/include/ui/wdecor.h	(revision d92b8e8f16d19c0ce7828d8dfbc2f178747ce076)
+++ uspace/lib/ui/include/ui/wdecor.h	(revision 394ffff70b8978ebdfd3e168e743e37cb6dcd73f)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2023 Jiri Svoboda
+ * Copyright (c) 2024 Jiri Svoboda
  * All rights reserved.
  *
@@ -44,4 +44,5 @@
 #include <types/ui/event.h>
 #include <types/ui/resource.h>
+#include <types/ui/ui.h>
 #include <types/ui/wdecor.h>
 
@@ -58,5 +59,5 @@
 extern ui_evclaim_t ui_wdecor_kbd_event(ui_wdecor_t *, kbd_event_t *);
 extern ui_evclaim_t ui_wdecor_pos_event(ui_wdecor_t *, pos_event_t *);
-extern void ui_wdecor_rect_from_app(ui_wdecor_style_t, gfx_rect_t *,
+extern void ui_wdecor_rect_from_app(ui_t *, ui_wdecor_style_t, gfx_rect_t *,
     gfx_rect_t *);
 extern void ui_wdecor_app_from_rect(ui_wdecor_style_t, gfx_rect_t *,
Index: uspace/lib/ui/src/wdecor.c
===================================================================
--- uspace/lib/ui/src/wdecor.c	(revision d92b8e8f16d19c0ce7828d8dfbc2f178747ce076)
+++ uspace/lib/ui/src/wdecor.c	(revision 394ffff70b8978ebdfd3e168e743e37cb6dcd73f)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2023 Jiri Svoboda
+ * Copyright (c) 2024 Jiri Svoboda
  * All rights reserved.
  *
@@ -45,4 +45,5 @@
 #include <ui/paint.h>
 #include <ui/pbutton.h>
+#include <ui/ui.h>
 #include <ui/wdecor.h>
 #include "../private/resource.h"
@@ -94,4 +95,8 @@
 	/** Window resizing edge height */
 	wdecor_edge_h = 4,
+	/** Window resizing edge witdth */
+	wdecor_edge_w_text = 1,
+	/** Window resizing edge height */
+	wdecor_edge_h_text = 1,
 	/** Title bar height */
 	wdecor_tbar_h = 22,
@@ -860,22 +865,34 @@
  * and its decoration.
  *
+ * @param ui UI
  * @param style Decoration style
  * @param app Application area rectangle
  * @param rect Place to store (outer) window decoration rectangle
  */
-void ui_wdecor_rect_from_app(ui_wdecor_style_t style, gfx_rect_t *app,
-    gfx_rect_t *rect)
-{
+void ui_wdecor_rect_from_app(ui_t *ui, ui_wdecor_style_t style,
+    gfx_rect_t *app, gfx_rect_t *rect)
+{
+	bool textmode;
+	gfx_coord_t edge_w, edge_h;
 	*rect = *app;
 
+	textmode = ui_is_textmode(ui);
+	if (textmode) {
+		edge_w = wdecor_edge_w_text;
+		edge_h = wdecor_edge_h_text;
+	} else {
+		edge_w = wdecor_edge_w;
+		edge_h = wdecor_edge_h;
+	}
+
 	if ((style & ui_wds_frame) != 0) {
-		rect->p0.x -= wdecor_edge_w;
-		rect->p0.y -= wdecor_edge_h;
-		rect->p1.x += wdecor_edge_w;
-		rect->p1.y += wdecor_edge_h;
-	}
-
-	if ((style & ui_wds_titlebar) != 0)
-		rect->p0.y -= 22;
+		rect->p0.x -= edge_w;
+		rect->p0.y -= edge_h;
+		rect->p1.x += edge_w;
+		rect->p1.y += edge_h;
+	}
+
+	if ((style & ui_wds_titlebar) != 0 && !textmode)
+		rect->p0.y -= wdecor_tbar_h;
 }
 
Index: uspace/lib/ui/test/wdecor.c
===================================================================
--- uspace/lib/ui/test/wdecor.c	(revision d92b8e8f16d19c0ce7828d8dfbc2f178747ce076)
+++ uspace/lib/ui/test/wdecor.c	(revision 394ffff70b8978ebdfd3e168e743e37cb6dcd73f)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2023 Jiri Svoboda
+ * Copyright (c) 2024 Jiri Svoboda
  * All rights reserved.
  *
@@ -34,4 +34,5 @@
 #include <ui/pbutton.h>
 #include <ui/resource.h>
+#include <ui/ui.h>
 #include <ui/wdecor.h>
 #include "../private/wdecor.h"
@@ -1322,6 +1323,11 @@
 PCUT_TEST(rect_from_app)
 {
+	errno_t rc;
+	ui_t *ui = NULL;
 	gfx_rect_t arect;
 	gfx_rect_t rect;
+
+	rc = ui_create_disp(NULL, &ui);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
 
 	arect.p0.x = 14;
@@ -1330,5 +1336,5 @@
 	arect.p1.y = 196;
 
-	ui_wdecor_rect_from_app(ui_wds_none, &arect, &rect);
+	ui_wdecor_rect_from_app(ui, ui_wds_none, &arect, &rect);
 
 	PCUT_ASSERT_INT_EQUALS(14, rect.p0.x);
@@ -1337,5 +1343,5 @@
 	PCUT_ASSERT_INT_EQUALS(196, rect.p1.y);
 
-	ui_wdecor_rect_from_app(ui_wds_frame, &arect, &rect);
+	ui_wdecor_rect_from_app(ui, ui_wds_frame, &arect, &rect);
 
 	PCUT_ASSERT_INT_EQUALS(10, rect.p0.x);
@@ -1344,5 +1350,5 @@
 	PCUT_ASSERT_INT_EQUALS(200, rect.p1.y);
 
-	ui_wdecor_rect_from_app(ui_wds_decorated, &arect, &rect);
+	ui_wdecor_rect_from_app(ui, ui_wds_decorated, &arect, &rect);
 
 	PCUT_ASSERT_INT_EQUALS(10, rect.p0.x);
@@ -1351,4 +1357,5 @@
 	PCUT_ASSERT_INT_EQUALS(200, rect.p1.y);
 
+	ui_destroy(ui);
 }
 
