In the command line, the subdirectory completion in current directory
isn't performed if stub isn't starting with './'.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
If checkbox is the first focusable widget in a dialog, it taken the MSG_DRAW
message after MSG_FOCUS one and therefore wasn't highlighted.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
How to reproduce:
1. Set num_history_items_recorded=0 in my $HOME/.config/mc/ini
2. Run mc.
3. Press F5 to copy and then enter.
Result: nothing happens.
Solution: refactoring of initial text usage in input line.
Use def_text to fill WInput:buffer when WInput is created.
Then overwrite WInput::buffer content from history if history usage
is enabled.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
...for case where there is no MC_SEARCH_CB_INVALID or MC_SEARCH_CB_SKIP
return codes (for search from file manager), so we can copy line
at regex buffer all at once.
Thanks Sergey Naumov <sknaumov@gmail.com> for the original patch.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
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>
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>
(mc_search): immediately return FALSE if str is NULL.
(mc_search_run): immediately return FALSE if user_data is NULL.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Added feature for the mcdiff for the bidirectional merge.
With F15 mcdiffviewer merge left panel to right panel direction.
original patch by Gergely Szasz <szaszg@hu.inter.net>
Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
added bind "MergeOther" into mc.keymap.default, mc.keymap.emacs.
Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
Steps to reproduce:
* run mc
* change encoding one of panels to any different from system encoding
* try to copy any file to panel with changed encoding
Expected result: files should be copied.
Actual result: error box here.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
Some ini files (keymaps, skins) are loaded in read-only mode. For those
files, we don't need load and keep comments.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Set defines via CPPFLAGS variable not via CFLAGS one.
Use AM_CPPFLAGS and AM_CFLAGS variables instead of per-target ones.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
In Search dialog in mcedit M-n hotkey was used for normal search mode.
Therefore, M-n as HistoryPrev in the input line was in accessible.
Change hotkey for normal seach mode to M-r. Use this hotkey for normal diff
mode in mcdiffviewer to unify i18n resources.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Steps to reproduce:
* ./configure --disable-vfs
* make
Expected result: project should be builded successfully.
Actual result:
build stopped with errors:
lib/vfs/interface.c: In function 'mc_chdir':
lib/vfs/interface.c:714: error: 'struct vfs_s_super' has no member named 'path_element'
lib/vfs/interface.c:716: error: 'struct vfs_s_super' has no member named 'path_element'
lib/vfs/interface.c:717: error: 'struct vfs_s_super' has no member named 'path_element'
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
Steps to reproduce:
* cd ftp://ftp.gnome.org/
* Run "cd" in the panel where the remote site is open
* cd ftp://ftp.kernel.org/
Actual result: The directory content from ftp.gnome.org FTP-server.
Expected results: The directory content from kernel.org FTP-server.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>