Commit Graph

15563 Commits

Author SHA1 Message Date
Andrew Borodin a15b91b030 src/vfs/tar/tar.c: clean up.
Sync with GNU tar 33b63ebe94b8a2dc2cb8fb907d8b7c16591b05bc.

(struct extra_header): Removed unused structure.
(union block.extra_header): Removed unused member.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:23 +03:00
Andrew Borodin 8fdcbeed74 Move definition of file_entry_t to separate file.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:23 +03:00
Andrew Borodin cf223bec27 Use g_ptr_array_new_with_free_func() where reasonably.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:23 +03:00
Andrew Borodin 273fbd2afe mceditor: editbuffer: use g_ptr_array_new_full() to create text buffers.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:23 +03:00
Andrew Borodin 381dc8732b lib/filehighlight/ini-file-read.c: fix coding style.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:23 +03:00
Andrew Borodin fe89441f3d gl_POSIX_FALLOCATE: rename to POSIX_FALLOCATE.
Remove the gl_ prefix because this macro isn't from Gnulib.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:23 +03:00
Florian Weimer b7e4fb9ef6 Ticket #4438: autoconf: fix C99 compatibility issue in mc_GET_FS_INFO check.
Include <fcntl.h> for the declaration of posix_fallocate.  This
avoids an implicit function declaration and build issues with future
compilers.

Signed-off-by: Florian Weimer <fweimer@redhat.com>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:23 +03:00
Andrew Borodin 29f513cf58 File operations: get file operation from the file operation context descriptor.
* (file_mask_dialog): get file operation from the file operation context
descriptor.
  * (do_confirm_copy_move): likewise.
  * (operate_single_file): likewise.
  * (operate_one_file): likewise.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:23 +03:00
Andrew Borodin f25895280b (panel_operate): change type of save_cwd and save_dest to vfs_path_t
...to get rid of extra type conversions and memory allocations.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:23 +03:00
Andrew Borodin 3364b5772c Ticket #4426: code clean up before 4.8.30 release.
(panel_do_set_filter): fix indentation.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:23 +03:00
Andrew Borodin 1d845d0dc5 Merge branch '3121_empty_subshell_prompt'
* 3121_empty_subshell_prompt:
  Ticket #3121: don't clear subshell prompt during its reading.
2023-03-19 20:30:46 +03:00
Michal Sojka d71a9cd43a Ticket #3121: don't clear subshell prompt during its reading.
When using zsh with starship.rs prompt generator, MC sometimes fails
to show the subshell prompt. This is not deterministic. Sometimes the
prompt is shown and sometimes it isn't.

The reason is that the shell prints the prompt in multiple chunks. The
first chunk contains the "real" prompt and the second is an escape
sequence for enabling bracketed paste mode. If both chunks are read by
MC in a single invocation of read_subshell_prompt(), the prompt is
shown correctly. If, however, read_subshell_prompt() reads each chunk
in separate invocations (because the second chunk is not ready during
the first invocation), the prompt is not shown. More precisely, only
the bracketed paste mode escape sequence is shown as a prompt in MC.

This can be demonstrated with the following commands:

    export SHELL=$(which zsh)
    export ZDOTDIR=/tmp/zshdotdir
    export STARSHIP_CONFIG=/tmp/starship-test.toml
    mkdir -p "$ZDOTDIR"
    echo 'eval "$(starship init zsh)"' > "$ZDOTDIR/.zshrc"
    echo 'format = "XXXX: $directory$character"' > "$STARSHIP_CONFIG"
    mc

In my case, the prompt is usualy shown after mc start and it
disappears after changing a directory in mc. In that case, the prompt
is read() in the following two chunks:

- 63 bytes: \xd\x1b[0m\x1b[27m\x1b[24m\x1b[J\xd\xaXXXX: \x1b[1;36mmc/.git\x1b[0m \x1b[1;32m\xe2\x9d\xaf\x1b[0m \x1b[K
- 8 bytes: \x1b[?2004h

To fix the problem, we remove clearing of the prompt string in
read_subshell_prompt(). It is sufficient that the prompt is cleared
when receiving '\n' and in feed_subshell().

Signed-off-by: Michal Sojka <michal.sojka@cvut.cz>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:27:25 +03:00
Andrew Borodin ee76cb0ced Merge branch '4408_panels_redraw'
* 4408_panels_redraw:
  Ticket #4408: incorrect redraw of overlapped file panels.
2023-03-19 20:10:30 +03:00
Andrew Borodin 7e04a57b87 Ticket #4408: incorrect redraw of overlapped file panels.
Revert "(panel_operate): update panel content before screen refresh."

This reverts commit 6623a9014f.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-12 10:14:13 +03:00
Andrew Borodin 37ae744a50 Merge branch '4235_find_relative_ignore_dir'
* 4235_find_relative_ignore_dir:
  Ticket #4235: fix find file with relative ignore directory.
2023-03-05 19:53:30 +03:00
Andrew Borodin b4bb352bfa Ticket #4235: fix find file with relative ignore directory.
If start directory of find files matches to the relative ignore
directory, nothing is found.

(do_search): the start directory is the first one in the directory
stack. Do not apply ignore_dir to it.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-05 19:51:50 +03:00
Andrew Borodin b1f061e490 Merge branch '4446_paragraph_format'
* 4446_paragraph_format:
  Ticket #4446: mcedit: fix off-by-one error in paragraph formatting code.
2023-02-25 19:36:50 +03:00
Pavel Roskin 44c299c784 Ticket #4446: mcedit: fix off-by-one error in paragraph formatting code.
The default margin is 72 characters, but the editor would keep 73 character
long lines without breaking them.

The visual length of strings was calculated incorrectly. The way "for" loop
was implemented, the byte length would be incremented before exiting the
loop. That would correspond to a character that doesn't fit the line.

Increment the byte length in a separate statement.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-02-20 21:36:37 +03:00
Andrew Borodin 830ecf9780 Merge branch '4370_panelizations'
* 4370_panelizations:
  Ticket #4370: file panelization improvement.
2023-02-19 19:01:25 +03:00
Andrew Borodin e14ebea59f Ticket #4370: file panelization improvement.
Previously, both file panels share panelization results.
Now each file panel has own panelization buffer.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-02-19 19:00:59 +03:00
Pavel Roskin 1ad30a6474 Ticket #4445: skin julia256.ini: minor improvements.
Set "errdhotfocus" to a higher contrast color combination. Yellow is barely
visible on lightgray. The cursor stands on the the focused hotkey. If the
cursor is an underscore, the high contrast is obviously needed. If the focus
is a full box, it normally inverts both the background and the foreground, so
poor contrast remains poor. Red on lightgray is consistent with other colors
of the skin.

Set "menutitle" to yellow on blue. Otherwise, the title is not
distinguishable from the menu entries. Both "parent" skins, default and
xoria256, use distinctive color for the popup menu title.

Set "editrightmargin" to the same color as the panels. White on blue is
extremely distracting in contrast to black background to the left of the
margin.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-02-19 19:00:31 +03:00
Andrew Borodin be16d3a747 Ticket #4444: mc.ext.ini: .md files are not recognized as Markdown ones by extension.
Change ShellIgnoreCase key to RegexIgnoreCase one since the Regex key
is used.
Simplify Regex value.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-02-17 21:36:28 +03:00
Pavel Roskin a6fc94f294 Ticket #4441: skin julia256.ini: Fix visual inconsistencies.
Set "disabled" background to "lightgray" for consistency with the dialog
background. The inconsistent background can be seen in the file search dialog
with an empty search string.

The hotkeys in dialogs were impossible to distinguish from other text. Make
them red for consistency with the buttonbar.

Show changed lines in diffs in black on cyan. Blue on cyan is hard to see,
such color combination is not used elsewhere in the skin, which promises
"good contrast".

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-02-12 13:37:22 +03:00
Andrew Borodin cce50e5bff Ticket #4432: wrong sort order after swapping panels.
Revert "(swap_panels): swap panel sort modes too."

This reverts commit d07abec4c3.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-02-01 20:55:28 +03:00
Andrew Borodin 8a91de70c4 Merge branch '4426_cleanup'
* 4426_cleanup: (49 commits)
  ru/mc.1: fix typo.
  doc/NEWS: indentation.
  Update po/*.po files.
  Ticket #4437: (file_frmt_time): fix time format.
  mcedit: use diff syntax highlighting for git commit messages
  (load_extension_file): make one-line long error messages multi-line.
  mc.ext.ini.in: fix a typo (closes MidnightCommander/mc#178).
  Filehighlight: recognize vsix files as zip files (closes MidnightCommander/mc#171).
  mcedit: support modern ECMAScript syntax in TypeScript (closes MidnightCommander/mc#172).
  Aadd syntax highlighting for modern ECMAScript (closes MidnightCommander/mc#172).
  extfs helpers: replace "perl -w" with "use warnings" (closes MidnightCommander/mc#174).
  (do_find): use dir_list_append() to create file list for panelization.
  (do_find): remove unused variable.
  Fix various typos in the source code (closes MidnightCommander/mc#177).
  (panel_destroy): don't free file list.
  (search_content): use g_get_monotonic_time() instead of g_get_real_time().
  (extfs_get_plugins): minor optimization.
  (edit_read_syntax_rules): trivial refactoring.
  mcedit (syntax): minor optimization.
  src/filemanager/panelize.c: use GSList to hold panelize entries.
  ...
2023-01-29 11:25:45 +03:00
Andrew Borodin 8279b4b7e8 ru/mc.1: fix typo.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-29 11:24:50 +03:00
Andrew Borodin cefc35e924 doc/NEWS: indentation.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-29 11:21:23 +03:00
Andrew Borodin 706f7894db Update po/*.po files.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-29 11:17:20 +03:00
Andrew Borodin 3937f97d96 Ticket #4437: (file_frmt_time): fix time format.
Change minutes and seconds delimiter: h:mm.ss -> h:mm:ss.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-28 21:38:05 +03:00
JJ Andresson 9ad896f5e7 mcedit: use diff syntax highlighting for git commit messages
...when GIT_EDITOR=mcedit (closes MidnightCommander/mc#85).

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-28 21:38:05 +03:00
Andrew Borodin 08c2d4e276 (load_extension_file): make one-line long error messages multi-line.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-28 21:38:05 +03:00
Mariusz Białończyk c84f9b0536 mc.ext.ini.in: fix a typo (closes MidnightCommander/mc#178).
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-28 21:38:05 +03:00
Sorin Sbarnea 93fed656bc Filehighlight: recognize vsix files as zip files (closes MidnightCommander/mc#171).
vsix files are vscode code plugins and they just zip archives, so
it makes sense to recognize them as alternative zip file extension.

Signed-off-by: Sorin Sbarnea <ssbarnea@redhat.com>
Signed-off-by: Yury V. Zaytsev <yury.zaytsev@moneymeets.com>
2023-01-28 21:38:05 +03:00
Timur Shemsedinov 4c287bb73e mcedit: support modern ECMAScript syntax in TypeScript (closes MidnightCommander/mc#172).
Signed-off-by: Timur Shemsedinov <timur.shemsedinov@gmail.com>
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2023-01-28 21:38:05 +03:00
Timur Shemsedinov 1d1c37834a Aadd syntax highlighting for modern ECMAScript (closes MidnightCommander/mc#172).
Signed-off-by: Timur Shemsedinov <timur.shemsedinov@gmail.com>
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2023-01-28 21:38:05 +03:00
Robert Yang 6123946251 extfs helpers: replace "perl -w" with "use warnings" (closes MidnightCommander/mc#174).
The shebang's max length is usually 128 as defined in
/usr/include/linux/binfmts.h:
  #define BINPRM_BUF_SIZE 128

To get around this, '/usr/bin/env perl' in place of @PERL@ can be used, but
'/usr/bin/env perl -w' doesn't work:

/usr/bin/env: perl -w: No such file or directory

So replace "perl -w" with "use warnings" to make it work.

The man2hlp.in already has "use warnings;", so just removing '-w' is OK.

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2023-01-28 21:38:05 +03:00
Andrew Borodin 70599156db (do_find): use dir_list_append() to create file list for panelization.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-28 21:38:05 +03:00
Andreas Mohr 606bd02945 (do_find): remove unused variable.
Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-28 21:38:05 +03:00
Kian-Meng Ang 5001232704 Fix various typos in the source code (closes MidnightCommander/mc#177).
Found via `codespell -S
po,doc,./misc/syntax,./src/vfs/extfs/helpers/README.it -L
parm,rouge,sav,ect,vie,te,dum,clen,wee,dynamc,childs,ths,fo,nin,unx,nd,iif,iterm,ser,makrs,wil`

Co-authored-by: Yury V. Zaytsev <yury@shurup.com>
Signed-off-by: Kian-Meng Ang <kianmeng@cpan.org>
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2023-01-28 21:38:05 +03:00
Andrew Borodin 990200f6d3 (panel_destroy): don't free file list.
That is already done in panel_clean_dir().

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-28 21:38:05 +03:00
Andrew Borodin 0b19bda4a1 (search_content): use g_get_monotonic_time() instead of g_get_real_time().
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-28 21:38:05 +03:00
Andrew Borodin 58afbbe1ce (extfs_get_plugins): minor optimization.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-28 21:38:05 +03:00
Andrew Borodin 7cd8e513dd (edit_read_syntax_rules): trivial refactoring.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-28 21:38:05 +03:00
Andrew Borodin dc7dd7ae03 mcedit (syntax): minor optimization.
Use GString for syntax keywords to calculate keyword length at once
when syntax file is being parsed.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-28 21:38:05 +03:00
Andrew Borodin a01b391029 src/filemanager/panelize.c: use GSList to hold panelize entries.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-28 21:38:05 +03:00
Andrew Borodin da4212c150 External panelize: rename functions:
external_panelize -> external_panelize_cmd
load_panelize -> external_panelize_load
save_panelize -> external_panelize_save
done_panelize -> external_panelize_free
init_panelize -> external_panelize_init
panelize_done -> external_panelize_done

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-28 21:38:05 +03:00
Andrew Borodin 177d1a780c External panelize: refactoring:
*  src/filemanager/panelize.[ch]: keep function related to the external
  panelize command only. Functions related to the panelized mode of file
  panel move to panel.[ch]. Clean up includes.

  * rename functions:
  cd_panelize_cmd -> panel_panelize_cd
  panelize_change_root -> panel_panelize_change_root
  panelize_absolutize_if_needed -> panel_panelize_absolutize_if_needed
  panelize_save_panel -> panel_panelize_save

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-28 21:38:05 +03:00
Andrew Borodin 57c61b7681 Update copyright years.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-28 21:38:05 +03:00
Andrew Borodin 6e8e55ed05 (vfs_s_open): reuse variable for directory name and file name.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-28 21:38:04 +03:00
Andrew Borodin c62d651ee3 Replace variable: global_profile_name -> mc_global_t::profile_name.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-28 21:38:04 +03:00