From 89955cc13a17ad7ed79b48f5272e6484dd818d9b Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Sat, 27 Jan 2024 12:14:01 +0100 Subject: [PATCH] [quickjs] cell_width and cell_height --- src/ecmascript/quickjs/screen.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/ecmascript/quickjs/screen.c b/src/ecmascript/quickjs/screen.c index f55009a4..e9a33ba0 100644 --- a/src/ecmascript/quickjs/screen.c +++ b/src/ecmascript/quickjs/screen.c @@ -35,8 +35,13 @@ js_screen_get_property_availHeight(JSContext *ctx, JSValueConst this_val) if (!doc_view) { return JS_UNDEFINED; } + struct session *ses = doc_view->session; - return JS_NewInt32(ctx, doc_view->box.height * 16); + if (!ses) { + return JS_UNDEFINED; + } + + return JS_NewInt32(ctx, doc_view->box.height * ses->tab->term->cell_height); } static JSValue @@ -54,8 +59,13 @@ js_screen_get_property_availWidth(JSContext *ctx, JSValueConst this_val) if (!doc_view) { return JS_UNDEFINED; } + struct session *ses = doc_view->session; - return JS_NewInt32(ctx, doc_view->box.width * 8); + if (!ses) { + return JS_UNDEFINED; + } + + return JS_NewInt32(ctx, doc_view->box.width * ses->tab->term->cell_width); } static JSValue @@ -83,7 +93,7 @@ js_screen_get_property_height(JSContext *ctx, JSValueConst this_val) return JS_UNDEFINED; } - return JS_NewInt32(ctx, ses->tab->term->height * 16); + return JS_NewInt32(ctx, ses->tab->term->height * ses->tab->term->cell_height); } static JSValue @@ -111,7 +121,7 @@ js_screen_get_property_width(JSContext *ctx, JSValueConst this_val) return JS_UNDEFINED; } - return JS_NewInt32(ctx, ses->tab->term->width * 8); + return JS_NewInt32(ctx, ses->tab->term->width * ses->tab->term->cell_width); } static JSValue