Commit Graph

300 Commits

Author SHA1 Message Date
Andrew Borodin
39ddea87ee Ticket #1843: slow syntax highlighting engine in editor.
Initial step: some #include's arrangement.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2010-01-05 12:19:41 +03:00
Enrico Weigelt, metux IT service
ec1a52fb0a VFS: renamed USE_VFS to ENABLE_VFS 2009-12-30 11:06:11 +02:00
Enrico Weigelt, metux IT service
80b3776c20 VFS: fixed lots of missing includes to vfs/vfs.h 2009-12-30 11:06:09 +02:00
Vit Rosin
280d7e88f9 change type of some parameters from int to long.
Changed functions:
 * edit_count_lines()
 * edit_move_forward()
 * edit_move_backward()

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2009-12-25 19:44:34 +02:00
Andrew Borodin
b9400e140f Ticket #1892: fixed resource leaks.
Fixed memory leak.
Fixed unclosed file descriptors.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2009-12-23 22:31:30 +03:00
Ilia Maslakov
26689fc39e editcmd.c 'eval_marks': removed unused variable 'diff'
Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
2009-12-16 11:10:44 +02:00
Vit Rosin
b6875454b2 Unifying of g_strconcat() calls
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2009-12-16 11:10:43 +02:00
Andrew Borodin
ec5791b7af Types accuracy, minor optimization, removed unneeded goto and return.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2009-12-16 11:10:42 +02:00
Sergei Trofimovich
4f2079fec7 clang: fixed useful warnings (-Wformat related)
../../mc/edit/editcmd.c:2519:50: error: field precision should have type 'int', but argument has type 'gsize' (aka 'unsigned long') [-Wformat]
    match_expr = g_strdup_printf ("(^|\\s+|\\b)%.*s[^\\s\\.=\\+\\[\\]\\(\\)\\,\\;\\:\\\"\\'\\-\\?\\/\\|\\\\\\{\\}\\*\\&\\^\\%%\\$#@\\!]+", word_len, bufpos);
                                                 ^                                                                                         ~~~~~~~~
../../mc/edit/editcmd.c:2700:38: error: field precision should have type 'int', but argument has type 'gsize' (aka 'unsigned long') [-Wformat]
    match_expr = g_strdup_printf ("%.*s", word_len, bufpos);
                                     ^    ~~~~~~~~
2 diagnostics generated.
make[2]: *** [editcmd.o] Error 1
make[2]: Target `all' not remade because of errors.
../../../mc/src/mcconfig/common.c:71:74: error: format string is not a string literal (potentially insecure) [-Wformat-security]
        g_propagate_error (error, g_error_new (mc_main_error_quark() ,0, strerror(errno)));
                                                                         ^~~~~~~~~~~~~~~
../../../mc/src/mcconfig/common.c:83:74: error: format string is not a string literal (potentially insecure) [-Wformat-security]
        g_propagate_error (error, g_error_new (mc_main_error_quark() ,0, strerror(errno)));
                                                                         ^~~~~~~~~~~~~~~
2 diagnostics generated.
make[3]: *** [libmcconfig_la-common.lo] Error 1
make[3]: Target `all' not remade because of errors.
../../mc/src/main.c:2165:41: error: format string is not a string literal (potentially insecure) [-Wformat-security]
        message (D_ERROR, _("Warning"), error->message);
                                        ^~~~~~~~~~~~~~
1 diagnostic generated.

Signed-off-by: Sergei Trofimovich <slyfox@inbox.ru>
2009-12-16 11:10:41 +02:00
Slava Zanko
71bb255b2c Refactoring of edit_replace_cmd__conv_to_display() and edit_replace_cmd__conv_to_input() functions.
Now these functions will return newly allocated string in any case.
As third-side effect, fixed memory leak with '--disable-charset' configure option.

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2009-12-16 11:10:40 +02:00
Ilia Maslakov
af79d7b3ef fixed uninitialised editor buffers (detected by valgrind) thnx andrew_b
Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
2009-12-16 11:10:40 +02:00
Ilia Maslakov
dd5b7c8651 Ticket #1839 (troubles with vertical selection: delete, move, etc.)
fixed: 'eval_marks' for correct vertical block delete.

Signed-off-by: Ilia Maslakov <il.smind@gmail.com>

    fixed edit_block_delete, edit_delete_column_of_text for correct delete vertical block
    fixed cursor position after delete block

Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
2009-12-09 14:58:02 +03:00
Ilia Maslakov
cfc90ab23f fixed eval_marks for correct calculation of the sizes of the selected block
Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
2009-11-24 20:35:09 +00:00
Ilia Maslakov
380504c8d9 Ticket #1837 (incorrect block selection)
fixed strange behavior of selection in editor.

Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
2009-11-20 15:34:42 +03:00
Andrew Borodin
a193e2e56f Ticket #1831: fixed compilation warings of --disable-nls and --disable-charset options.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2009-11-20 14:39:51 +03:00
Andrew Borodin
da33e767e9 Type accuracy and code clean up.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2009-11-19 10:07:51 +03:00
Slava Zanko
e7c6d59e63 Code cleanup for compile with new CFLAGS value.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2009-10-28 13:37:40 +02:00
Ilia Maslakov
467d833ac3 Ticket #46 (mcedit: check POSIX newline at end of file)
* added warning dialog (showed before save/save as)
    * added option "editor_check_new_line"
    * changed dialog 'Edit Save Mode' (added check box 'Check POSIX new line')

Signed-off-by: Ilia Maslakov <il.smind@gmail.com>

    * Redesing of 'Edit Save Mode' dialog.
    * Added hotkeys in 'Edit Save Mode' dialog.
    * Modified warning message, minor optimization.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2009-10-27 12:08:45 +00:00
Ilia Maslakov
cb5836c2e0 Ticket #1667: Hardcoded colours
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>
2009-10-24 16:42:04 +03:00
Ilia Maslakov
dc8c80c334 Ticket #1553
fixed wrong rectangular selection when selected from right to left
    and/or bottom to top

Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
2009-10-23 11:47:38 +00:00
Slava Zanko
dd94068a62 Ticket #1649: Prepare for prerelease mc-4.7.0-pre3 (code cleanup)
Try to compile with
{{{
make CFLAGS="-Wall -Werror -Wno-long-long -Wwrite-strings"
}}}

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2009-09-30 16:42:11 +03:00
Ilia Maslakov
71b1a8bf99 Ticket #212 (User defined hotkeys)
created structs:
    struct name_key_map_t
    struct key_config_t
    global_key_map_t
    add lookup_action
    replace editor key map struct to global_key_map_t
    add main_map screen_map
    replace command CK_* to src/cmddef.h
    add mc.keymap
    fix misc/Makefile.am
    add x_keymap
    add more commands

Signed-off-by: Ilia Maslakov <il.smind@google.com>
2009-09-29 17:42:32 +00:00
Slava Zanko
a1e3999abf Editor: Autocomplete all words (not just English words)
Also fix charset conversation for autocompleted text.

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2009-09-23 16:13:36 +03:00
Slava Zanko
d5381e862e Added option for switch beetween 'collect completions before cursor'
and 'collect completions in entire file'

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2009-09-23 16:13:36 +03:00
dborca
fdbd5b8a86 Ticket #1486: Editor completion is confusing
Editor completion became really confusing in 4.7.0-pre1:

1. The list is populated with words from the entire file. This is arguably
better than the old style, which scanned only up to the cursor. But the number
of suggestions are limited, and if you have a bigger file, some words won't
make it in the list. Besides, I somehow liked the old way.

2. Suggestions do not end on a word boundary. This may or may be not useful; but
it just increases the list of suggestions, which slows the user. In the end, it
beats the purpose of completions.

3. It completes the word I am currently editing. That's smart. :)

4. The suggestions are displayed in the order in which they were found from the
beginning of the file. This is my main gripe, because when using the editor for
coding, it is better to have suggestions based on the distance to the cursor.
Closer means higher. When writing a function, I am mainly interested in the
variable names I recently used.

5. Sometimes, it does not work at all, but I haven't investigated the bug. :(

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2009-09-23 16:13:36 +03:00
Ilia Maslakov
9e5fb208a9 Ticket #1556 (editor search: button 'Find all')
* add new button 'Find all' into Search dialog. Bookmarks all founded entries.
    * fix: search dialog (buttons are positioned dynamically)
    * some optimisation of usability.

Signed-off-by: Ilia Maslakov <il.smind@google.com>
2009-09-07 13:06:04 +00:00
Andrew Borodin
c057b0a02a Fixed radiobutton label for Macintosh line break.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2009-09-03 11:39:57 +04:00
Andrew Borodin
f9d6bb075c Ticket #1562: simplfication API of QuickDialog.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2009-09-03 11:39:57 +04:00
Ilia Maslakov
4eba917c0c Added field lb (kind of line break) into WEdit struct
Some cosmetic changes.
Fixed compiling warnings.

Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2009-08-31 13:20:49 +04:00
Andrew Borodin
f023ce440f Ticket #1571: enhancement of mcedit 'Save as' action.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2009-08-31 13:20:49 +04:00
Ilia Maslakov
b819359535 Ticket #1558 (Search backwards behaves erratically)
fix: backward search. When the cursor set on the begin of the word,
         search found this word, but should not.

Signed-off-by: Ilia Maslakov <il.smind@google.com>
2009-08-24 07:04:52 +00:00
Ilia Maslakov
156b79609c Ticket #1487 (Whole words search)
thanx Daniel Borca <dborca@yahoo.com> for the patch

    * fix special_chars in regex.c
    * add whole_words into mc_search_struct
    * add 'Whole words' into 'Search', 'Replace' 'File find' dialogs

Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
2009-08-22 11:24:00 +00:00
Ilia Maslakov
7ef283975b Ticket #1519 (Editor Search/Replace in selection only)
thanx dborca <dborca@yahoo.com> for the patch

    * add option 'In selection' into 'Search' and 'Replace' dialogs
    * changed search and replace algorithm
    * fix search start position if cursor placed beyond marked text.

Signed-off-by: Ilia Maslakov <il.smind@gmail.com>

    * Fixed handle of 'In selection' option in 'search' dialog.

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2009-08-22 10:00:33 +00:00
Ilia Maslakov
68a6495c96 fix: incorrect move/delete block if 'Cursor beyond end of line' swiched on
fix: Enter behavior if 'Cursor beyond end of line' swiched on

Signed-off-by: Ilia Maslakov <il.smind@google.com>
2009-08-21 13:42:30 +00:00
Sergei Trofimovich
985f076e5f Merge commit 'origin/82_sanitize_ro_file_edition'
* commit 'origin/82_sanitize_ro_file_edition':
  Ticket #82: savannah: "save as" retains mode (take 2) provided by dborka
2009-08-19 20:54:15 +03:00
Sergei Trofimovich
c769f7fcd3 Ticket #82: savannah: "save as" retains mode (take 2) provided by dborka
Suppose you have two files, foo and bar. Both files have 444 permissions.
Now edit foo and "Save". It can't save and instead prompt you to "Save As".
Enter bar. It will chmod bar to 644. If we don't touch touch existing file
permissions for "Save", I don't see why we should for "Save As".

Patch adds S_IWUSR only if different_filename and file does not exist yet.
For consistency, it's S_IWUSR not S_IWRITE.

Signed-off-by: Sergei Trofimovich <slyfox@inbox.ru>
2009-08-18 22:28:59 +03:00
Ilia Maslakov
4afee14f94 Ticket #1529 (remove search converter overhead)
* add: void tty_print_anychar (int c)
    * remove superfluous search converter in convert_from_utf_to_current_c,
      convert_from_8bit_to_utf_c add converter to WEdit struct
    * fix: init defaulf codesets
    * fix: segfault on replace if LANG=C

Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
2009-08-18 05:52:40 +00:00
Ilia Maslakov
f4fc6ad79d Ticket #1534 (cool cooledit)
first commit for support drag cursor after end of line

    * change mouse movement, allow place cursor after EOL
    * change vertical select
    * fix: right scroll

Signed-off-by: Ilia Maslakov <il.smind@google.com>
2009-08-17 18:11:20 +00:00
Andrew Borodin
bc09ff3888 Ticket #1414: implemented scalable TUI.
Thanks to E.L.K.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2009-08-17 15:54:39 +04:00
Ilia Maslakov
bf6d6bafb4 Ticket #364 (Broken keymap after external command)
fix: broken keymap after run external command (like ispell)
2009-08-15 09:09:21 +00:00
Andrew Borodin
3318a5fd98 Call repaint_screen() in screen repaint command handling. 2009-08-12 21:23:13 +04:00
Andrew Borodin
55e626726c For NCurses, always call doupdate() in tty_refresh(). 2009-08-12 21:23:12 +04:00
Andrew Borodin
86f77f3cb2 New functions.
tty_touch_screen() is used instead of touchwin() function or macro.
tty_set_normal_attrs() is used instead of standend() function or macro.
tty_set_alt_charset() is used instead of acs() and noacs()
functions or macros.
tty_baudrate() is used instead of baudrate() function or macro.
2009-08-12 21:23:12 +04:00
Andrew Borodin
2b7a991fde New functions.
tty_keypad() is used instead of keypad() function or macro.
tty_nodelay() is used instead of nodelay() function or macro.
tty_reset_prog_mode() is used instead of reset_prog_mode() function or macro.
tty_reset_shell_mode() is used instead of reset_shell_mode()
function or macro.
tty_beep() is used instead of beep() function or macro.
2009-08-12 21:23:12 +04:00
Andrew Borodin
069aab9ebc Renamed mc_refresh() to tty_refresh(). 2009-08-12 21:22:17 +04:00
Andrew Borodin
f3730bdc41 Initial step to move TTY layer of MC to separate library. 2009-08-12 21:19:20 +04:00
Daniel Borca
2a586710b7 Ticket #1496 (Search backwards is broken)
fix: file edit/editcmd.c backward search is broken
2009-08-12 15:04:37 +03:00
Sergei Trofimovich
65771004c4 Ticket #82 (savannah: "save as" retains mode) patch by imdagger
Consider following scenario:
$ touch /tmp/foo_file
$ chmod 0444 /tmp/foo_file # readonly for owner
$ mcedit /tmp/foo_file
> 1. edit
> 2. try to save, fail. choose another name: /tmp/foo_file2
> 3. edit
> 4. try to save, fail again!

This patch adds owner write permissions for files, created in
step 2.

Signed-off-by: Sergei Trofimovich <slyfox@inbox.ru>
2009-08-09 19:24:42 +03:00
Ilia Maslakov
99c8f6a680 Ticket #1460 (shared search history)
* The sample of the containing text by file search;
    * The sample of search in file mcview;
    * The sample of search in mcedit (search operation);
    * The substituting text in mceditor (replacement operation).

    Author: Alexey Korop

    Signed-off-by: Ilia Maslakov <il.smind@gmail.com>

    Editor: search will continue from last search string if SHIFT+F7 hotkey pressed
    at first time (without pressed F7 key).

    Signed-off-by: Slava Zanko <slavazanko@gmail.com>

    add const MC_HISTORY_SHARED_SEARCH into history.h

    Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
2009-08-05 14:30:08 +00:00
Slava Zanko
f67fcfb94f Fixed excaping of '%' symbol in edit_complete_word_cmd() function
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2009-07-17 12:00:03 +03:00