Commit Graph

269 Commits

Author SHA1 Message Date
Pavel Roskin
8275c2f5fd * editcmd.c (raw_callback): Use standard common_dialog_repaint()
to handle DLG_DRAW.
2002-08-22 05:58:30 +00:00
Pavel Roskin
231f67342e * editwidget.c (edit): Make edit_bar a local variable. 2002-08-21 22:54:27 +00:00
Pavel Roskin
4756fbf271 * editcmd.c (freestrs): Set freed strings to NULL.
(catstrs): Use g_malloc() and g_free().
2002-08-20 23:57:34 +00:00
Pavel Roskin
42f28932fc * editcmd.c (freestrs): New function to clean temporary strings.
* edit.c (edit_clean): Call freestrs().
2002-08-20 23:18:36 +00:00
Pavel Roskin
37318c2b78 * editmenu.c: Use new create_menu() interface. 2002-08-20 21:31:23 +00:00
Pavel Roskin
3a93326ce7 * editoptions.c: Make some variables static.
* edit.h: Take extern declaratrions from all C files.
2002-08-19 01:23:24 +00:00
Pavel Roskin
5dbb74eca2 * editcmd.c (edit_block_process_cmd): Plug memory leak.
Simplify logic, reformat.
2002-08-19 00:33:08 +00:00
Pavel Roskin
21cc1c5e28 * edit.c (edit_push_action): Fix access to uninitialized memory.
Found by Valgrind.
2002-08-02 16:44:04 +00:00
Pavel Roskin
d6a8671055 * syntax.c: Remove all references to MAD. 2002-08-01 20:44:24 +00:00
Pavel Roskin
e692d7865c * edit.h: Don't include mad.h. 2002-08-01 19:42:45 +00:00
Andrew V. Samoilov
f7de38f345 * edit.h (edit_get_load_file): Mark message for translation.
(edit_get_save_file): Ditto.
2002-07-29 17:09:02 +00:00
Pavel Roskin
2e17e22122 * syntax.c (apply_rules_going_right): Recheck keyword rules when
a keyword is found on the left border of a context.
2002-07-20 09:12:55 +00:00
Pavel Roskin
72a5fc5cc1 * syntax.c (edit_get_syntax_color): Return colorpair index, not
attribute, when syntax highlighting is disabled.  Handle black
and white mode separately.
2002-07-14 22:39:07 +00:00
Pavel Roskin
3c437c273d * syntax.c (edit_load_syntax): Do nothing in black and white
mode.
2002-07-14 22:19:49 +00:00
Pavel Roskin
75666df0fe * edit.h [!HAVE_SLANG]: Enable syntax highlighting.
* editdraw.c [!HAVE_SLANG]: Respect attributes for color pairs
by using MY_COLOR_PAIR macro.
2002-07-14 21:43:53 +00:00
Pavel Roskin
a23618b2ef * edit.h (struct key_word): Remove unused "bg" field, rename
"fg" to	"color", since it keeps all color information.
* syntax.c (edit_get_syntax_color): Replace "fg" and "bg"
arguments with a single argument "color".
Adjust all dependencies.
2002-07-14 17:56:47 +00:00
Pavel Roskin
bb989f677a * editdraw.c (edit_draw_this_line): Fix setting MOD_ABNORMAL
attribute.
(print_to_widget): Fix displaying non-printable characters with
ncurses.  Set color for every character even if syntax
highlighting is not compiled - it's needed to reset color after
non-printable characters.
2002-07-14 07:49:24 +00:00
Pavel Roskin
4655fbbb6b * editdraw.c (edit_status): Use EDITOR_NORMAL_COLOR instead of
NORMAL_COLOR.
* syntax.c (edit_get_syntax_color) [!HAVE_SYNTAXH]: Likewise.
2002-07-14 06:17:02 +00:00
Pavel Roskin
2ce74d23e1 * edit.c (check_file_access): Return 1 on all errors, document
this behavior.  Set edit->delete_file to 1 for newly created
files.
(edit_open_file): Don't set edit->delete_file, it's now done in
check_file_access().
Reported by Saso <saso@bojler.dhs.org>
2002-06-24 23:41:59 +00:00
Andrew V. Samoilov
17a0c13186 s/declaration/definitions/ in the last but one entry 2002-05-13 17:15:14 +00:00
Andrew V. Samoilov
16b73c1f39 * editcmd.c (edit_save_file): Call mc_chown () and mc_chmod ()
before mc_open () to prevent hangs over ftpfs.
2002-05-13 17:12:45 +00:00
Andrew V. Samoilov
0b08e1b69f * edit.h: Remove open, close, write, read and mkdir declaration.
* edit.c: Use mc_open, mc_close, mc_write, mc_read, mc_rename,
mc_chmod and mc_chown. Don't cast (char *) to (unsigned long)
in pointer arithmetics.
* editcmd.c: Likewise.
2002-05-13 16:53:51 +00:00
Andrew V. Samoilov
47f1ce66af * syntax.c (edit_read_syntax_file): Use system wide Syntax
Highlighting definitions' file if there is no users one.
2002-03-25 07:52:53 +00:00
Pavel Roskin
351a118d20 * edit.h: Use eregex.h, not regex.h.
From Alexander Varakin <avarakin00@hotmail.com>
2002-03-18 21:09:50 +00:00
Andrew V. Samoilov
80fb518808 * editcmd.c (edit_replace_cmd): Eliminate fin_string
and use message() to fix possible buffer overflow.
(edit_search_cmd): Likewise.
2002-02-27 15:40:22 +00:00
Andrew V. Samoilov
fc3ef44f3b * syntax.c (convert): Fix buffer overflow for ".*\" cases. 2002-02-18 14:48:36 +00:00
Pavel Roskin
817602f8af * editdraw.c (edit_scroll_screen_over_cursor): Do nothing if the
edit widget has zero width or height.
2002-01-23 00:12:17 +00:00
Pavel Roskin
3d0de08b32 * edit.c: Rename DELETE to DELCHAR to avoid macro redefinition
on Win32.
* edit.h: Likewise.
2002-01-22 00:49:33 +00:00
Pavel Roskin
7ed785e3cc * edit.c: Add support for CK_Complete_Word event.
* editcmddef.h: Likewise.
* edit_key_translator.c (cooledit_key_map): Bind Alt-Tab to
CK_Complete_Word.
(emacs_key_map): Likewise.
* editcmd.c: Implement word completion.
2002-01-21 17:49:57 +00:00
Pavel Roskin
eb28e580d9 * editmenu.c (CmdMenuEmacs): Add mail command without shortcut.
Users of emacs keys should be able to send mail too.
2002-01-21 08:26:23 +00:00
Andrew V. Samoilov
1e5b1bfde1 * edit-widget.h: Use PATH_SEP_STR. 2002-01-15 01:43:50 +00:00
Andrew V. Samoilov
e41f4c01e4 (edit_read_syntax_rules): Eliminate c->single_char.
It's only written but never read.

* edit.h (struct context_rule): Comment out single_char field.
It is written once but never read.
2002-01-15 01:41:18 +00:00
Andrew V. Samoilov
3eea969c3b * syntax.c (syntax_g_free): New macro to release and NULLify
glib allocated memory area(s).
(strdup_convert): Rename to ...
(convert): ... this.  Don't strdup passed string.
(get_args): Use convert instead of strdup_convert.
(free_args): Make it do notning macro.
(open_include_file): Eliminate p array. Use glib function to
construct error_file_name. Use PATH_SEP instead of '/';
(edit_read_syntax_file): Use PATH_SEP_STR.
(edit_load_syntax): Use syntax_g_free to release error_file_name.
(edit_read_syntax_rules): Likewise.
2002-01-15 01:32:59 +00:00
Andrew V. Samoilov
3f55f6bf2f * editcmd.c (sprintf_p): Don't cast (char *) to (unsigned long). 2001-12-22 17:34:51 +00:00
Andrew V. Samoilov
c69a25c5eb * editcmd.c (edit_goto_cmd): Use g_free to release f.
(edit_save_file): Use PATH_SEP instead of '/'.
Undefine "close" before closing file created by mc_mkstemps.
Define close to mc_close after it - temporary fix.
2001-12-22 17:29:46 +00:00
Andrew V. Samoilov
bd3bdac638 * syntax.c (read_one_line): Undo last patch - errno is a
function on some systems.  Check ferror() status before
everithing else if fgetc returns EOF.
Accept last line without trailing newline.

(compare_word_to_right): Don't cast p and q to unsigned long.
(apply_rules_going_right): Likewise.
2001-12-22 16:00:30 +00:00
Pavel Roskin
eba0c6e703 * edit.c (user_menu): Don't move the cursor before and after
inserting the block.
Reported by Matthias Urban <murban@cs.uni-magdeburg.de>
2001-12-22 00:32:20 +00:00
Pavel Roskin
6c821c8ad5 * syntax.c (read_one_line): Clear errno before using it. Don't
use the result of fgetc() if errno is EINTR.
2001-12-21 23:33:18 +00:00
Pavel Roskin
27d176979b s/crush/crash/ and other minor things. 2001-12-03 23:38:11 +00:00
Andrew V. Samoilov
a34c2786cb * syntax.c (apply_rules_going_right): Fix crush for lines like
\s+ \n lightgray/13 red
in Syntax file.
(read_one_line): Use EOF instead of -1.
(get_args): Fix buffer overflow for l without trailing
whitespace(s).
(break_a): New macro.
(edit_read_syntax_rules): Use break_a to fix memory leaks.
(edit_load_syntax): Eliminate s and use message to prevent
buffer overflow.
2001-11-28 12:40:18 +00:00
Andrew V. Samoilov
d9a88088d1 * editmenu.c (edit_wrap_cmd): Use g_free() on the result
of input_dialog().
2001-11-27 12:38:30 +00:00
Andrew V. Samoilov
08a8461efa * editcmd.c (edit_save_file): Use g_free() on the result of
mc_mkstemps().
2001-11-22 10:56:09 +00:00
Andrew V. Samoilov
29dd051ce8 * edit.c (edit_renew): Release dir after use.
* editcmd.c (edit_replace_dialog): Eliminate tsearch_text,
treplace_text and targ_order.
(edit_replace_cmd): edit_replace_dialog gives g_malloced
strings, so g_strdup/g_free have to be used.  Accept only
positive pattern number in Scanf search and replace.
(edit_save_file): Enable safe save and backups on remote VFS.
2001-11-19 07:31:32 +00:00
Andrew V. Samoilov
b6b8cd0433 * edit_key_translator.c (cooledit_key_map):
Add C-k, CK_Delete_To_Line_End.

* edit.c (user_menu): Don't assign block_file twice.
2001-11-16 07:23:36 +00:00
Andrew V. Samoilov
51b1972843 * edit.c (edit_reload): destroy_dlg g_free()s widgets, so
g_malloc/g_free have to be used.
	(edit_init): Ditto.  Eliminate st.
2001-11-07 08:43:15 +00:00
Andrew V. Samoilov
d3579ce57b (edit_load_cmd): input_dialog returns g_malloc(ed) string,
so g_free has to be used.
(edit_save_block_cmd): Likewise.
(edit_insert_file_cmd): Likewise.
(edit_sort_cmd): Likewise.
(edit_save_as_cmd): Likewise. Memory leak fixed.
2001-11-06 08:52:13 +00:00
Andrew V. Samoilov
328cbcb954 * edit.h (edit_execute_cmd): Declare it here.
* edit.c: Remove edit_execute_cmd declaration.
(edit_execute_cmd): Use edit_print_string instead of edit_printf.

* editcmd.c:  Remove edit_execute_cmd declaration.
(edit_search_dialog): Eliminate tsearch_text.
(edit_search_cmd): edit_search_dialog gives g_malloc()ed exp.
Use g_strdup/g_free instead of strdup/free.
(edit_mail_dialog): quick_dialog use g_strdup, so g_free
must be used.

* bookmark.c (book_mark_clear): Eliminate rend.
It's only written but never read.
(book_mark_flush): Likewise.
(book_mark_inc): Likewise.
(book_mark_dec): Likewise.
2001-11-05 09:23:05 +00:00
Pavel Roskin
edf0504087 * edit.c (user_menu): If the error file is missing, treat it as
success.  Truncate block file unconditionally.
2001-10-23 05:40:13 +00:00
Pavel Roskin
b1c57095b2 * edit.c: Stop using _EDIT_C definition. Move variable
declarations from edit.h, make static or eliminate if possible.
Report errors immediately.
* edit.h: Likewise.
* editwidget.c (edit): Don't report errors from edit_init(),
they are reported in place.
2001-10-23 01:46:53 +00:00
Pavel Roskin
943bae02ad * editcmd.c (sprintf_p): Declare with the printf attribute.
Make static.
2001-10-20 07:20:30 +00:00
Pavel Roskin
399d996408 * edit.h: Declare edit_printf() with the printf attribute. 2001-10-20 07:16:50 +00:00
Pavel Roskin
c932c4610a * edit.c (check_file_access): Only allow to edit regular files.
Use stat() before open() to prevent hangs on pipes, use fstat()
afterwards if stat() was unsuccessful.
2001-10-18 09:35:22 +00:00
Pavel Roskin
b4324a149b * edit.h: Don't use macro `stat' - it's already a macro on
Solaris 8 with large file support.
* editcmd.c: Replace stat() with mc_stat().
* edit.c: Likewise.
2001-09-17 21:32:47 +00:00
Pavel Roskin
6d8020ff3d * syntax.c (syntax_text): Remove, it's a separate file now.
(upgrade_syntax_file): Remove.
(edit_read_syntax_file): Use check_for_default().
2001-09-11 21:44:52 +00:00
Pavel Roskin
ed1d72c662 * edit.h: Remove some useless definitions. 2001-09-08 05:45:27 +00:00
Pavel Roskin
14c07c5677 * Makefile.am: Don't define "MIDNIGHT" - it's unused now. 2001-09-07 21:24:11 +00:00
Pavel Roskin
afee09a276 * edit.c: Eliminate all code disabled for the text edition.
* editcmddef.h: Likewise.
* editmenu.c: Likewise.
* editwidget.c: Likewise.
* syntax.c: Likewise.
* wordproc.c: Likewise.
2001-09-07 20:10:45 +00:00
Pavel Roskin
944cfcffe6 * edit-widget.h: Change ~/.cedit to ~/.mc/cedit to keep mcedit
files separate from cooledit.
2001-09-07 19:10:44 +00:00
Pavel Roskin
d1caf46603 * bookmark.c: Eliminate all code disabled for the text edition.
* edit-widget.h: Likewise.
* editcmd.c: Likewise.
* editdraw.c: Likewise.
* editoptions.c: Likewise.
2001-09-07 18:56:07 +00:00
Pavel Roskin
89824f18f7 * edit.h: Eliminate all code disabled for the text edition.
Reorder and simplify includes.
* edit.c: Likewise.
2001-09-07 16:52:42 +00:00
Pavel Roskin
b88dbed3a0 * syntax.c (syntax_text): Add PHP support from Cooledit. 2001-09-06 05:26:04 +00:00
Pavel Roskin
ebc45d895d * Makefile.am (AM_CFLAGS): Remove CFLAGS, don't use substituted
values directly.
2001-09-04 05:33:54 +00:00
Pavel Roskin
f743b68a21 * syntax.c (syntax_text): Remove useless ']' in the Perl and
Python rules.  Change shell script rule to use more portable
regular expression.
2001-09-04 05:29:55 +00:00
Pavel Roskin
0b245d4db4 * editcmd.c (edit_block_process_cmd): Prepend space to the
command to avoid polluting bash history.  Document arguments.
Fix crash if block is 0 - not used currently.
2001-09-04 04:16:06 +00:00
Pavel Roskin
6f8323907f Trimmed using last chtrim. Ensure exactly 2 spaces before e-mail. 2001-09-01 20:12:16 +00:00
Pavel Roskin
deb0875b95 * Makefile.am: Don't install libedit.a. 2001-08-26 16:43:54 +00:00
Pavel Roskin
280ac1e9d6 * Makefile.in: Converted to ...
* Makefile.am: ... this.
2001-08-26 08:41:34 +00:00
Pavel Roskin
16e569e3a6 * Makefile.in (EDITSRC): Add headers.
(CPPFLAGS): Remove reference to gtkedit.
2001-08-24 19:04:13 +00:00
Pavel Roskin
b44a4e19c6 Copy all necessary files from gtkedit.
* Makefile.in (EDITLINKS): Merge with EDITSRC, remove all
references.
2001-08-24 18:23:17 +00:00