In UTF-8 locales, with case sensitive sort files are sorted properly:
00050.jpg
001-gepard.jpg
0175ep.jpg
027.jpg
060912.jpg
win.jpg
z1.jpg
but if in case insensitive sort, they get mixed up
and files with number in their name are sorted badly:
001-gepard.jpg
027.jpg
00050.jpg
0175ep.jpg
060912.jpg
win.jpg
z1.jpg
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Test case:
1. Make two files with same content but with different encodings (for example, in UTF-8 and KOI8-R);
2. Open UTF-8 file for editing. Press Alt+e and set 'UTF-8' encoding;
3. Search someting
4. exit from editor and open file with 'KOI8-R' encoding;
5. You must see a dots. Now press shift+F7 (continue search);
6. Segfault here
Fix issue:
Now function mc_search__recode_str() returns newly allocated string in any case
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
In the function get_compression_type() in src/util.c, only 5 bytes of the
file are read into the magic array, but the test for lzma files checks the
first 6 bytes in the magic array.
Fix issue:
now reads 6 bytes for correct recognize LZMA-files.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
Keys sort functions have been maken inline.
Decrease of memory usage: reimplemented
key_name_conv_tab_sorted array as array of pointers
instead of entire copy of key_name_conv_tab array.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Problem: 'Find File' dialog doesn't save an empty "content" filed on exit.
Proposed solution: allow each history (not in content in 'Find File' dialog
only) save an empty value.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Since mc-4.7.0-pre1 was added charset confirmation if charset was changed.
This commit was adds automatic recognize of system charset and fix in current
config. Also, now contig file will untouched if 'Auto save setup' option is switched off.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
Ticket #1764:
* fxed shortcuts for select/unselect/reverse selection
of file group;
* removed 'C-x C-c' default shortcut for Quit command.
Also fixed some emacs-like keybindings for editor and viewer.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Added two parameters:
* Widget *sender -- to recognize the wiget that have sent message;
* void *data -- to pass any user-defined data to the dialog.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
First step: renamed type of dialog command execution function.
Made execution function more flexible: added parameters for
sender and receiver widgets and user data.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Testase:
* rm -f ~/.mc/Tree
* run mc
* F9 -> Command -> Directory tree
* Press F2
* Go to '/lib' item
* Press F2
* exit from mc
* run mc again
* F9 -> Command -> Directory tree
* press HOME key
Fix issue:
changed forgotten variable name.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
After implementation of keybinding engine and reimplenetation
of menu engine, MC starts very slow due to multiple trivial
(totally non optimized) search of many values in many arrays.
This patch performes the some speedup of MC startup process.
Statistics:
- startup time without the patch: 0m0.413s
- startup time with the patch: 0m0.073s
Great thanks to 0xe2.0x9a.0x9b for the original patch.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
fixed segfault in backward_word (widget.c)
...
The for loop, whose purpose is to remove exactly 1 character
(hence I don't get why it's a loop, but nevermind) was not UTF8-ready.
So if the character preceding the cursor was an accented one,
it jumped to the middle of the UTF-8 sequence, causing the rest of
the stuff go unpredictable.
Although it *should* never happen (which, as we all know,
does not equal to "never happens"), in this case "p" simply jumped
over "in->buffer". The function has a "p != in->buffer" check three times,
it might it more robust if you replaced that with "p >= in->buffer".
This should prevent the segfault, and just stay with a slightly buggy but
otherwise harmless alt-backspace behavior, should there be any UTF-8 or
similar bugs left. This change is not included in my patch.
Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
If ~/.mc/panels.ini have incorrect value of 'sort_order' key, then mc will crashed.
Fix issue: Now default sort_order for incorrect value is 'name' (sort by name)
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
Problem:
a) when running ./configure, strftime() and other functions cannot be
properly detected, since autoconf generates crappy test code, which
at least fails when warnings are treated as errors (gcc: -Werror).
b) strtime() is standard since C89, so we can simply expect it to exists
(if there's *really* some acient box out there breaking mc build,
it's libc/toolchain should be fixed ;-p)
Solution:
Remove the checks for strftime() and all workarounds
1st step: minor refacoring.
Removed call of intermediate function and changed the retun value type.
Type accuracy.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Some debug-related code will compile just in mainteiner mode.
Also, added new parameter for configure script: --enable-werror
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
Restored behavior with stale mountpoint (now handled as stale link).
Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
add shared clipboard support
Signed-off-by: Ilia Maslakov <il.smind@google.com>
Fixed memory leaks. Type accuracy. Optimization.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
* fixed ctrl-g handler
* change action names from InputKillSave to InputXStore and InputPaste to InputXPaste
* update mc.keymap.default mc.keymap.emacs
Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
added bindings for shift block 'EditShiftBlockLeft', 'EditShiftBlockRight'
EditShiftBlockLeft, EditShiftBlockRight - force move block without option_persistent_selections checking
Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
1. Open empty file (<Shift-F4>)
2. Fill with data:
1234
5678
9abc
3. Mark contents (or any multiline text in, for example, firefox) with mouse (<Shift+MouseDown???>)
4. Insert somewhere below third line (<Shift+Insert>)
5. Newlines are eaten (xterm)
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
* fixed binding in mc.keymap.default and mc.keymap.emacs
for CmdCopyCurrentTagged, CmdCopyOtherTagged,
CmdCopyCurrentPathname, CmdCopyOtherPathname
* fixed typo
Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
Now buttonbar have own colorpairs:
[buttonbar]
hotkey=red;black
button=yellow;cyan
Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
In the case where insufficient rights to the contents of the directory ~/.mc/* to
save preferences I get "settings saved in ~ /.mc/ini", but really nothing is saved.
It would be correct to issue a message like "Not enough permissions to save the ~/.mc/ini"
Also, when autosave should be issued a message about the lack of rights.
This branch will check rights of config-files.
testCase:
*) chmod 0400 ~/.mc
*) run mc
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
To view the next (C-f) of previous (C-f) file in viewer,
the quit from viewer is required now.
This commit restores the previous behavior.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Attempting to open a .tlz lzma archive fails - error 'xxx.tlz doesn't look like a tar archive'.
If the file is renamed to .tar.lzma, it is opened without problems.
Fix issue: add recognize of '.tlz' extention.
Refactoring: avoid calls of strlen() function
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
* When try to replace existing file in background operation
assertion raised (created operations for initialization ctx->ui for background):
** (mc:25716): CRITICAL **: file_progress_real_query_replace: assertion `ctx->ui != NULL' failed
* Process has been already done, but still draw in list (C-x j)
* Process is stopped or worked, remove operation don't hide process from list, but kill it
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
Test case:
* create file with name "test" in "tmp" directory (for example)
* create directory with same name ("test") in other "tmp2" directory (for example)
* try to copy or move file "test" into "tmp2" in background mode
* wait for some time
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
mc 4.7.0-pre1 introduced dynamic "Save attributes" checkbox value in Copy/Move dialog.
But code is Linux-specific, and not even isolated by macros.
I suggest to add code specific for BSD and SVR4 systems.
In BSD systems (MacOS X, NetBSD, FreeBSD) there is statfs.f_fstypename which contains name of filesystem.
Valid FS names are: msdos, msdosfs (FreeBSD), ntfs, smbfs, procfs, fusefs (BSD), fusefs_subfstype (Mac)
In SVR4 systems (Solaris and other SVR4 Unixes) there are statvfs.f_basetype and statvfs
syscall instead of statfs and also autotools define STAT_STATVFS.
Valid FS names are: pcfs, proc, ntfs, fuse, smbfs
(Note that NetBSD 3.0+ also use statvfs but with BSD syntax.)
For all other OSes we simply return 1.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
Currently, there is no way to change the defaults. The file mask
dialog options are not persistent.
Added new config option 'copymove_persistent_attr'. If this option is equal to '0'
then 'Preserve attributes' in copy/move dialog will always switched off.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This patch was grabbed from Russian fork (ru-fork). Original commit message:
[COMMAND LINE]: Fix SUSE gabage, letter B in command prompt under root! Yessssssss! :)
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This is incomplete copy of same glib-function.
For older glib (less than 2.13) functional is enought.
For full version of glib welcome to glib update.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
Key emulation in editor was removed. Default key emulation
is stored in misc/mc.keymap.default file. Emacs key emulation
is stored in misc/mc.keymap.emacs.
Editor options dialog was redesigned.
Shortcut parser was fixed.
Fixes after rebase to recent master.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Many shortcuts are not defined in keymap file and therefore
not displayed in menu.
Editor menu is not reimplemented yet.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Renamed name_key_map_t to name_keymap_t.
Renamed global_key_map_t to global_keymap_t.
Use more '#ifdef USE_INTERNAL_EDIT' preprocessor directives
Removed unused variables and structure members.
Aplly const modificator to keybind argument of keybind_cmd_bind().
Aplly const modificator to keyname argument of lookup_action().
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
New parser allows get the string representation of menu shortcuts.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
Problem:
BOOK_MARK_COLOR and BOOK_MARK_FOUND_COLOR are hardcoded
in edit/edit-widget.h and so cannot be changed via skin.
Solution:
Now these colors will configure via skin-file. Like:
Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
The problem: if I copy or move file with invalid UTF-8 symbols
in name to another directory (e.g. simply F5 Enter F6 Enter
to copy/move to the other panel), the filename gets mangled,
invalid UTF-8 characters are replaced by literal question marks.
Now the copy/move operation leaves the filename unchanged,
even if it is invalid in the locale mc's using for display.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Create temporary buffer in stack instead of heap.
Fixed pointer type mismatch in conditional expression
in panel_operate().
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Use gettext context to handle file operation names in
Copy/Move/Delete dialogs.
Thanks to David Martin for the original patch.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Test case:
- run mc
- press CTRL+o (hide panels)
- press 'space' key
- press 'backspace' key
- press CTRL+o (show panels)
- type 'ls' and press 'enter' key
Fix issue: Now 'busy shell' status toggle on if user will press 'Enter' key.
Old behavior: User was press any key into subshell and 'busy shell' status toggle on.
Also, patch will enter new behavior:
* run mc
* press ctrl+o (hide panels)
* type 'cat ' and don't press 'Enter' key
* press ctrl+o (show panels)
* type 'ls' and press enter
You'll see:
cat: ls: File not found.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
If "show Mini status" option is off, the quick search box
is shown incorrect. In this case the quick seach box
must be invisible, because this is common MC behavior.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Problem: need to escape ';' char (as '\;'), but mc_config_set_string function
escape this to '\\;'
Solution: Added mc_config_direct_set_string() function. Also, into src/learn.c
characters '\' and ';' is escaped manually.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
* Panel widget: History list button changed from v to [^]
* Change drawing of history control elements for panel. Now if panel is active, show in reverse color just panel path.
* Add reaction on mouse click on [] chars at top of panel
* Added call of repaint_screen() function for correctly show panels content after click by mouse on 'hidden files' indicator.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
As David Martin proposed, this skin support all newest features
May be used as modern skin, but with some restrictions (must be UTF-8 system codepage)
Also, changed src/screen.c for demonstrate skin features :)
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
The "Choose codepage" dialog (for file panel) is centered
over the according panel.
Renamed create_listbox_window_delta() function to
create_listbox_window_centered(). Now this function takes in
coordinates of dialog center.
Changed argumets order to unified dialogs API.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Strip leading and trailing spaces in color names read from skin ini
file.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
On non-local filesystems, mc won't allow execution of commandline arguments.
This makes sense, except for the `exit' command, which might be allowed even on
non-local filesystems.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
* Added common functions for work with backups of main config files.
* Fixed permissions of ~/.mc/ini;
* Fixed permissions of ~/.mc/filepos
* Fixed permissions of ~/.mc/hotlist
* Fixed permissions of ~/.mc/Tree
* Fixed ownership for ~/.mc/hotlist file
* Changed definitions of config files. Now used constants from src/fileloc.h
Also, added ability for change mc user home dir. Just type:
{{{
make CFLAGS='-DMC_USERCONF_DIR=\".mc2\"'
}}}
And you will have different config files (very usefull for testing or development).
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
Test case:
$ sudo bash
files in the directory ~/.mc overwritten and hence change of ownership at the root.
Later, when starting from a user, MC can not save history (the file ~/.mc/history),
because this file is not overwritten.
Fix issue: Now files will overwrite if exists (rather than remove and create new file).
* Added backup of saved files. If someone wrong in 'write config' stage, backup file still present.
* Identation of code.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
Viewer: fixed command handling.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
add: binding for "esc", "escape"
Signed-off-by: Ilia Maslakov <il.smind@google.com>
Partially revert of 5fd7d65dca.
If 'Content:' field is empty, keep it and don't populate it
from history.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Signed-off-by: Slava Zanko <slavazanko@gmail.com>