mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +03:00
* util.c: Added ascii_alpha_to_cntrl(), which converts 'x' to
^X. Useful for entering control characters literally. * util.h: Likewise. * widget.c: Use that function after C-q.
This commit is contained in:
parent
ace71736b8
commit
6d3226c4e7
@ -1,3 +1,10 @@
|
||||
2005-07-17 Roland Illig <roland.illig@gmx.de>
|
||||
|
||||
* util.c: Added ascii_alpha_to_cntrl(), which converts 'x' to
|
||||
^X. Useful for entering control characters literally.
|
||||
* util.h: Likewise.
|
||||
* widget.c: Use that function after C-q.
|
||||
|
||||
2005-07-17 Roland Illig <roland.illig@gmx.de>
|
||||
|
||||
* view.c: The viewer can remember the last file position and
|
||||
|
15
src/util.c
15
src/util.c
@ -1449,3 +1449,18 @@ str_unconst (const char *s)
|
||||
{
|
||||
return (char *) s;
|
||||
}
|
||||
|
||||
#define ASCII_A (0x40 + 1)
|
||||
#define ASCII_Z (0x40 + 26)
|
||||
#define ASCII_a (0x60 + 1)
|
||||
#define ASCII_z (0x60 + 26)
|
||||
|
||||
extern int
|
||||
ascii_alpha_to_cntrl (int ch)
|
||||
{
|
||||
if ((ch >= ASCII_A && ch <= ASCII_Z)
|
||||
|| (ch >= ASCII_a && ch <= ASCII_z)) {
|
||||
ch &= 0x1f;
|
||||
}
|
||||
return ch;
|
||||
}
|
||||
|
@ -255,4 +255,8 @@ void save_file_position (const char *filename, long line, long column);
|
||||
/* usage: str_cmp ("foo", !=, "bar") */
|
||||
#define str_cmp(a,rel,b) (strcmp ((a), (b)) rel 0)
|
||||
|
||||
/* if ch is in [A-Za-z], returns the corresponding control character,
|
||||
* else returns the argument. */
|
||||
extern int ascii_alpha_to_cntrl (int ch);
|
||||
|
||||
#endif
|
||||
|
@ -1586,7 +1586,7 @@ input_callback (Widget *w, widget_msg_t msg, int parm)
|
||||
case WIDGET_KEY:
|
||||
if (parm == XCTRL ('q')) {
|
||||
quote = 1;
|
||||
v = handle_char (in, mi_getch ());
|
||||
v = handle_char (in, ascii_alpha_to_cntrl (mi_getch ()));
|
||||
quote = 0;
|
||||
return v;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user