diff options
| author | Jim Blandy | 1993-05-22 07:51:26 +0000 |
|---|---|---|
| committer | Jim Blandy | 1993-05-22 07:51:26 +0000 |
| commit | faf5e4076983788a6af13a0b9d98224b30500f3c (patch) | |
| tree | fc5eae4b57c8514bddc007288334b2a9bf8e746b /src | |
| parent | e959badab49fc399436f1531bbe8e4b1dea7ca1f (diff) | |
| download | emacs-faf5e4076983788a6af13a0b9d98224b30500f3c.tar.gz emacs-faf5e4076983788a6af13a0b9d98224b30500f3c.zip | |
* keyboard.c (make_ctrl_char): New function.
(read_char): Call it.
(kbd_buffer_store_event): Call it to see if the new character is
the quit character.
Diffstat (limited to 'src')
| -rw-r--r-- | src/keyboard.c | 53 |
1 files changed, 33 insertions, 20 deletions
diff --git a/src/keyboard.c b/src/keyboard.c index 023634663a5..d4a488e8047 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -1231,6 +1231,35 @@ stop_polling () | |||
| 1231 | #endif | 1231 | #endif |
| 1232 | } | 1232 | } |
| 1233 | 1233 | ||
| 1234 | /* Applying the control modifier to CHARACTER. */ | ||
| 1235 | int | ||
| 1236 | make_ctrl_char (c) | ||
| 1237 | int c; | ||
| 1238 | { | ||
| 1239 | /* If it's already a control character, don't mess with it. */ | ||
| 1240 | if ((c & 0160) == 0) | ||
| 1241 | ; | ||
| 1242 | /* Making ? a control character should result in DEL. */ | ||
| 1243 | |||
| 1244 | else if ((c & 0177) == '?') | ||
| 1245 | c |= 0177; | ||
| 1246 | |||
| 1247 | /* ASCII control chars are made from letters (both cases), | ||
| 1248 | as well as the non-letters within 0100...0137. */ | ||
| 1249 | else if ((c & 0137) >= 'A' && (c & 0137) <= 'Z') | ||
| 1250 | c = (c & (037 | ~0177)); | ||
| 1251 | else if ((c & 0177) >= 0100 && (c & 0177) <= 0137) | ||
| 1252 | c = (c & (037 | ~0177)); | ||
| 1253 | |||
| 1254 | /* Anything else must get its high control bit set. */ | ||
| 1255 | else | ||
| 1256 | c = c | ctrl_modifier; | ||
| 1257 | |||
| 1258 | return c; | ||
| 1259 | } | ||
| 1260 | |||
| 1261 | |||
| 1262 | |||
| 1234 | /* Input of single characters from keyboard */ | 1263 | /* Input of single characters from keyboard */ |
| 1235 | 1264 | ||
| 1236 | Lisp_Object print_help (); | 1265 | Lisp_Object print_help (); |
| @@ -1462,26 +1491,7 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu) | |||
| 1462 | if ((extra_keyboard_modifiers & CHAR_CTL) | 1491 | if ((extra_keyboard_modifiers & CHAR_CTL) |
| 1463 | || ((extra_keyboard_modifiers & 0177) < ' ' | 1492 | || ((extra_keyboard_modifiers & 0177) < ' ' |
| 1464 | && (extra_keyboard_modifiers & 0177) != 0)) | 1493 | && (extra_keyboard_modifiers & 0177) != 0)) |
| 1465 | { | 1494 | XSETINT (c, make_ctrl_char (XINT (c))); |
| 1466 | /* If it's already a control character, don't mess with it. */ | ||
| 1467 | if ((c & 0177) == 0) | ||
| 1468 | ; | ||
| 1469 | |||
| 1470 | /* Making ? a control character should result in DEL. */ | ||
| 1471 | else if ((c & 0177) == '?') | ||
| 1472 | c |= 0177; | ||
| 1473 | |||
| 1474 | /* ASCII control chars are made from letters (both cases), | ||
| 1475 | as well as the non-letters within 0100...0137. */ | ||
| 1476 | else if ((c & 0137) >= 0101 && (c & 0137) <= 0132) | ||
| 1477 | c = (c & (037 | ~0177)); | ||
| 1478 | else if ((c & 0177) >= 0100 && (c & 0177) <= 0137) | ||
| 1479 | c = (c & (037 | ~0177)); | ||
| 1480 | |||
| 1481 | /* Anything else must get its high control bit set. */ | ||
| 1482 | else | ||
| 1483 | c = c | ctrl_modifier; | ||
| 1484 | } | ||
| 1485 | 1495 | ||
| 1486 | /* Transfer any other modifier bits directly from | 1496 | /* Transfer any other modifier bits directly from |
| 1487 | extra_keyboard_modifiers to c. Ignore the actual character code | 1497 | extra_keyboard_modifiers to c. Ignore the actual character code |
| @@ -1692,6 +1702,9 @@ kbd_buffer_store_event (event) | |||
| 1692 | { | 1702 | { |
| 1693 | register int c = XFASTINT (event->code) & 0377; | 1703 | register int c = XFASTINT (event->code) & 0377; |
| 1694 | 1704 | ||
| 1705 | if (event->modifiers & ctrl_modifier) | ||
| 1706 | c = make_ctrl_char (c); | ||
| 1707 | |||
| 1695 | if (c == quit_char) | 1708 | if (c == quit_char) |
| 1696 | { | 1709 | { |
| 1697 | extern SIGTYPE interrupt_signal (); | 1710 | extern SIGTYPE interrupt_signal (); |