Commit Graph

8143 Commits

Author SHA1 Message Date
Slava Zanko
4eec009295 Merge branch 'm-utf-8' of ssh://www.midnight-commander.org:2222/git/mc into m-utf-8
* 'm-utf-8' of ssh://www.midnight-commander.org:2222/git/mc:
  fix: vertical insetrion UNDO on UTF-8 text.
  fix UNDO:
2009-04-29 13:49:00 +03:00
Slava Zanko
2137d0037f src/wtools: add (Widget *) widget member to QuickWidget structure 2009-04-29 13:43:18 +03:00
Ilia Maslakov
5e5df48951 fix: vertical insetrion UNDO on UTF-8 text. 2009-04-29 07:35:00 +00:00
Ilia Maslakov
a18df0f0d5 Merge branch 'm-utf-8' of ssh://angel_il@midnight-commander.org:2222/git/mc into m-utf-8 2009-04-29 07:14:08 +00:00
Slava Zanko
d7f85d90d3 Search engine: fix core dump with invalid regex 2009-04-29 10:08:55 +03:00
Ilia Maslakov
3020c5573d fix UNDO:
revert void edit_cursor_move to original.
    add void edit_right_char_move_cmd (WEdit * edit)
    add void edit_left_char_move_cmd  (WEdit * edit)
    replace edit_cursor_move call to edit_left_char_move_cmd/edit_right_char_move_cmd in edit_execute_cmd (on key press LEFT/RIGHT)
2009-04-29 07:06:27 +00:00
Ilia Maslakov
2a52039fae fix: edit UNDO after delete, backspace on UTF-8 chars 2009-04-28 18:58:57 +00:00
Ilia Maslakov
a023d66b86 fix: incorrect UNDO in core editor on UTF-8 files. 2009-04-28 12:47:23 +00:00
Ilia Maslakov
6fd08cc199 replace iconv* to g_iconv*, drop iconv.h 2009-04-28 10:03:02 +00:00
Ilia Maslakov
52a2f5379e fix: draw cursor on non-utf-8 console if a character is typically rendered in a double-width cell. 2009-04-27 12:16:53 +00:00
Ilia Maslakov
093d4c7e7a fix: incorrect draw cursor if a character is typically rendered in a double-width cell.
(East Asian utf-8 chars)
2009-04-27 12:08:36 +00:00
Ilia Maslakov
687ab30f74 fix: g_string_free show asserts if str_nconvert_to_display return NULL.
now str_nconvert_to_display return empty GString.
2009-04-27 10:30:18 +00:00
Ilia Maslakov
d99c1def10 fix: broken building on glib < 2.14 2009-04-27 06:34:10 +00:00
Andrew Borodin
931f0d073d src/menu.c: nice menu view: added LTEE and RTEE symbols to menu separators.
Small optimization. Removed some trailing spaces. Some formatting.
2009-04-26 18:22:53 +04:00
Andrew Borodin
f08aee0ad0 widget.c (draw_hotkey): new function to draw widget text with hotkey.
(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.
2009-04-26 11:21:42 +04:00
Andrew Borodin
7ef779dcbc src/search/lib.c (mc_search__recode_str): use symbolic constant
for invalid convertion descriptor.
2009-04-26 09:17:48 +04:00
Andrew Borodin
a20b472807 Merge branch 'm-utf-8' of git://midnight-commander.org/git/mc into m-utf-8 2009-04-26 09:04:58 +04:00
Andrew Borodin
9bb92b02ff src/strutil.h: fixed function descriptions.
src/strutil.c: removed unneeded #include's.
2009-04-26 09:01:34 +04:00
Slava Zanko
94bb61742b Search engine: move string constants from code of normal search to common code area (lib.c) 2009-04-25 16:53:05 +03:00
Slava Zanko
f8deaf63bc Search engine: regex search now worked in any charset 2009-04-25 16:51:37 +03:00
Andrew Borodin
8e43cdbfce Fixed i18n for search error messages.
src/search/internal.h: declare search error messages as global variables.
src/search/normal.c: define search error messages.
2009-04-25 13:44:33 +04:00
Slava Zanko
95ecd0ce54 Merge branch 'm-utf-8' of ssh://www.midnight-commander.org:2222/git/mc into m-utf-8
* '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
2009-04-25 11:10:52 +03:00
Slava Zanko
c2455b246c Make search module more independ (and prepare for future mclib :) ) 2009-04-25 11:09:47 +03:00
Slava Zanko
b2442d1b1e Reorganize source structure: move search engine files into src/search subdir 2009-04-25 10:25:13 +03:00
Slava Zanko
a1f0d9429c Search engine: regexp search now worked 2009-04-25 10:15:56 +03:00
Andrew Borodin
9bd0607048 Fixed coredump in editor after help call.
src/help.c:
Intialize `data' static variable.
(translate_file): fixed memory leak.
(interactive_display): check correct variable to display error message.
2009-04-24 20:40:18 +04:00
Andrew Borodin
95b622f0db src/menu.c (create_menu): don't translate menu entry text if ENABLE_NLS isn't defined. 2009-04-24 20:11:45 +04:00
Andrew Borodin
d716433399 src/strutil.h: created align_crt_t type for string alignment on terminal.
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
2009-04-24 20:01:06 +04:00
Ilia Maslakov
16dd0ad073 fix: uninitialized variable "p" in str_8bit_fit_to_term 2009-04-24 08:40:00 +00:00
Slava Zanko
10b7bdb361 Project now build with:
make CFLAGS="-ansi -pedantic -Wall -Wextra -Werror"

WARNING! Builds wuthout samba.
2009-04-24 01:47:22 +03:00
Slava Zanko
1d18f3227e edit/editcmd.c:
* Fix encoding in replace confirm dialog
 * Correct handle error codes from search engine
2009-04-23 17:46:38 +03:00
Slava Zanko
ea2740059b edit/editcmd.c: Replace now worked with new search engine (just simple mode search) 2009-04-23 17:28:07 +03:00
Slava Zanko
d9500ec836 Search engine: fix return number of found bytes
Some reidentation of code
2009-04-23 16:26:14 +03:00
Slava Zanko
a3e6a1147d Search engine: fixed types in functions parameters.
* renamed founded* to found* :)
2009-04-23 16:16:00 +03:00
Slava Zanko
4114a95723 Search engine: fix search in case sentitive mode 2009-04-23 15:52:03 +03:00
Slava Zanko
9db1cf46a4 Continue develop of search engine: simple search now worked 2009-04-23 15:46:06 +03:00
Slava Zanko
dac42ca7f2 Merge branch 'm-utf-8' of ssh://www.midnight-commander.org:2222/git/mc into m-utf-8
* 'm-utf-8' of ssh://www.midnight-commander.org:2222/git/mc:
  fix: build error on glib < 2.14
2009-04-23 14:32:32 +03:00
Slava Zanko
8fb216e732 Continue develop of mc_search module.
* 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
2009-04-23 14:30:14 +03:00
Ilia Maslakov
1133dd750b fix: build error on glib < 2.14 2009-04-23 07:34:10 +00:00
Sergei Trofimovich
725fe42290 src/view.c: valgrind: hackish fix of uninitialised value usage
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>
2009-04-22 22:15:51 +03:00
Sergei Trofimovich
27fbf91c28 vfs/vfs.c: valgrind: fixed read-of-unallocated memory
Comment snippet:
    We can't just allocate struct dirent as (see man dirent.h)
    struct dirent has VERY nonnaive semantics of allocating
    d_name in it. Moreover, linux's glibc-2.9 allocates dirents _less_,
    than 'sizeof (struct dirent)' making full bitwise (sizeof dirent) copy
    heap corrupter. So, allocate longliving dirent with at least
    (NAME_MAX + 1) for d_name in it.
    Strictly saying resulting dirent is unusable as we don't adjust internal
    structures, holding dirent size. But we don't use it in libc infrastructure.
    TODO: to make simpler homemade dirent-alike structure.

Signed-off-by: Sergei Trofimovich <slyfox@inbox.ru>
2009-04-22 22:15:51 +03:00
Sergei Trofimovich
b88147f0c6 cleanup: build warnings: 'char *' -> 'const char *'
Signed-off-by: Sergei Trofimovich <slyfox@inbox.ru>
2009-04-22 22:15:43 +03:00
Andrew Borodin
dc8150a521 src/strutil.h: created estr_t type for result of charset convertion functions.
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.
2009-04-22 20:35:32 +04:00
Andrew Borodin
2ad5d2e919 Fixed linkage.
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.
2009-04-22 20:20:42 +04:00
Slava Zanko
ab729f822a src/search.[ch]: add experimental search engine. Need to review and revork.
* 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.
2009-04-22 18:52:49 +03:00
Slava Zanko
b0a0a8f17b src/screen.c: fix memleak in remove_encoding_from_path 2009-04-22 15:34:19 +03:00
Slava Zanko
e8f71d0db8 Fix memory leak and coredump if do search in editor. 2009-04-22 11:59:14 +03:00
Andrew Borodin
4e64ee3b8d edit/editcmd.c (edit_search_cmd): removed redundant code. 2009-04-22 06:19:20 +04:00
Ilia Maslakov
945d2183ac fix: incorrect delete selected block if is utf-8 text
add param byte_delete to edit_delete, if byte_delete = 1 then one byte only delete,
but not multibyte char.
2009-04-21 22:32:30 +00:00
Ilia Maslakov
990838a226 fix: draw in core editor 8-bit locale and UTF-8 source 2009-04-21 21:27:42 +00:00