Commit Graph

248 Commits

Author SHA1 Message Date
Ilia Maslakov
c3755f0c50 added keybind CK_Toggle_Show_Margin for toggle show right margin (with empty default key)
added new color pair for right margin (editrightmargin) into skins

Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
2010-01-06 14:31:40 +03:00
Ilia Maslakov
7c2692cf8c add new etitor parameter editor_show_right_margin
Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
2010-01-06 14:26:02 +03:00
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
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
Ilia Maslakov
3edfb0bc58 Ticket #1884 (incorrect jump to the EOF)
fixed edit_move_to_top for save the current cursor column position after jump to the EOF.

Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
2009-12-21 10:43:57 +03:00
Ilia Maslakov
b0c58fbf4d Ticket #1877 (edit scroll down fix)
fixed edit_move_updown: cursor held, text scrolled up.

Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
2009-12-17 17:10:55 +00: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
Ilia Maslakov
b90825fee4 added NULL check before call g_utf8_find_prev_char, g_utf8_get_char_validated for more safety.
Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
2009-12-16 11:10:42 +02:00
Andrew Borodin
3e12139a94 Editor: some code clean up.
Removed unneeded goto, return, #ifdef.
Type accuracy.
Indentation.
Minor optimization.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Signed-off-by: Sergei Trofimovich <slyfox@inbox.ru>
2009-12-16 11:10:41 +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
Andrew Borodin
d2e096044d Some speed optimization of editor.
Functions that are called only in one place have been maken inline.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2009-12-16 11:10:40 +02:00
Slava Zanko
7dc3b43a20 Merged code of two functions edit_move_up() and edit_move_down()
into one function with additional parameter.

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2009-12-10 09:28:31 +03:00
Ilia Maslakov
6ed3909280 Ticket #1628 (fix for drawing CJK chars)
fixed: drawing CJK character as '...'.
    Sometimes the CJK character gets replaced by three inverse dots.

Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
2009-12-10 09:26:58 +03:00
Ilia Maslakov
595eb7e3f0 Ticket #1809 (incorrect calculanion char width in 8-bit locales)
fixed: cursor placement and movements in non-ascii (cyrillic) UTF-8 files
    in 8-bit (KOI8-R) locales
    fixed incorrect width calculation in 7-bit codeset

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

    Minor optimization of edit_move_forward3() function.
    Also fixed build with --disable-charset option.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2009-12-09 14:42:51 +03:00
Ilia Maslakov
2ae5412fb7 refresh screen any way
Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
2009-12-06 10:20:35 +03:00
Andrew Borodin
8eb860eb48 Ticket #1844: refactoring of goto in editor user_menu() function.
Refactoring of uneeded goto in user_menu() function in editor.
Thanks to Vit Rosin for originl patch.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2009-12-06 10:20:35 +03:00
Ilia Maslakov
99f0e50aba Ticket #1809 (editor: incorrect cursor positioning)
fixed: cursor positioning after non-printeble char (in 8-bit encoding)
    added: char convertion for correct cursor movement

Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
2009-12-02 18:28:22 +00:00
Ilia Maslakov
dc9029f599 Ticket #1839
fixed vertical selection behavior.

Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
2009-11-24 20:33:15 +00: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
Ilia Maslakov
51e7de4bb5 Ticket #1809 (invalid length of nonprintable chars)
fixed calculation of the cursor position in 'edit_move_forward3'.

Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
2009-11-19 17:41:26 +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
Andrew Borodin
354b184463 Ticket #1810: fixed CK_Edit_Save_Mode command handling.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2009-11-11 13:55:52 +03:00
Andrew Borodin
d870705e0b Ticket #1759: fixed date & time insertion in editor.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2009-11-03 13:51:05 +03:00
Ilia Maslakov
be65c2979c Ticket #1768 (incorrect calculation utf-8 width)
fixed miscalculating of width some utf-8 characters

Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
2009-11-01 16:54:00 +00:00
Slava Zanko
51f10b3038 Cleanup of code for compile with new warnings options for compilator
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2009-10-30 20:36:48 +02:00
Ilia Maslakov
7ce5e1eacb Ticket #1628 (editor CJK fix)
fix: incorrect drawing CJK character. Sometimes the CJK character gets replaced by three inverse dots.

Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
2009-10-30 11:51:40 +00:00
Ilia Maslakov
359c9406d1 Ticket #1489 (indent block)
added bindings for shift block 'EditShiftBlockLeft', 'EditShiftBlockRight'
    EditShiftBlockLeft, EditShiftBlockRight - force move block without option_persistent_selections checking

Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
2009-10-29 07:58:30 +00: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
Andrew Borodin
7e33c12685 Show actual shortcuts in editor menu.
Key emulation in editor was removed. Default key emulation
is stored in misc/mc.keymap.default file. Emacs key emulation
is stored in misc/mc.keymap.emacs.
Editor options dialog was redesigned.
Shortcut parser was fixed.
Fixes after rebase to recent master.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2009-10-26 16:15:32 +03:00
Andrew Borodin
729d4f08a9 Implemented default actual shortcuts for main menu.
Some functions and commands are renamed.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2009-10-26 16:15:31 +03:00
Ilia Maslakov
82b7c4fdee Add support for multi-hotkeys in editor (like a ctrl-x,t).
Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
2009-10-26 16:15:31 +03:00
Andrew Borodin
b4b30941f5 Some refactoring.
Renamed name_key_map_t to name_keymap_t.
Renamed global_key_map_t to global_keymap_t.
Use more '#ifdef USE_INTERNAL_EDIT' preprocessor directives
Removed unused variables and structure members.
Aplly const modificator to keybind argument of keybind_cmd_bind().
Aplly const modificator to keyname argument of lookup_action().

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2009-10-26 16:15:31 +03:00
Andrew Borodin
b3b332083c Use commands instead of callbacks to execute menu items.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2009-10-26 16:15:31 +03: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
6717960d5b Ticket #1492
fixed: indentation block when selecting with F3

Signed-off-by: Ilia Maslakov <il.smind@google.com>
2009-10-21 18:03:45 +00:00
Ilia Maslakov
93f8b96b32 Ticket #1664 (Viewer: incorrect tabs alignment)
fix tabs alignment. Variable option_tab_spacing instead hardcoded '8' are used.

Signed-off-by: Ilia Maslakov <il.smind@google.com>
2009-10-07 07:25:26 +00:00
Ilia Maslakov
4c64340111 Ticket #1650
fix: UNDO behavior when cursor besides EOL

Signed-off-by: Ilia Maslakov <il.smind@google.com>
2009-09-30 12:09:10 +00:00
Ilia Maslakov
87102cc7e8 fix: main.c keys handler
add more keys into mc.keymap
    fix: CK_SingleDirsizeCmd event
    add default keys (alt-'.', alt-'+') mc.keymap

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

    Added alt-shift-h hotkey
    Add some documentation about keymap file.
    Replace some symbols into names '.' to 'dot', '?' to question, etc.

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2009-09-29 17:42:40 +00:00
Ilia Maslakov
dbdc3254c1 add more commands into mc.keymap
Signed-off-by: Ilia Maslakov <il.smind@google.com>
2009-09-29 17:42:35 +00:00
Ilia Maslakov
592ddbf39e refactoring editor keybindings
add more keys into mc.keymap
Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
2009-09-29 17:42:35 +00:00
Ilia Maslakov
5a397a6b9a * add new commands into cmddef.h
* add user keybind in widgets
    * add widget keybindings

Signed-off-by: Ilia Maslakov <il.smind@google.com>
2009-09-29 17:42:34 +00:00
Ilia Maslakov
da303d73ac * removed edit/usermap.c edit/usermap.h
Signed-off-by: Ilia Maslakov <il.smind@google.com>
2009-09-29 17:42:33 +00: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
Ilia Maslakov
559f161ebc Ticket #1599 (navigation with Ctrl+arrows besides EOL)
fix: navigation with Ctrl+arrows besides EOL
    fix: kill word left/right when cursor besides EOL

Signed-off-by: Ilia Maslakov <il.smind@google.com>
2009-09-23 12:04:25 +00: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
Denys Vlasenko
e064bd60df De-inline a few functions which are large
...or not-so-large but nevertheless
contain more than one function call,
or contain loops, or contain if's and at least one
function call, or contain largish objects on stack.

In my experience, in those cases the code size
growth is big enough to not inline stuff.

I guess some of the really big functions
are defined inline because they have, or had in the past,
just one callsite.

But for a few years gcc already does it automatically,
no need to do it by hand and risk code size explosion
when later during code evolution another callsite
is created. This optimization by hand is simply
no longer needed.

Anyway, here is the code size difference:

   text    data     bss     dec     hex filename
 572337   17944  177820  768101   bb865 mc.t5/.obj/src/mc
 567697   17944  177820  763461   ba645 mc.t6/.obj/src/mc

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Signed-off-by: Sergei Trofimovich <slyfox@inbox.ru>
2009-08-31 07:12:59 +03: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