Fixes : Enable and disable mouse based on requirement in visual/panels ()

This commit is contained in:
dodococo 2019-08-27 19:14:42 +05:30 committed by radare
parent 9f4375be46
commit 9926496395
2 changed files with 11 additions and 0 deletions
libr

@ -1268,6 +1268,8 @@ R_API const char *r_line_readline_cb(RLineReadCallback cb, void *user) {
I.buffer.length = 0;
}
}
bool mouse_status = r_cons_singleton()->mouse;
r_cons_enable_mouse (false);
#if USE_UTF8
utflen = r_line_readchar_utf8 ((ut8 *) buf, sizeof (buf));
if (utflen < 1) {
@ -1309,6 +1311,7 @@ R_API const char *r_line_readline_cb(RLineReadCallback cb, void *user) {
printf ("\r\x1b[2K\r"); // %*c\r", columns, ' ');
}
#endif
r_cons_enable_mouse (mouse_status);
switch (*buf) {
case 0: // control-space
/* ignore atm */

@ -1598,6 +1598,7 @@ char *getcommapath(RCore *core) {
}
static void visual_comma(RCore *core) {
r_cons_enable_mouse (false);
ut64 addr = core->offset + (core->print->cur_enabled? core->print->cur: 0);
char *comment, *cwd, *cmtfile;
comment = r_meta_get_string (core->anal, R_META_TYPE_COMMENT, addr);
@ -1632,6 +1633,7 @@ static void visual_comma(RCore *core) {
eprintf ("No commafile found.\n");
}
free (comment);
r_cons_enable_mouse (true);
}
static bool isDisasmPrint(int mode) {
@ -2584,16 +2586,19 @@ R_API int r_core_visual_cmd(RCore *core, const char *arg) {
r_config_set_i (core->config, "scr.color", color);
break;
case 'd':
r_cons_enable_mouse (false);
r_core_visual_showcursor (core, true);
int distance = numbuf_pull ();
r_core_visual_define (core, arg + 1, distance - 1);
r_core_visual_showcursor (core, false);
r_cons_enable_mouse (true);
break;
case 'D':
setdiff (core);
break;
case 'f':
{
r_cons_enable_mouse (false);
int range, min, max;
char name[256], *n;
r_line_set_prompt ("flag name: ");
@ -2633,6 +2638,7 @@ R_API int r_core_visual_cmd(RCore *core, const char *arg) {
}
}
r_core_visual_showcursor (core, false);
r_cons_enable_mouse (true);
break;
case ',':
visual_comma (core);
@ -3242,6 +3248,7 @@ R_API int r_core_visual_cmd(RCore *core, const char *arg) {
}
break;
case '/':
r_cons_enable_mouse (false);
if (core->print->cur_enabled) {
if (core->seltab < 2 && core->printidx == R_CORE_VISUAL_MODE_DB) {
if (core->seltab) {
@ -3265,6 +3272,7 @@ R_API int r_core_visual_cmd(RCore *core, const char *arg) {
r_core_block_size (core, core->blocksize - cols);
}
}
r_cons_enable_mouse (true);
break;
case '(':
snowMode = !snowMode;