MC already has its own half-ready trick: when pasting with Shift-Insert,
using the X11 extension, the newline ("Enter" as mc calls it) with the
Shift modifier pressed gets converted to a "Return", and in the editor
the Return character inserts a non-indenting newline. This makes pasting
better in terminals not supporting bracketed paste, however, it has some
problems that this commit addresses:
* Shift+newline gets this special treatment, but Ctrl+newline gets
dropped. Hence e.g. when pasting in Gnome-terminal with Ctrl+Shift+V
all the newlines will be missing. This commit adds the same
non-indenting newline behavior to Ctrl+Newline and Ctrl+Shift+Newline.
* The code forgets about Tab that also needs special treatment:
- Most terminals send \e[Z on Shift+Tab, this is not handled by MC
at all, moreover it causes a hang for about a second. This commit
teaches this sequence to MC. This is especially useful when no X11
is available, because there Ctrl+Tab is identical to Tab, so the
backwards tab feature is not available. With this commit Shift+Tab
becomes a backwards tab too on all terminals that emit \e[Z.
- When pasting to the editor, Shift+Tab, Ctrl+Tab and Ctrl+Shift+Tab
should all insert a tab for the same reason mentioned at the newline.
- It would look inconsistent in the keymap files to have logical code
such as "backtab" instead of "shift-tab" and friends, hence get rid
of KEY_BTAB and use KEY_M_SHIFT | '\t' instead.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
...if file encoding and locale are different.
Example: locale is KOI8-R, file encoding is UTF-8. Note: those encodings
are not same.
File content is following (in Russian):
йцукен
Йцукен
The difference is in first line char only: Й (lowercase letter) and й
(uppercase letter). The search of Ê gives the result Й independently of
case sensitivity. й isn't found.
If switch "All charsets" on, nothing is found.
The main idea of fix is modification of search API to allow set of search
pattern charset and use if within search engine.
Old API:
mc_search_new (pattern, pattern_len);
New API:
mc_search_new (pattern, pattern_len, pattern_charset);
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
HAVE_NCURSESW_CURSES_H included the wrong header.
Partially revert 80c8d58003
for lib/tty/tty-ncurses.h.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
When there's no mc-tmpdir and a user tries to start two mc sessions
simultaneously, sometimes (in one out of ten attempts on my machine) one
mc session emits the following error message:
Cannot create temporary directory /tmp/mc-lars: File exists (17)
Temporary files will be created in /tmp
Press any key to continue...
Steps to reproduce:
# rm /tmp/mc-$(whoami) -rf
# uxterm -e mc & uxterm -e mc
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
mc may not detect the gpm mouse under X11 on many x terminals when running together with tmux or screen.
On some cases it can even hang.
It's a small patch to the gpm maintainer to improve its checking.
Seems there is a need also to a small change on mc.
Now everything is working perfectly.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
Revert "(size_trunc_len): support automatic maximum unit for specified size."
This reverts commit ef94b84eaf.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
* 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>