mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-23 13:19:54 +00:00
Fix bug in V;! not bringing back the mouse ##visual
This commit is contained in:
parent
bb575f247d
commit
5be9cdd59c
@ -642,43 +642,34 @@ R_API void r_cons_enable_highlight(const bool enable) {
|
||||
}
|
||||
|
||||
R_API bool r_cons_enable_mouse(const bool enable) {
|
||||
if ((I->mouse && enable) || (!I->mouse && !enable)) {
|
||||
return I->mouse;
|
||||
}
|
||||
bool enabled = I->mouse;
|
||||
#if R2__WINDOWS__
|
||||
HANDLE h = GetStdHandle (STD_INPUT_HANDLE);
|
||||
GetConsoleMode (h, &mode);
|
||||
DWORD mode |= ENABLE_EXTENDED_FLAGS;
|
||||
mode |= enable
|
||||
? (mode | ENABLE_MOUSE_INPUT) & ~ENABLE_QUICK_EDIT_MODE
|
||||
: (mode & ~ENABLE_MOUSE_INPUT) | ENABLE_QUICK_EDIT_MODE;
|
||||
if (SetConsoleMode (h, mode)) {
|
||||
I->mouse = enable;
|
||||
}
|
||||
#else
|
||||
if (I->vtmode == 2) {
|
||||
#endif
|
||||
const char *click = enable
|
||||
? "\x1b[?1000;1006;1015h"
|
||||
: "\x1b[?1000;1006;1015l";
|
||||
// : "\x1b[?1001r\x1b[?1000l";
|
||||
// : "\x1b[?1000;1006;1015l";
|
||||
// const char *old = enable ? "\x1b[?1001s" "\x1b[?1000h" : "\x1b[?1001r" "\x1b[?1000l";
|
||||
bool enabled = I->mouse;
|
||||
const size_t click_len = strlen (click);
|
||||
if (write (2, click, click_len) != click_len) {
|
||||
return false;
|
||||
enabled = false;
|
||||
} else {
|
||||
I->mouse = enable;
|
||||
}
|
||||
I->mouse = enable;
|
||||
return enabled;
|
||||
#if R2__WINDOWS__
|
||||
}
|
||||
DWORD mode;
|
||||
HANDLE h;
|
||||
bool enabled = I->mouse;
|
||||
h = GetStdHandle (STD_INPUT_HANDLE);
|
||||
GetConsoleMode (h, &mode);
|
||||
mode |= ENABLE_EXTENDED_FLAGS;
|
||||
mode = enable
|
||||
? (mode | ENABLE_MOUSE_INPUT) & ~ENABLE_QUICK_EDIT_MODE
|
||||
: (mode & ~ENABLE_MOUSE_INPUT) | ENABLE_QUICK_EDIT_MODE;
|
||||
if (SetConsoleMode (h, mode)) {
|
||||
I->mouse = enable;
|
||||
}
|
||||
return enabled;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
return enabled;
|
||||
}
|
||||
|
||||
R_API RCons *r_cons_new(void) {
|
||||
|
@ -1351,19 +1351,20 @@ R_API int r_core_visual_prevopsz(RCore *core, ut64 addr) {
|
||||
}
|
||||
|
||||
static void addComment(RCore *core, ut64 addr) {
|
||||
char buf[1024];
|
||||
r_cons_printf ("Enter comment for reference:\n");
|
||||
r_core_visual_showcursor (core, true);
|
||||
r_cons_flush ();
|
||||
r_cons_set_raw (false);
|
||||
r_line_set_prompt (PROMPTSTR);
|
||||
r_cons_enable_mouse (false);
|
||||
char buf[1024];
|
||||
if (r_cons_fgets (buf, sizeof (buf), 0, NULL) < 0) {
|
||||
buf[0] = '\0';
|
||||
}
|
||||
r_core_cmdf (core, "\"\"@0x%08"PFMT64x"\"\"CC %s", addr, buf);
|
||||
r_core_visual_showcursor (core, false);
|
||||
r_core_cmdf (core, "'@0x%08"PFMT64x"'CC %s", addr, buf);
|
||||
r_cons_set_raw (true);
|
||||
r_cons_enable_mouse (r_config_get_b (core->config, "scr.wheel"));
|
||||
r_core_visual_showcursor (core, false);
|
||||
}
|
||||
|
||||
static void add_ref(RCore *core) {
|
||||
|
Loading…
Reference in New Issue
Block a user