diff options
author | Ron Yorston <rmy@pobox.com> | 2019-03-15 10:07:14 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2019-03-15 10:07:14 +0000 |
commit | 79c85ec59075b5ead415a4713bd72445546dcf8e (patch) | |
tree | 614d5f43da34da207de8be08d186cf78169cf859 | |
parent | ec02b825d05d814800558995e2f28513de80206b (diff) | |
download | busybox-w32-79c85ec59075b5ead415a4713bd72445546dcf8e.tar.gz busybox-w32-79c85ec59075b5ead415a4713bd72445546dcf8e.tar.bz2 busybox-w32-79c85ec59075b5ead415a4713bd72445546dcf8e.zip |
lineedit: add a command to change backslashes to slashes
When a path name is copied to a console application using drag and
drop the path separator is backslash. To handle this situation in
the shell add an editing command (Ctrl-Z) to convert all backslashes
on the current line to slashes.
See GitHub issue #149.
Also remove some unused code from read_key().
-rw-r--r-- | libbb/lineedit.c | 7 | ||||
-rw-r--r-- | win32/termios.c | 6 |
2 files changed, 7 insertions, 6 deletions
diff --git a/libbb/lineedit.c b/libbb/lineedit.c index 95f92aa75..abe2857b2 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c | |||
@@ -2608,6 +2608,13 @@ int FAST_FUNC read_line_input(line_input_t *st, const char *prompt, char *comman | |||
2608 | input_tab(&lastWasTab); | 2608 | input_tab(&lastWasTab); |
2609 | break; | 2609 | break; |
2610 | #endif | 2610 | #endif |
2611 | #if ENABLE_PLATFORM_MINGW32 | ||
2612 | case CTRL('Z'): | ||
2613 | command_ps[command_len] = '\0'; | ||
2614 | convert_slashes(command_ps); | ||
2615 | redraw(cmdedit_y, 0); | ||
2616 | break; | ||
2617 | #endif | ||
2611 | case CTRL('K'): | 2618 | case CTRL('K'): |
2612 | /* Control-k -- clear to end of line */ | 2619 | /* Control-k -- clear to end of line */ |
2613 | command_ps[cursor] = BB_NUL; | 2620 | command_ps[cursor] = BB_NUL; |
diff --git a/win32/termios.c b/win32/termios.c index fe6f0c546..25f2ea48c 100644 --- a/win32/termios.c +++ b/win32/termios.c | |||
@@ -71,12 +71,6 @@ int64_t FAST_FUNC read_key(int fd, char *buf UNUSED_PARAM, int timeout) | |||
71 | continue; | 71 | continue; |
72 | } | 72 | } |
73 | } | 73 | } |
74 | if (state & (RIGHT_CTRL_PRESSED|LEFT_CTRL_PRESSED) && | ||
75 | (record.Event.KeyEvent.wVirtualKeyCode >= 'A' && | ||
76 | record.Event.KeyEvent.wVirtualKeyCode <= 'Z')) { | ||
77 | ret = record.Event.KeyEvent.wVirtualKeyCode & ~0x40; | ||
78 | break; | ||
79 | } | ||
80 | 74 | ||
81 | switch (record.Event.KeyEvent.wVirtualKeyCode) { | 75 | switch (record.Event.KeyEvent.wVirtualKeyCode) { |
82 | case VK_DELETE: ret = KEYCODE_DELETE; goto done; | 76 | case VK_DELETE: ret = KEYCODE_DELETE; goto done; |