* get rid of extra memory duplication;
* support of recursive search of correct encoding;
* add tests.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
to drop already received part - there can be more of it
coming over e.g. a serial line.
To prevent interpreting it as a random garbage,
eat and discard all chars that follow.
Small, but non-zero timeout is needed to reconnect
escape sequence split up by a serial line.
Before this change, Ctrl-Alt-Shift-Right_Arrow generates "1;8C"
bogus "input" in MC on my machine; after the change,
nothing is generated.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
tail as a garbage input. To reproduce, run "sleep 3" and
hold down Down_Arrow key until sleep runs.
With debugging log enabled, the following can be seen:
entered get_key_code(no_delay:0)
c=tty_lowlevel_getch()=27
push_char(27) !0
c=xgetch_second()=91
push_char(91) !0
2 c=tty_lowlevel_getch()=66
push_char(66)
seq_buffer[0]:27 <---- the saved Down Arrow sequence "ESC [ B"
seq_buffer[1]:91
seq_buffer[2]:66
seq_buffer[3]:0
pending_keys!=NULL. m=-1
d=*pending_keys++=27
d=ALT(*pending_keys++)=ALT(91)=8283
^^^^^^^^^^^^^^^^^^^^^^^ we misinterpret "ESC [ B" as "ESC ["
return correct_key_code(8283)
entered get_key_code(no_delay:0)
pending_keys!=NULL. m=-1
d=*pending_keys++=66
^^^^^^^^^^^^ we think user pressed "B"
return correct_key_code(66)
With this patch, no bogus "input" is generated.
Longer unknown sequences need an additional fix, coming next.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
keyboard input: simplify code, no logic changes
This change slightly simplifies and rearranges the code
in get_key_code(), reduces indentation levels there,
adds a few comments. The logic remains the same.
This is a preparatory patch for subsequent changes.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
How to reproduce:
1. Switch the "Drop down menus" option off.
2. Press F9 to activate menubar. Menu is not dropped.
3. Click somewhere below menubar, on one of the files in the directory
listing.
Buggy behavior: the corresponding "Left" or "File" etc. dropdown is
opened, and the mouse button is released, menu item under the mouse
cursor is activated.
Correct behavior: clicking with the mouse somewhere other than the
active menubar doesn't open dropdown menu, instead removes the focus from
menubar and acts on the actual item under the mouse pointer (such
as a filename in the panel).
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
for example, the config file may contain strings:
[External editor or viewer parameters]
vim = %filename +%lineno
mcedit = %filename:%lineno
And these external editors will open a file at the previously saved position.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
Test case:
1. Create a file with name that contains some special chars:
touch attachment.cgi?id=564208
2. Press F6.
3. Press a. Now only the 'a' letter is in input line.
4. Press Esc Tab Enter.
5a. Input line is filled by 'attachment.cgi?id=564208'...
5b. but 'attachment.cgi\?id=564208' is expected.
6. Add 'patch_' before file name:
'patch_attachment.cgi?id=564208'.
7. Press Enter.
8a. Result: 'patch_attachment.cgiattachment.cgi?id=564208id=564208'.
8b. Expected result: 'patch_attachment.cgi?id=564208'.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Steps to Reproduce:
1. Run mc in native console (not in X terminal emulator).
2. Press Ctrl+O to switch to subshell.
3. Try select anything with mouse.
Result: mouse does't select anything.
This bug was introduced in 68468a25ac
commit.
Solution: make mouse initialization after initializaton of subshell.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
A followup extension, "SGR 1006" was invented by xterm, to overcome some
of the shortcomings of the previous one. It is becoming as widespread as
the previous one, and is likely to soon overtake it in popularity.
Note that most of the patch is just the removal of the huge complexity
introduced by the previous one. The previous extension didn't have a
unique prefix which made the whole parsing logic extremely complicated.
The new extension does have a unique prefix, so parsing becomes a piece
of cake. The code becomes much cleaner and much easier to maintain.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
* (filename_completion_function): use GString to ret rid of hand-made
low-level memory allocation.
* (variable_completion_function): likewise.
* (hostname_completion_function): likewise.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
* (hline_set_text): new function.
* (file_progress_show_total): use hline_set_text to show processed
files counter.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
...to avoid conflict with global names.
On HP-UX, inttypes.h includes ctype.h through other dependencies, ctype.h
defines macros for various functions and these macros clash with entries
of "struct str_class".
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>