Commit Graph

1060 Commits

Author SHA1 Message Date
Andrew Borodin
bb2f5d35f3 (mc_search__run_regex): optimization
...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>
2013-10-04 09:11:05 +04:00
Andrew Borodin
bb142bf47f (lookup_key): minor refactoring: replace while() by for().
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-10-04 09:11:04 +04:00
Andrew Borodin
546e89f611 (vfs_path_tokens_get): minor refactoring: replace while() by for().
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-10-04 09:11:04 +04:00
Andrew Borodin
f3bdcb186b (mc_skin_colors_old_configure_one): cosmetics.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-10-04 09:11:04 +04:00
Andrew Borodin
26fbddf6f4 (vfs_path_tokens_count): refactoring: get rid of extra memory allocation.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-10-04 09:11:04 +04:00
Egmont Koblinger
930f683019 Handle newline and tab with shift/ctrl modifiers correctly.
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>
2013-10-03 11:41:58 +04:00
Egmont Koblinger
8f35c90b94 Ticket #2661: support enable bracketed paste of xterm.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-10-03 11:41:58 +04:00
Slava Zanko
0b0f7e3975 Refactoring: use define DEFAULT_CHARSET for "ASCII" charset.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2013-09-21 13:35:59 +04:00
Andrew Borodin
941a1eac1d Search: better support of --disable-charset
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-09-21 13:35:56 +04:00
Andrew Borodin
66da276200 Ticket 3069: fix of case-sensitive search
...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>
2013-09-21 13:35:31 +04:00
Slava Zanko
8a28d3bac4 Rename type file_entry to the file_entry_t.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2013-09-19 16:22:30 +04:00
Andrew Borodin
511850e52b (hline_callback): fix of MSG_INIT and MSG_RESIZE messages handling.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-08-02 21:58:45 +04:00
Andrew Borodin
b451e8d13d (menubar_new): add 3rd 'visible' argument.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-08-02 21:58:45 +04:00
Andrew Borodin
f9eed1fcef Indentation.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-07-23 14:15:29 +04:00
Veres Lajos
dfbb2c9430 Typo fixes.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-07-23 14:15:24 +04:00
Slava Zanko
857fe38e87 Fix panel recoding
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2013-07-23 14:15:24 +04:00
Andrew Borodin
9e5d51df95 Ticket #3043: broken NCurses detection.
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>
2013-07-23 14:15:24 +04:00
Andrew Borodin
ab3f53fbbe Add DIR_IS_DOT and DIR_IS_DOTDOT macros
...to detect "." and ".." directories, respectively.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-07-23 14:15:24 +04:00
Andrew Borodin
17aef88637 lib/strutil/strutilutf8.c: cosmetics and minor refactoring.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-07-23 14:01:05 +04:00
Andrew Borodin
7ee58f73ff lib/strutil/strutil8bit.c: cosmetics and minor refactoring.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-07-23 14:01:05 +04:00
Andrew Borodin
9e4d279885 lib/strutil/strutilascii.c: cosmetics and minor refactoring.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-07-23 14:01:05 +04:00
Andrew Borodin
5b91108b3c lib/strutil/strutil.c: cosmetics and minor refactoring.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-07-23 14:01:05 +04:00
Slava Zanko
0013adeeba Ticket #2992: mc fails to link when system lib does not contain strverscmp
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2013-07-09 13:44:51 +03:00
Amadeusz Sławiński
33c47b5734 Ticket #3025: race condition when creating temporary directory.
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>
2013-07-05 20:58:41 +04:00
Andrew Borodin
ccf82ada12 Add functions to transform string to unsigned integer:
* (xstrtoumax): from gnulib.
 * (parse_integer): from coreutils (dd.c).

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-07-05 09:09:03 +04:00
Andrew Borodin
de2a934b37 lib/search/search.c: cosmetics.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-06-28 13:20:08 +04:00
Andrew Borodin
4f16d7e8f0 Ticket #3026: Find File: "All charsets" options don't work.
(mc_search_prepare): use cp_display not cp_source to convert text to all
available charsets.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-06-28 13:20:08 +04:00
Andrew Borodin
48abe8735f Rename functions:
init_widget -> widget_init
create_dlg -> dlg_create
init_dlg -> dlg_init
run_dlg -> dlg_run
destroy_dlg -> dlg_destroy

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-06-28 09:21:17 +04:00
Andrew Borodin
0adf569b54 (dlg_overlap): rename to widget_overlapped()
...and move to lib/widget/widget-common.c.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-06-28 09:21:17 +04:00
Andrew Borodin
c7da120588 (dlg_replace_widget): rename to widget_replace()
...and move to lib/widget/widget-common.c.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-06-28 09:21:17 +04:00
Andrew Borodin
1672fa44dd (dlg_widget_active): rename to widget_is_active()
...and move to lib/widget/widget-common.c.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-06-28 09:21:17 +04:00
Andrew Borodin
970cfd881a (dlg_mouse_event): minor refactoring.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-06-28 09:21:17 +04:00
Andrew Borodin
01c5cf66a5 (dlg_default_callback): get rid of extra type cast.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-06-28 09:21:17 +04:00
Slava Zanko
d2eac2f5af Code reorganization and fixes around the vfs_path_as_str() function
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2013-06-28 09:21:16 +04:00
Andrew Borodin
32bc72a1d7 (vfs_path_as_string): clarify return value.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-06-28 09:21:16 +04:00
Slava Zanko
cb08c1d0bf Fix: sftp: password ask too often if hostname was bring from ~/.ssh/config file
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2013-06-18 12:52:18 +03:00
Veres Lajos
805703523d Misspellings fixes by https://github.com/vlajos/misspell_fixer
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-06-15 11:10:41 +04:00
André Barros
9699d5dd69 Ticket #3011: mc under x11 problems with mouse or hang due gpm
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>
2013-06-10 20:08:56 +03:00
Andrew Borodin
5b1982a6bb (strip_ctrl_codes): type accuracy.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-06-08 18:06:55 +04:00
Andrew Borodin
d83902e7fc (size_trunc_len): minor optimization.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-06-07 13:06:51 +04:00
Andrew Borodin
ceff7c5922 size_trunc_len() generates incorrect result in some cases.
Revert "(size_trunc_len): support automatic maximum unit for specified size."
This reverts commit ef94b84eaf.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-06-07 12:12:34 +04:00
Andrew Borodin
e7dc599e42 Use "'" instead of "`" for messages and comments quoting.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-06-03 14:21:03 +03:00
Andrew Borodin
d0955f3793 Search callbacks should return mc_search_cbret_t not int.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-06-03 14:21:03 +03:00
Andrew Borodin
3662b84ba1 (vfs_get_encoding): optimization and enhancement:
* get rid of extra memory duplication;
  * support of recursive search of correct encoding;
  * add tests.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-06-03 14:21:02 +03:00
Andrew Borodin
6b90a1468a (button_set_text): update value of WButton::hotpos.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-06-03 14:21:02 +03:00
Andrew Borodin
6d31d85f0d Use tty_draw_box instead of draw_box() to draw frames.
* (draw_box): remove.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-06-03 14:21:02 +03:00
Slava Zanko
2640b21bb9 Remove vfs_path_to_str() function for avoid often memory allocations.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2013-06-03 14:21:01 +03:00
Andrew Borodin
31bacf56c9 Use G_N_ELEMENTS macro to calculate of array size.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-06-03 10:58:14 +03:00
Slava Zanko
80c8d58003 remove the include duplicates from source files
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2013-06-03 10:58:14 +03:00
Denys Vlasenko
664e7d31b6 When we see an unknown sequence, it is not enough
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>
2013-05-23 11:42:02 +03:00