diff --git a/README.md b/README.md index 09b0025..24d1716 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ area outside of a cursor row, and another activates when you click inside the cursor row. Left button: - - types clicked char + - if Ctrl pressed: type clicked char; otherwise do nothing - moves the cursor to the clicked location Middle button: diff --git a/src/command.c b/src/command.c index 0072920..14e9ac0 100644 --- a/src/command.c +++ b/src/command.c @@ -578,22 +578,17 @@ static void advance_cmd_arg(void) return; } -static unsigned short keyb_shift_states; static unsigned short keyb_get_rawcode(void) { unsigned short c = getch(); if (c == 0x00/* || c == 0xE0*/) c = getch()<<8; - - if (c == KEY_INSERT) - keyb_shift_states ^= KEYB_FLAG_INSERT; - return c; } -static unsigned short keyb_get_shift_states(void) +unsigned short keyb_get_shift_states(void) { - return keyb_shift_states; + return bioskey(2); } static void prompt_for_and_get_cmd(void) diff --git a/src/command.h b/src/command.h index 1b52ab1..a93148f 100644 --- a/src/command.h +++ b/src/command.h @@ -42,7 +42,16 @@ */ #define GET_ENHANCED_KEYSTROKE 0x10 #define GET_EXTENDED_SHIFT_STATES 0x12 + +#define KEYB_FLAG_RSHIFT 0x0001 +#define KEYB_FLAG_LSHIFT 0x0002 +#define KEYB_FLAG_CTRL 0x0004 +#define KEYB_FLAG_ALT 0x0008 +#define KEYB_FLAG_SCROLLOCK 0x0010 +#define KEYB_FLAG_NUMLOCK 0x0020 +#define KEYB_FLAG_CAPSLOCK 0x0040 #define KEYB_FLAG_INSERT 0x0080 + #define KEY_ASCII(k) (k & 0x00FF) #define KEY_SCANCODE(k) (k >> 0x08 ) #define KEY_EXTM(k) (k & 0xFF1F) @@ -467,4 +476,6 @@ struct built_in_cmd extern struct built_in_cmd cmd_table[]; extern const int CMD_TABLE_COUNT; +unsigned short keyb_get_shift_states(void); + #endif diff --git a/src/mouse.c b/src/mouse.c index c0b5efa..3a2d603 100644 --- a/src/mouse.c +++ b/src/mouse.c @@ -23,6 +23,7 @@ #include #include #include "asm.h" +#include "command.h" #include "mouse.h" #define CF 1 @@ -78,6 +79,7 @@ static void mlb(int alt_fn, int x, int y) { __dpmi_regs r = { }; short c; + int shift = keyb_get_shift_states(); if (alt_fn) { int cx = wherex(); @@ -89,6 +91,8 @@ static void mlb(int alt_fn, int x, int y) mvxr(x - cx); return; } + if (!(shift & KEYB_FLAG_CTRL)) + return; _conio_gettext(x, y, x, y, &c);