From 11689987434a414c5bce98c8785c6f49b01a88e4 Mon Sep 17 00:00:00 2001 From: pancake Date: Thu, 29 Aug 2013 05:42:50 +0200 Subject: [PATCH] Add scr.heightfix --- libr/cons/cons.c | 3 +++ libr/core/config.c | 7 +++++++ libr/include/r_cons.h | 1 + 3 files changed, 11 insertions(+) diff --git a/libr/cons/cons.c b/libr/cons/cons.c index 7e9a0f6b5d..ff5a520212 100644 --- a/libr/cons/cons.c +++ b/libr/cons/cons.c @@ -108,6 +108,7 @@ R_API RCons *r_cons_new () { I.line = r_line_new (); I.event_interrupt = NULL; I.blankline = R_TRUE; + I.heightfix = 0; I.widthfix = 0; I.event_resize = NULL; I.data = NULL; @@ -441,6 +442,8 @@ R_API int r_cons_get_size(int *rows) { if (ioctl (1, TIOCGWINSZ, &win) == 0) { I.columns = win.ws_col; I.rows = win.ws_row-1; + if (I.heightfix) + I.rows--; } else { I.columns = 80; I.rows = 23; diff --git a/libr/core/config.c b/libr/core/config.c index bed6a3ca03..a5d00707e3 100644 --- a/libr/core/config.c +++ b/libr/core/config.c @@ -43,6 +43,11 @@ static int config_hexcols_callback(void *user, void *data) { return R_TRUE; } +static int config_heightfix_callback(void *user, void *data) { + RConfigNode *node = (RConfigNode *) data; + r_cons_singleton ()->heightfix = node->i_value; + return R_TRUE; +} static int config_widthfix_callback(void *user, void *data) { RConfigNode *node = (RConfigNode *) data; r_cons_singleton ()->widthfix = node->i_value; @@ -832,6 +837,8 @@ r_config_set (cfg, "asm.arch", R_SYS_ARCH); r_config_desc (cfg, "hex.cols", "Configure the number of columns in hexdump"); r_config_set_cb (cfg, "scr.html", "false", &config_scrhtml_callback); r_config_desc (cfg, "scr.html", "If enabled disassembly use HTML syntax"); + r_config_set_cb (cfg, "scr.heightfix", "false", &config_widthfix_callback); + r_config_desc (cfg, "scr.heightfix", "Workaround for Linux TTY"); r_config_set_cb (cfg, "scr.widthfix", "false", &config_widthfix_callback); r_config_desc (cfg, "scr.widthfix", "Workaround for Prompt iOS ssh client"); r_config_set (cfg, "search.in", "file"); diff --git a/libr/include/r_cons.h b/libr/include/r_cons.h index ba357a7c8d..df9681853d 100644 --- a/libr/include/r_cons.h +++ b/libr/include/r_cons.h @@ -135,6 +135,7 @@ typedef struct r_cons_t { char *pager; int blankline; int widthfix; + int heightfix; int truecolor; // 1 = rgb 256), 2 = truecolor (16M) RConsPalette pal; struct r_line_t *line;