mirror of
https://github.com/radareorg/radare2.git
synced 2024-12-03 02:41:08 +00:00
Enable mouse only if it was prev enabled and based on scr.wheel (#14925)
This commit is contained in:
parent
4b40727715
commit
430a76a29e
@ -625,6 +625,12 @@ static void reset_print_cur(RPrint *p) {
|
||||
p->ocur = -1;
|
||||
}
|
||||
|
||||
static bool __holdMouseState(RCore *core) {
|
||||
bool m = r_cons_singleton ()->mouse;
|
||||
r_cons_enable_mouse (false);
|
||||
return m;
|
||||
}
|
||||
|
||||
static void backup_current_addr(RCore *core, ut64 *addr, ut64 *bsze, ut64 *newaddr) {
|
||||
*addr = core->offset;
|
||||
*bsze = core->blocksize;
|
||||
@ -673,7 +679,7 @@ R_API void r_core_visual_prompt_input(RCore *core) {
|
||||
ut64 addr, bsze, newaddr = 0LL;
|
||||
int ret, h;
|
||||
(void) r_cons_get_size (&h);
|
||||
r_cons_enable_mouse (false);
|
||||
bool mouse_state = __holdMouseState(core);
|
||||
r_cons_gotoxy (0, h);
|
||||
r_cons_reset_colors ();
|
||||
//r_cons_printf ("\nPress <enter> to return to Visual mode.\n");
|
||||
@ -688,7 +694,7 @@ R_API void r_core_visual_prompt_input(RCore *core) {
|
||||
|
||||
r_cons_show_cursor (false);
|
||||
core->vmode = true;
|
||||
r_cons_enable_mouse (true);
|
||||
r_cons_enable_mouse (mouse_state && r_config_get_i (core->config, "scr.wheel"));
|
||||
r_cons_show_cursor (true);
|
||||
}
|
||||
|
||||
@ -1601,7 +1607,7 @@ char *getcommapath(RCore *core) {
|
||||
}
|
||||
|
||||
static void visual_comma(RCore *core) {
|
||||
r_cons_enable_mouse (false);
|
||||
bool mouse_state = __holdMouseState (core);
|
||||
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);
|
||||
@ -1636,7 +1642,7 @@ static void visual_comma(RCore *core) {
|
||||
eprintf ("No commafile found.\n");
|
||||
}
|
||||
free (comment);
|
||||
r_cons_enable_mouse (true);
|
||||
r_cons_enable_mouse (mouse_state && r_config_get_i (core->config, "scr.wheel"));
|
||||
}
|
||||
|
||||
static bool isDisasmPrint(int mode) {
|
||||
@ -2589,20 +2595,21 @@ 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);
|
||||
case 'd': {
|
||||
bool mouse_state = __holdMouseState (core);
|
||||
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);
|
||||
r_cons_enable_mouse (mouse_state && r_config_get_i(core->config, "scr.wheel"));
|
||||
}
|
||||
break;
|
||||
case 'D':
|
||||
setdiff (core);
|
||||
break;
|
||||
case 'f':
|
||||
{
|
||||
r_cons_enable_mouse (false);
|
||||
bool mouse_state = __holdMouseState (core);
|
||||
int range, min, max;
|
||||
char name[256], *n;
|
||||
r_line_set_prompt ("flag name: ");
|
||||
@ -2640,9 +2647,9 @@ R_API int r_core_visual_cmd(RCore *core, const char *arg) {
|
||||
}
|
||||
}
|
||||
}
|
||||
r_cons_enable_mouse (mouse_state && r_config_get_i(core->config, "scr.wheel"));
|
||||
}
|
||||
r_core_visual_showcursor (core, false);
|
||||
r_cons_enable_mouse (true);
|
||||
break;
|
||||
case ',':
|
||||
visual_comma (core);
|
||||
@ -3256,8 +3263,8 @@ R_API int r_core_visual_cmd(RCore *core, const char *arg) {
|
||||
}
|
||||
}
|
||||
break;
|
||||
case '/':
|
||||
r_cons_enable_mouse (false);
|
||||
case '/': {
|
||||
bool mouse_state = __holdMouseState (core);
|
||||
if (core->print->cur_enabled) {
|
||||
if (core->seltab < 2 && core->printidx == R_CORE_VISUAL_MODE_DB) {
|
||||
if (core->seltab) {
|
||||
@ -3281,8 +3288,8 @@ 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;
|
||||
r_cons_enable_mouse (mouse_state && r_config_get_i (core->config, "scr.wheel"));
|
||||
} break;
|
||||
case '(':
|
||||
snowMode = !snowMode;
|
||||
if (!snowMode) {
|
||||
|
Loading…
Reference in New Issue
Block a user