mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-24 05:40:10 +00:00
Fix input on Cygwin
This commit is contained in:
parent
f98d144afa
commit
db22e7337e
@ -6,7 +6,7 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#if __WINDOWS__
|
||||
#if __WINDOWS__ && !__CYGWIN__
|
||||
#include <windows.h>
|
||||
#define USE_UTF8 0
|
||||
#else
|
||||
@ -85,7 +85,7 @@ static int r_line_readchar_utf8(unsigned char *s, int slen) {
|
||||
return len;
|
||||
}
|
||||
#endif
|
||||
#if __WINDOWS__
|
||||
#if __WINDOWS__ && !__CYGWIN__
|
||||
static int r_line_readchar_win(int * vch) { // this function handle the input in console mode
|
||||
ut8 buf[2];
|
||||
*buf = '\0';
|
||||
@ -178,7 +178,7 @@ do_it_again:
|
||||
static int r_line_readchar() {
|
||||
ut8 buf[2];
|
||||
*buf = '\0';
|
||||
#if __WINDOWS__
|
||||
#if __WINDOWS__ && !__CYGWIN__
|
||||
#if 1 // new implementation for read input at windows by skuater. If something fail set this to 0
|
||||
int dummy=0;
|
||||
return r_line_readchar_win(&dummy);
|
||||
@ -191,7 +191,7 @@ static int r_line_readchar() {
|
||||
#endif
|
||||
|
||||
do_it_again:
|
||||
#if __WINDOWS__
|
||||
#if __WINDOWS__ && !__CYGWIN__
|
||||
h = GetStdHandle (STD_INPUT_HANDLE);
|
||||
GetConsoleMode (h, &mode);
|
||||
SetConsoleMode (h, 0); // RAW
|
||||
@ -454,7 +454,7 @@ R_API void r_line_autocomplete() {
|
||||
R_API const char *r_line_readline() {
|
||||
return r_line_readline_cb (NULL, NULL);
|
||||
}
|
||||
#if __WINDOWS__
|
||||
#if __WINDOWS__ && !__CYGWIN__
|
||||
R_API const char *r_line_readline_cb_win(RLineReadCallback cb, void *user) {
|
||||
int columns = r_cons_get_size (NULL)-2;
|
||||
const char *gcomp_line = "";
|
||||
@ -834,7 +834,7 @@ _end:
|
||||
#endif
|
||||
|
||||
R_API const char *r_line_readline_cb(RLineReadCallback cb, void *user) {
|
||||
#if __WINDOWS__
|
||||
#if __WINDOWS__ && !__CYGWIN__
|
||||
#if 1 // new implementation for read input at windows by skuater. If something fail set this to 0
|
||||
return r_line_readline_cb_win(cb,user);
|
||||
#endif
|
||||
@ -911,7 +911,7 @@ R_API const char *r_line_readline_cb(RLineReadCallback cb, void *user) {
|
||||
columns = r_cons_get_size (NULL)-2;
|
||||
if (columns<1)
|
||||
columns = 40;
|
||||
#if __WINDOWS__
|
||||
#if __WINDOWS__ && !__CYGWIN__
|
||||
if (I.echo)
|
||||
printf ("\r%*c\r", columns, ' ');
|
||||
#else
|
||||
|
@ -37,7 +37,7 @@ R_API int r_cons_controlz(int ch) {
|
||||
}
|
||||
|
||||
R_API int r_cons_arrow_to_hjkl(int ch) {
|
||||
#if __WINDOWS_
|
||||
#if __WINDOWS_ && !__CYGWIN__
|
||||
return ch;
|
||||
#endif
|
||||
I->mouse_event = 0;
|
||||
|
@ -624,8 +624,8 @@ R_API int r_core_visual_xrefs_X (RCore *core) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if __WINDOWS__ && !__CYGWIN__
|
||||
void SetWindow(int Width, int Height) {
|
||||
#if __WINDOWS__
|
||||
COORD coord;
|
||||
coord.X = Width;
|
||||
coord.Y = Height;
|
||||
@ -639,8 +639,8 @@ void SetWindow(int Width, int Height) {
|
||||
HANDLE Handle = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
SetConsoleScreenBufferSize(Handle, coord);
|
||||
SetConsoleWindowInfo(Handle, TRUE, &Rect);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
R_API int r_core_visual_cmd(RCore *core, int ch) {
|
||||
RAsmOp op;
|
||||
@ -651,7 +651,7 @@ R_API int r_core_visual_cmd(RCore *core, int ch) {
|
||||
ch = r_cons_arrow_to_hjkl (ch);
|
||||
ch = visual_nkey (core, ch);
|
||||
if (ch<2) return 1;
|
||||
|
||||
|
||||
if (r_cons_singleton()->mouse_event) {
|
||||
wheelspeed = r_config_get_i (core->config, "scr.wheelspeed");
|
||||
} else {
|
||||
@ -675,12 +675,14 @@ R_API int r_core_visual_cmd(RCore *core, int ch) {
|
||||
}
|
||||
} else
|
||||
switch (ch) {
|
||||
#if __WINDOWS__ && !__CYGWIN__
|
||||
case 0xf5:
|
||||
SetWindow(81,25);
|
||||
break;
|
||||
case 0xcf5:
|
||||
SetWindow(81,40);
|
||||
break;
|
||||
#endif
|
||||
case 0x0d:
|
||||
{
|
||||
RAnalOp *op;
|
||||
|
Loading…
Reference in New Issue
Block a user