replace dialog:
* removed 'replace order' field
* removed 'scanf' and 'regex' chackboxes
* added selectbox element for choise type of search
* confirm replace and 'replace all' now radiobuttons
search dialog:
* removed 'replace order' field
* removed 'scanf' and 'regex' chackboxes
* added selectbox element for choise type of search
(button_callback): use draw_hotkey function to draw button text.
(radio_callback): use draw_hotkey function to draw radiobutton text.
(check_callback): use draw_hotkey function to draw checkbutton text.
* 'm-utf-8' of ssh://www.midnight-commander.org:2222/git/mc:
Fixed coredump in editor after help call.
src/menu.c (create_menu): don't translate menu entry text if ENABLE_NLS isn't defined.
src/strutil.h: created align_crt_t type for string alignment on terminal.
fix: uninitialized variable "p" in str_8bit_fit_to_term
Changed type of related function arguments.
src/strutil.c (str_fit_to_term): changed type of 3rd argument
from int to align_crt_t.
src/strutil8bit.c (str_8bit_fit_to_term): likewise.
src/strutilascii.c (str_ascii_fit_to_term): likewise.
src/strutilutf8.c (str_utf8_fit_to_term): likewise.
src/screen.c: changed type of alignment variables and structure fields
* Fix init of global variables cp_source and cp_display
* add property (mc_search_t*) search to WEdit srtucture
* start of reorganize edit/editcmd.c for new search engine
valgrind log when run viewer
==9981== Conditional jump or move depends on uninitialised value(s)
==9981== at 0x45891B: view_map_offset_and_column (view.c:584)
==9981== by 0x458D5B: view_column_to_offset (view.c:917)
==9981== by 0x458DD8: view_set_first_showed (view.c:1443)
==9981== by 0x45B79F: view_new (view.c:4136)
==9981== by 0x45B911: mc_internal_viewer (view.c:3969)
==9981== by 0x423D85: view_file_at_line (cmd.c:132)
==9981== by 0x423E78: do_view_cmd (cmd.c:217)
==9981== by 0x45CDE7: buttonbar_call (widget.c:2425)
==9981== by 0x45D754: buttonbar_callback (widget.c:2456)
==9981== by 0x427D42: dlg_process_event (dialog.c:618)
==9981== by 0x428035: run_dlg (dialog.c:789)
==9981== by 0x43E708: main (main.c:1688)
==9981== Uninitialised value was created by a stack allocation
==9981== at 0x4586F0: view_map_offset_and_column (view.c:593)
Signed-off-by: Sergei Trofimovich <slyfox@inbox.ru>
Modified descriptions.
src/strutil.c (_str_convert): return value of estr_t type instead of int.
Check coder first. Removed redundant code.
(str_convert): simplified. Changed returned type to estr_t.
(str_nconvet): likewise.
(str_vfs_convert_to): likewise.
(str_vfs_convert_from): likewise. Used symbolic names instead of hardcoded values.
(str_translate_char): likewise.
src/strutil8bit.c (str_8bit_vfs_convert_to): likewise. Made function static.
src/strutilascii.c (str_ascii_vfs_convert_to): likewise.
src/strutilutf8.c: (str_utf8_vfs_convert_to): Used symbolic names
instead of hardcoded values.
src/charsets.c (convert_from_utf_to_current): likewise.
(convert_from_utf_to_current_c): likewise.
(convert_from_8bit_to_utf_c): likewise.
(convert_from_8bit_to_utf_c2): likewise.
src/view.c (view_get_char): likewise.
vfs/vfs.c (_vfs_translate_path): Changed returned type to estr_t.
Used symbolic names instead of hardcoded values.
(vfs_translate_path): likewise.
charset.c: cp_display and cp_source variables are made global not static and...
charset.h: ...defined here as extern.
search.h: added required #include's.
search.c: fixed cp_display and cp_source variables declaration.
* added multicharset search feature
* added template for HEX and GLOB searches (for viewer and for search files dialog)
* implemented normal search with/without characters cases
WARNING! UNSTABLE! Code not checked for work! I'm just wrote and compiled.
Removed <iconv.h> include. Add "global.h" include.
Moved str_isutf8 function declaration under header guard.
Formatting.
view.c: used symbolic constant.
Formatting.
src/charsets.c:
* fix error with recoding string for display
edit/editcmd.c:
* fix core dump if search dialog calls some multiple times
* fix memory leak
* 'm-utf-8' of ssh://www.midnight-commander.org:2222/git/mc:
fix by andrew_b uninitialised tool->compose.
fix incorrect draw utf-8 text in 8-bit locale
fix some warnings
add convert_from_utf_to_current_c, fix little warnings
add utf8_display global variable, if display bits select utf-8 utf8_display = 1
add more convertion before draw text
change charbuf to char from unsigned char
add: convert input in utf locale to needle
fix incorrect convertion from utf to display CP
fix: width utf buffer
add in core viewer codepage selection from list
fix: editor status bar
fix: edit_get_prev_utf segfault, add compare str with start of buf
Conflicts:
edit/edit.h
myslang.h: modified definition of ACS_LTEE symbol. Added definition
of ACS_RTEE symbol.
screen.c (show_dir): paint left and right symbols of mini infor separator
as for S-Lang library as for NCurses one.
These functions fully replaced with g_strconcat ()
WARNING! This just stupid replace. Some parts of code need to usage
concat_dir_and_file() function instread of g_strconcat ()
myslang.h: modified definition of ACS_LTEE symbol. Added definition
of ACS_RTEE symbol.
screen.c (show_dir): paint left and right symbols of mini infor separator
as for S-Lang library as for NCurses one.
src/smd.c (single_dirsize_cmd): create status dialog if needed not always.
file.h: fixed typo.
file.c (compute_dir_size_create_ui): changed title of dialog.
(compute_dir_size_destroy_ui): formatting.
(compute_dir_size_update_ui): simplified text of dialog.
file.h: new type and functions for status dialog
of directory computing size. Added required includes.
(compute_dir_size): changed return value. Added new parameters
to handle status dialig.
Fixed comments.
file.c: new functions for status dialog of directory
computing size.
(compute_dir_size): interruptable dir size computing.
Changed return value. Added new parameters to handle status dialig.
(panel_compute_totals): likewise.
(panel_operate): likewise.
cmd.c (single_dirsize_cmd): interruptable dir size computing.
(dirsizes_cmd): likewise.
Add option editor_persistent_block to Options/General dialog;
Make persistent/nonpersistent blocks if mcedit;
Enlarged height of Options/General dialog from 17 to 19 lines;
* mc-4.6:
src/file.c: move_dir_dir():
fileopctx.h: set definitely values for FileProgressStatus enum type.
src/file.c: modified error messages fro warn_same_file() function.
non-relevant comment removed
little fix for show message
Denis Vlasenko posted a patch which would fix issue when no dialog for break operation. Trouble: recently i accidentally entered '.' instead of '..' in the file copy dialog on a relatively big tree ... for every file in the tree i got the <foo> and <bar> are the same file message box, without any way to escape except killing mc from the outside. Rework warn_same_file for more usage glib. ... msg = g_strdup_printf() ...
po/sk.po: translation update by Ivan Masár <helix84@centrum.sk>
mountlist: use fsblkcnt_t when available (fixes#179)
Fixed menu painting for NCurses screen library.
Backport: syntax/spec.syntax: .spec syntax update by adamw (#189)
lib/mc.ext.in: command line options fix by adamw (#183)
Conflicts:
ChangeLog
po/az.po
po/be.po
po/bg.po
po/ca.po
po/cs.po
po/da.po
po/de.po
po/el.po
po/es.po
po/eu.po
po/fi.po
po/fr.po
po/hu.po
po/it.po
po/ja.po
po/ko.po
po/lt.po
po/lv.po
po/mn.po
po/nl.po
po/no.po
po/pl.po
po/pt.po
po/pt_BR.po
po/ro.po
po/ru.po
po/sk.po
po/sl.po
po/sr.po
po/sv.po
po/ta.po
po/tr.po
po/uk.po
po/vi.po
po/wa.po
po/zh_CN.po
po/zh_TW.po
src/file.c
* changed type of move_over variable from int to gboolean;
* fixed memory leak: destdir is not free'd when the same directory is copied;
* don't use the non-valid dbuf variable if mc_stat(d, &dbuf) returns non-zero.
* changed type of move_over variable from int to gboolean;
* fixed memory leak: destdir is not free'd when the same directory is copied;
* don't use the non-valid dbuf variable if mc_stat(d, &dbuf) returns non-zero.
screen.o: In function `show_free_space':
/home/dsterba/_dev/mc-build/src/screen.c:783: undefined reference to
`mhl_mem_free'
/home/dsterba/_dev/mc-build/src/screen.c:784: undefined reference to
`mhl_str_dup'
Signed-off-by: David Sterba <dave@jikos.cz>
and add shell_(un)escape again
This patch reintroduces fix firstly appeared in (and recently broken by mhl revert)
> commit e48cb7c89f
> Author: Sergei Trofimovich <st@anti-virus.by>
> Date: Fri Jan 30 09:31:28 2009 +0200
>
> mhl: added mhl_strmove() function (memmove semantics)
...
> Snippet of man strcpy:
> DESCRIPTION
> The strcpy() function copies the string pointed to by src, including the terminating
> null byte ('\0'), to the buffer pointed to by dest. ___The strings may not overlap___,
> and the destination string dest must be large enough to receive the copy.
> We used strcpy to move data chunk in memory: "./foo" -> "foo", etc.
>
> This patch introduces mhl_strmove and fixed canonicalize_pathname.
Conflicts:
src/util.h
Signed-off-by: Patrick Winnertz <winnie@debian.org>
g_strconcat expects 0 as last argument, but mhl_strmove is not.
When reverting this detail was overlooked. Returning 0 as last argument.
Signed-off-by: Sergei Trofimovich <slyfox@inbox.ru>
This pach fixes two issues (both appear only in escapy strings):
* tail cut of escapy string when '\\' is met
* head cut of escapy string when '\\' is met :]
Signed-off-by: Sergei Trofimovich <slyfox@inbox.ru>
This patch reintroduces fix firstly appeared in (and recently broken by mhl revert)
> commit e48cb7c89f
> Author: Sergei Trofimovich <st@anti-virus.by>
> Date: Fri Jan 30 09:31:28 2009 +0200
>
> mhl: added mhl_strmove() function (memmove semantics)
...
> Snippet of man strcpy:
> DESCRIPTION
> The strcpy() function copies the string pointed to by src, including the terminating
> null byte ('\0'), to the buffer pointed to by dest. ___The strings may not overlap___,
> and the destination string dest must be large enough to receive the copy.
> We used strcpy to move data chunk in memory: "./foo" -> "foo", etc.
>
> This patch introduces mhl_strmove and fixed canonicalize_pathname.
Signed-off-by: Sergei Trofimovich <slyfox@inbox.ru>
When we try to complete something what can't be stat()'ed,
we treated it like dir. Now we do not consider such candidates
for completion.
Signed-off-by: Sergei Trofimovich <slyfox@inbox.ru>
This commit will replace some *ptr = c; stuff with g_string_append_c(str,c);
in order to use glib here.
Signed-off-by: Patrick Winnertz <winnie@debian.org>
As we decided to fully switch back to glb we needed to rewrite this function in order to use
glib functions. This means in this case mostly that *ptr = c; ptr++; is replaced by something
like this: g_string_append(str,c); with str a GString*.
Signed-off-by: Patrick Winnertz <winnie@debian.org>
This commit moves the mhl_str_concat_dir_and_file back into src/util.c whitout changing atm the functionality.
Please note that this is an incomplete fix and needs to be partially enhanced in order to keep the full functionality with glib.
Signed-off-by: Patrick Winnertz <winnie@debian.org>
This removes the usage of stdbool.h in favour of mhl/tyes.h as we have to revert everything one by one
Signed-off-by: Patrick Winnertz <winnie@debian.org>
Enrico has accidentially removed the slang1.x support in mc-4.6 branch as
this is a structural change which clearly doesn't belong into mc-4.6.
Signed-off-by: Patrick Winnertz <winnie@debian.org>
./configure --enable-charset && make
charsets.c: In function 'load_codepages_list':
charsets.c:51: warning: implicit declaration of function 'mhl_str_dir_plus_file'
charsets.c:51: warning: assignment makes pointer from integer without a cast
Signed-off-by: Sergei Trofimovich <slyfox@inbox.ru>
* mc-4.6: (38 commits)
mhl: mhl_shell_unescape_buf(): fixed memory array OOB.
completion: fixed complete already escaped secuences.
completion: added changelog entry for solved #147
completion: fixed completion of escaped commands in commandline
Removed unused char*.
mhl: added mhl_strmove() function (memmove semantics)
completion: added escapes in command line on completion
complete: cleanup: #define to enum INPUT_COMPLETION_FLAGS
added a new parameter for completion flags to input_new
fish: cleanup: unboxed quoted strings when generate shell commands
introduced new type SHELL_ESCAPED_STR for more type safety
added mhl/types.h which defines bool enum, escape.h now using this type
Removed unused variable
Changes for use MHL.
Fixed bug with renamig/copying files with backshashes in names
Remove some testing stuff
Temporarry commit. Fixed completion in browse by directoryes.
Fixed some memory leaks.
Add $ and ` for escaping and reorder it according to the ascii values
Rewrite it to use g_string_append_c instead of some homebrew stuff
...
<winnie> ls -lQ /tmp/test
-rw-r--r-- 1 winnie winnie 0 30. Jan 13:05 "a"
-rw-r--r-- 1 winnie winnie 0 30. Jan 13:04 " test\"hallo"
-rw-r--r-- 1 winnie winnie 0 30. Jan 13:04 " test$hallo"
<winnie> and then cat /tmp/test/\ and ESC-tab in subshell...
unescape/escape sequences in command completion (it also solves
completiont of weirdweird escapy commands like ./<escapy-cmd><complete>, like:
$ ls -lQ
-rwxr-xr-x 1 slyfox slyfox 2037 Jan 15 21:18 " 'asd&&\"->build-glib1.sh"
Signed-off-by: Sergei Trofimovich <slyfox@inbox.ru>
* mc-4.6:
replaced buggy concat_dir_and_file() by mhl_str_dir_plus_file()
fixed out-of-tree-builds
Updated the NEWS file for 4.6.2 and added the bugnumbers behind the items in the list.
Update for OpenOffice and StarOffice viewer.
changelog: added entry for python syntax
syntax: python: keywords update (patch by NNemec) fixes#216
AC_USE_SYSTEM_EXTENSIONS macro requires autoconf >= 2.60
po/ru.po: In russian translation, there are some hotkey conficts in menu.
ChangeLog/NEWS: added entry for #181 ticket (copy to deleted dir)
Now a trailing slash will only be added in copy & move dialogs if the path itselfs
copy/move dialog: add trailing '/' to default destination path (fix#181)
fixed comments to /* ... */
Not only comment it out but removing it
Removed unneeded var to make build process a bit cleaner
Add code snipplet by il.smind which should fix issues with putty and
Conflicts:
ChangeLog
mhl/string.h
src/command.c
src/complete.c
src/file.c
src/util.c
valgrind detected an error in completion path:
==2962== Source and destination overlap in strcpy(0x459F068, 0x459F06A)
==2962== at 0x4026056: strcpy (mc_replace_strmem.c:268)
==2962== by 0x808F70B: canonicalize_pathname (string3.h:106)
==2962== by 0x805ECBA: filename_completion_function (complete.c:125)
==2962== by 0x805FB35: command_completion_function (complete.c:448)
==2962== by 0x805EA34: completion_matches (complete.c:552)
==2962== by 0x8060454: complete (complete.c:735)
==2962== by 0x809AAC4: handle_char (widget.c:1545)
==2962== by 0x807867E: midnight_callback (dialog.h:201)
==2962== by 0x8061B27: dlg_process_event (dialog.c:664)
==2962== by 0x8061ECE: run_dlg (dialog.c:786)
==2962== by 0x807996C: main (main.c:1674)
Snippet of man strcpy:
DESCRIPTION
The strcpy() function copies the string pointed to by src, including the terminating
null byte ('\0'), to the buffer pointed to by dest. ___The strings may not overlap___,
and the destination string dest must be large enough to receive the copy.
We used strcpy to move data chunk in memory: "./foo" -> "foo", etc.
This patch introduces mhl_strmove and fixed canonicalize_pathname.
Signed-off-by: Sergei Trofimovich <st@anti-virus.by>
* mc-4.6:
Now a trailing slash will only be added in copy & move dialogs if the path itselfs
copy/move dialog: add trailing '/' to default destination path (fix#181)
Problem:
When user tried to copy/move file (F5/F6) - he could run into trouble if
destination directory is removed (it can be removed by user from another mc session).
Operation is performed and(!) file is renamed.
So when when user issues 'cp /tmp/a.file /tmp/b' - he gets not expected /tmp/b/a.file,
but /tmp.b !
Solution:
Add trailing space for destination directory for non-local copy/move(F5/F6) operations.
So operation, given above will take form: 'cp /tmp/a.file /tmp/b/' disambiguating b
meaning.
Signed-off-by: Sergei Trofimovich <slyfox@inbox.ru>
mhl/escape.h:
add new function mhl_shell_is_char_escaped()
src/command.c; src/complete.c; src/file.c; src/util.c:
Changes for use MHL-functions.
src/util.h:
remove old escape-related declarations of functions
mc (mc over ssh on a putty console)
- to reproduce try this:
1) run 'putty'; login to remote host
2) run mc
3) press key '/' on keypad. You will see menu that is called when you press the F2
4) Go to 'Learn keys' (simple call dialog)
5) just exit from 'learn keys' dialog (without any changes)
6) 3) press key '/' on keypad again. You will see '/' symbol in command line.
experimental patch, completely different reading file, new cache structure,
shall view text in every encodings (remaped ctrl + t, new dialog need
localization).
1. to avoid backward reading, viewer keeps four following characters from
file: next, actual and two previous. This is enough to handle new lines
and nroff fortmatin correctly.
2. cache_line structure, that presents one line in file. cache_line stores,
where line starts and ends in file,number of line and width of line. Width
is at most equal to screen width, so longer lines are cached in more
cache_lines. This makes wrapping text very easy. Cache_lines are stored
in a linked list. file is loaded into cache_lines sequential, not whole at once.
It only provides navigation in file.
I found two problems in this solution:
1. slow first move to end in large files, because can not read files
backward. (loading in background may help)
2. it is slow with multibyte characters. I tried to eliminate calling iconv
to two, but it did not help (iconv is called on every byte). I think
caching some parts of file will be needed.
add support for filesystem, that use others encodings than mc (vfs). Now can be
encoding set only manually, but automatic detection is possible. Filename is
converted in mc_readdir and other function translate it back by vfs_translate
added menu etries encodnig in left and rigth menu (localization will be neede)
modified subshell.c to put subshell correct working directoy,
modified ext.c and execute.c to translate filename before running command
there could be one problem, vfs_translate_path does not use something like
path_magic function
rest of fixes in files cmc.c, main.c (xterm title), panelize.c, subshell.c,
tree.c, tty.c, user.c, util.c, win.c
now, basic mc's function should work well, editor and view are still broken.
like buttons use menu entries hotkey_t. But menus are staticly defined, so this
change is much bigger. All menu declaration must be edited. follow standard
changes in drawing and handling hotkeys.
now basic mc's functions works in utf-8, remain correct calculation of controls
width in dialogs, replace functions like tolower, toupper,isspace, ... width
functions from strutil or g_ascii variant.
like in input, added multibytes characters buffer for search in panel (ctrl+s)
drawing is simplier, because alignment do directly str_fit_to_term function
from strutil, changed time functions in util to work correctly in utf-8
experimental patch, completely different reading file, new cache structure,
shall view text in every encodings (remaped ctrl + t, new dialog need
localization).
1. to avoid backward reading, viewer keeps four following characters from
file: next, actual and two previous. This is enough to handle new lines
and nroff fortmatin correctly.
2. cache_line structure, that presents one line in file. cache_line stores,
where line starts and ends in file,number of line and width of line. Width
is at most equal to screen width, so longer lines are cached in more
cache_lines. This makes wrapping text very easy. Cache_lines are stored
in a linked list. file is loaded into cache_lines sequential, not whole at once.
It only provides navigation in file.
I found two problems in this solution:
1. slow first move to end in large files, because can not read files
backward. (loading in background may help)
2. it is slow with multibyte characters. I tried to eliminate calling iconv
to two, but it did not help (iconv is called on every byte). I think
caching some parts of file will be needed.
add support for filesystem, that use others encodings than mc (vfs). Now can be
encoding set only manually, but automatic detection is possible. Filename is
converted in mc_readdir and other function translate it back by vfs_translate
added menu etries encodnig in left and rigth menu (localization will be neede)
modified subshell.c to put subshell correct working directoy,
modified ext.c and execute.c to translate filename before running command
there could be one problem, vfs_translate_path does not use something like
path_magic function
rest of fixes in files cmc.c, main.c (xterm title), panelize.c, subshell.c,
tree.c, tty.c, user.c, util.c, win.c
now, basic mc's function should work well, editor and view are still broken.
changes in sorting strings (name, extension), for comparing are created keys
from strings and than their are compared instead of primary strings. (in
reality, keys are created only for case insensitive comparing, case
sensitive compare original strings). In utf-8 shall by keys faster than
compare strings directly. But this need ediding declaration of all sorts
functions.
changes in handlig keys,
if key is ascii characters, is clear what to do. But when key is between 0x80 and
0xff, it is impossible say, if is valid, alpha, number, ...
I think, that will be better support multibytes characters directly in message
handler, but is not necessary and my patch do not do that.
like buttons use menu entries hotkey_t. But menus are staticly defined, so this
change is much bigger. All menu declaration must be edited. follow standard
changes in drawing and handling hotkeys.
now basic mc's functions works in utf-8, remain correct calculation of controls
width in dialogs, replace functions like tolower, toupper,isspace, ... width
functions from strutil or g_ascii variant.
like in input, added multibytes characters buffer for search in panel (ctrl+s)
drawing is simplier, because alignment do directly str_fit_to_term function
from strutil, changed time functions in util to work correctly in utf-8
in input widget I made a lot of changes:
1. rename some members in WInput to reflect more their functions
(field_len -> field_width, ...)
2. buffer for reading multibytes characters - charbuf, (taken from UTF-8
patch)
3. modified insert_char to accept mulstibytes characters, drawing changed
4. works only with valid strings, str_fix_string used to assure that
input->buffer is valid
changes in complete.c:
- some iteration strings with ++/-- replaced with str_next_char,
str_prev_char, where was needed. ++ was offset oriented, but str_next_char
use directly referecne (char *), so result is not extra beatiful in every
cases
- other buffer for multibytes characters
- complete only valid filenames
all options of radio box are stored in an array of hotkey_t, so radio box has own
copy of options now (in original mc has only a reference to options), changed
drawing and handling hotkey
text of button stored in hotkey_t instead of char*, modified achown.c, because
access directly button text, change in drawing button adn handling hotkey
add new structure hotkey_t for storings caption with hotkey in buttons, menus,...
contains three strings - start, hotkey, end. So hotkey could be any characters,
but mc's message handles works correct only with ascii characters.
for me is working with hotkey_t easier than how are stored hotkeys in original
mc.
add functions for working with strings
some functions are implemented directlu in strutil.c, others have ascii, 8bit
or utf-8 variant. (8bit means singlebyte encodings, where all characters have
width one). Mc autodetects terminal encoding at start and chooses right
variant. If does not know terminal encoding, chooses ascii variant.
contains functions:
1. for translation strings and growing strings
2. for working with characters (next char, prev char, length in
characters, isspace, isalnum, ...)
3. prepeare for display, replace invalid characters with questionmark,
unprintable with dot, left / right / center align
4. comparing strings
in future all string function from util should be moved into strutil, some
function from util have new variant in strutil.