Hide private API of editor (#361).

All editor private API stuff is located now in edit/edit-impl.h.
Public API is located in edit/edit.h.
Added functions to read some fields of WEdit struct.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2009-06-14 19:18:27 +04:00 committed by Andrew Borodin
parent 537bc71069
commit fd09abaeb2
22 changed files with 470 additions and 388 deletions

View File

@ -8,7 +8,7 @@ endif
libedit_a_SOURCES = \
bookmark.c edit.c editcmd.c editwidget.c editdraw.c editkeys.c \
editmenu.c editoptions.c editcmddef.h edit.h edit-widget.h \
editmenu.c editoptions.c editcmddef.h edit-impl.h edit.h edit-widget.h \
editlock.c editlock.h syntax.c usermap.h usermap.c wordproc.c \
choosesyntax.c etags.c etags.h editcmd_dialogs.c editcmd_dialogs.h

View File

@ -41,7 +41,7 @@
#include "../src/global.h"
#include "edit.h"
#include "edit-impl.h"
#include "edit-widget.h"

View File

@ -24,7 +24,7 @@
#include <config.h>
#include "edit.h"
#include "edit-impl.h"
#include "../src/global.h"
#include "../src/wtools.h"

314
edit/edit-impl.h Normal file
View File

@ -0,0 +1,314 @@
/* edit.h - editor private API
Copyright (C) 1996, 1997, 2009 Free Software Foundation, Inc.
Authors: 1996, 1997 Paul Sheer
2009 Andrew Borodin
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
/** \file edit.h
* \brief Header: editor low level data handling and cursor fundamentals
* edit.h - main include file
* \author Paul Sheer
* \date 1996, 1997
*/
#ifndef MC_EDIT_IMPL_H
#define MC_EDIT_IMPL_H
#include <stdio.h>
#include "../edit/edit.h"
#define SEARCH_DIALOG_OPTION_NO_SCANF (1 << 0)
#define SEARCH_DIALOG_OPTION_NO_REGEX (1 << 1)
#define SEARCH_DIALOG_OPTION_NO_CASE (1 << 2)
#define SEARCH_DIALOG_OPTION_BACKWARDS (1 << 3)
#define SEARCH_DIALOG_OPTION_BOOKMARK (1 << 4)
#define EDIT_KEY_EMULATION_NORMAL 0
#define EDIT_KEY_EMULATION_EMACS 1
#define EDIT_KEY_EMULATION_USER 2
#define REDRAW_LINE (1 << 0)
#define REDRAW_LINE_ABOVE (1 << 1)
#define REDRAW_LINE_BELOW (1 << 2)
#define REDRAW_AFTER_CURSOR (1 << 3)
#define REDRAW_BEFORE_CURSOR (1 << 4)
#define REDRAW_PAGE (1 << 5)
#define REDRAW_IN_BOUNDS (1 << 6)
#define REDRAW_CHAR_ONLY (1 << 7)
#define REDRAW_COMPLETELY (1 << 8)
#define EDIT_TEXT_HORIZONTAL_OFFSET 0
#define EDIT_TEXT_VERTICAL_OFFSET 1
#define EDIT_RIGHT_EXTREME option_edit_right_extreme
#define EDIT_LEFT_EXTREME option_edit_left_extreme
#define EDIT_TOP_EXTREME option_edit_top_extreme
#define EDIT_BOTTOM_EXTREME option_edit_bottom_extreme
/*
* The editor keeps data in two arrays of buffers.
* All buffers have the same size, which must be a power of 2.
*/
/* Configurable: log2 of the buffer size in bytes */
#ifndef S_EDIT_BUF_SIZE
#define S_EDIT_BUF_SIZE 16
#endif
/* Size of the buffer */
#define EDIT_BUF_SIZE (((off_t) 1) << S_EDIT_BUF_SIZE)
/* Buffer mask (used to find cursor position relative to the buffer) */
#define M_EDIT_BUF_SIZE (EDIT_BUF_SIZE - 1)
/*
* Configurable: Maximal allowed number of buffers in each buffer array.
* This number can be increased for systems with enough physical memory.
*/
#ifndef MAXBUFF
#define MAXBUFF 1024
#endif
/* Maximal length of file that can be opened */
#define SIZE_LIMIT (EDIT_BUF_SIZE * (MAXBUFF - 2))
/* Initial size of the undo stack, in bytes */
#define START_STACK_SIZE 32
/* Some codes that may be pushed onto or returned from the undo stack */
#define CURS_LEFT 601
#define CURS_RIGHT 602
#define DELCHAR 603
#define BACKSPACE 604
#define STACK_BOTTOM 605
#define CURS_LEFT_LOTS 606
#define CURS_RIGHT_LOTS 607
#define COLUMN_ON 608
#define COLUMN_OFF 609
#define MARK_1 1000
#define MARK_2 700000000
#define KEY_PRESS 1400000000
/* Tabs spaces: (sofar only HALF_TAB_SIZE is used: */
#define TAB_SIZE option_tab_spacing
#define HALF_TAB_SIZE ((int) option_tab_spacing / 2)
/* max count stack files */
#define MAX_HISTORY_MOVETO 50
#define LINE_STATE_WIDTH 8
typedef struct edit_stack_type {
long line;
char *filename;
} edit_stack_type;
struct macro {
short command;
short ch;
};
/* type for file which is currently being edited */
typedef enum {
EDIT_FILE_COMMON = 0,
EDIT_FILE_SYNTAX = 1,
EDIT_FILE_MENU = 2
} edit_current_file_t;
int edit_drop_hotkey_menu (WEdit *e, int key);
void edit_menu_cmd (WEdit *e);
struct WMenu *edit_create_menu (void);
void edit_done_menu (struct WMenu *wmenu);
void edit_reload_menu (void);
void menu_save_mode_cmd (void);
int edit_translate_key (WEdit *edit, long x_key, int *cmd, int *ch);
int edit_get_byte (WEdit * edit, long byte_index);
char *edit_get_byte_ptr (WEdit * edit, long byte_index);
char *edit_get_buf_ptr (WEdit * edit, long byte_index);
int edit_get_utf (WEdit * edit, long byte_index, int *char_width);
int edit_get_prev_utf (WEdit * edit, long byte_index, int *char_width);
int edit_count_lines (WEdit * edit, long current, int upto);
long edit_move_forward (WEdit * edit, long current, int lines, long upto);
long edit_move_forward3 (WEdit * edit, long current, int cols, long upto);
long edit_move_backward (WEdit * edit, long current, int lines);
void edit_scroll_screen_over_cursor (WEdit * edit);
void edit_render_keypress (WEdit * edit);
void edit_scroll_upward (WEdit * edit, unsigned long i);
void edit_scroll_downward (WEdit * edit, int i);
void edit_scroll_right (WEdit * edit, int i);
void edit_scroll_left (WEdit * edit, int i);
void edit_move_up (WEdit * edit, unsigned long i, int scroll);
void edit_move_down (WEdit * edit, int i, int scroll);
void edit_move_to_prev_col (WEdit *edit, long p);
int edit_get_col (WEdit * edit);
long edit_bol (WEdit * edit, long current);
long edit_eol (WEdit * edit, long current);
void edit_update_curs_row (WEdit * edit);
void edit_update_curs_col (WEdit * edit);
void edit_find_bracket (WEdit * edit);
int edit_reload_line (WEdit *edit, const char *filename, long line);
void edit_block_copy_cmd (WEdit * edit);
void edit_block_move_cmd (WEdit * edit);
int edit_block_delete_cmd (WEdit * edit);
void edit_delete_line (WEdit * edit);
void insert_spaces_tab (WEdit * edit, int half);
int edit_delete (WEdit * edit, const int byte_delete);
void edit_insert (WEdit * edit, int c);
void edit_cursor_move (WEdit * edit, long increment);
void edit_move_block_to_right (WEdit * edit);
void edit_move_block_to_left (WEdit * edit);
void edit_push_action (WEdit * edit, long c, ...);
void edit_push_key_press (WEdit * edit);
void edit_insert_ahead (WEdit * edit, int c);
long edit_write_stream (WEdit * edit, FILE * f);
char *edit_get_write_filter (const char *writename, const char *filename);
int edit_save_confirm_cmd (WEdit * edit);
int edit_save_as_cmd (WEdit * edit);
WEdit *edit_init (WEdit *edit, int lines, int columns,
const char *filename, long line);
int edit_clean (WEdit * edit);
int edit_ok_to_exit (WEdit *edit);
int edit_renew (WEdit * edit);
int edit_new_cmd (WEdit * edit);
int edit_reload (WEdit *edit, const char *filename);
int edit_load_cmd (WEdit * edit, edit_current_file_t what);
void edit_mark_cmd (WEdit * edit, int unmark);
void edit_set_markers (WEdit * edit, long m1, long m2, int c1, int c2);
void edit_push_markers (WEdit * edit);
void edit_replace_cmd (WEdit * edit, int again);
void edit_search_cmd (WEdit * edit, int again);
void edit_complete_word_cmd (WEdit * edit);
void edit_get_match_keyword_cmd (WEdit *edit);
int edit_save_block (WEdit * edit, const char *filename, long start, long finish);
int edit_save_block_cmd (WEdit * edit);
int edit_insert_file_cmd (WEdit * edit);
int edit_insert_file (WEdit * edit, const char *filename);
int edit_load_back_cmd (WEdit * edit);
int edit_load_forward_cmd (WEdit * edit);
void edit_block_process_cmd (WEdit * edit, const char *shell_cmd, int block);
void edit_refresh_cmd (WEdit * edit);
void edit_date_cmd (WEdit * edit);
void edit_goto_cmd (WEdit * edit);
int eval_marks (WEdit * edit, long *start_mark, long *end_mark);
void edit_status (WEdit * edit);
void edit_execute_key_command (WEdit *edit, int command,
int char_for_insertion);
void edit_update_screen (WEdit * edit);
int edit_print_string (WEdit * e, const char *s);
void edit_move_to_line (WEdit * e, long line);
void edit_move_display (WEdit * e, long line);
void edit_word_wrap (WEdit * edit);
int edit_sort_cmd (WEdit * edit);
int edit_ext_cmd (WEdit * edit);
void edit_help_cmd (WEdit * edit);
int edit_save_macro_cmd (WEdit * edit, struct macro macro[], int n);
int edit_load_macro_cmd (WEdit * edit, struct macro macro[], int *n, int k);
void edit_delete_macro_cmd (WEdit * edit);
int edit_copy_to_X_buf_cmd (WEdit * edit);
int edit_cut_to_X_buf_cmd (WEdit * edit);
void edit_paste_from_X_buf_cmd (WEdit * edit);
void edit_select_codepage_cmd (WEdit *edit);
void edit_insert_literal_cmd (WEdit *edit);
void edit_execute_macro_cmd (WEdit *edit);
void edit_begin_end_macro_cmd(WEdit *edit);
void edit_paste_from_history (WEdit *edit);
void edit_set_filename (WEdit *edit, const char *name);
void edit_load_syntax (WEdit * edit, char ***pnames, const char *type);
void edit_free_syntax_rules (WEdit * edit);
void edit_get_syntax_color (WEdit * edit, long byte_index, int *color);
void book_mark_insert (WEdit * edit, int line, int c);
int book_mark_query_color (WEdit * edit, int line, int c);
int book_mark_query_all (WEdit * edit, int line, int *c);
struct _book_mark *book_mark_find (WEdit * edit, int line);
int book_mark_clear (WEdit * edit, int line, int c);
void book_mark_flush (WEdit * edit, int c);
void book_mark_inc (WEdit * edit, int line);
void book_mark_dec (WEdit * edit, int line);
int line_is_blank (WEdit *edit, long line);
int edit_indent_width (WEdit *edit, long p);
void edit_insert_indent (WEdit *edit, int indent);
void edit_options_dialog (void);
void edit_syntax_dialog (void);
void edit_mail_dialog (WEdit *edit);
void format_paragraph (WEdit *edit, int force);
/* either command or char_for_insertion must be passed as -1 */
void edit_execute_cmd (WEdit *edit, int command, int char_for_insertion);
#define get_sys_error(s) (s)
#define edit_error_dialog(h,s) query_dialog (h, s, D_ERROR, 1, _("&Dismiss"))
#define edit_query_dialog2(h,t,a,b) query_dialog (h, t, D_NORMAL, 2, a, b)
#define edit_query_dialog3(h,t,a,b,c) query_dialog (h, t, D_NORMAL, 3, a, b, c)
#define color_palette(x) win->color[x].pixel
#define NUM_SELECTION_HISTORY 64
#ifndef MAX_PATH_LEN
#ifdef PATH_MAX
#define MAX_PATH_LEN PATH_MAX
#else
#define MAX_PATH_LEN 1024
#endif
#endif
extern int edit_stack_iterator;
extern edit_stack_type edit_history_moveto [MAX_HISTORY_MOVETO];
extern WEdit *wedit;
struct WMenu;
extern struct WMenu *edit_menubar;
extern int option_line_state_width;
typedef enum {
EDIT_QUICK_SAVE = 0,
EDIT_SAFE_SAVE,
EDIT_DO_BACKUP
} edit_save_mode_t;
extern int option_max_undo;
extern int option_auto_syntax;
extern char *option_syntax_type;
extern int editor_option_check_nl_at_eof;
extern int option_edit_right_extreme;
extern int option_edit_left_extreme;
extern int option_edit_top_extreme;
extern int option_edit_bottom_extreme;
extern const char *option_whole_chars_search;
extern int column_highlighting;
#endif /* MC_EDIT_IMPL_H */

View File

@ -8,7 +8,8 @@
#include "../src/dialog.h" /* Widget */
#include "../src/search/search.h" /* mc_search_t */
#include "edit.h"
#include "edit-impl.h"
#define MAX_MACRO_LENGTH 1024
#define N_LINE_CACHES 32
@ -137,4 +138,4 @@ struct WEdit {
};
#endif
#endif /* MC_EDIT_WIDGET_H */

View File

@ -40,7 +40,7 @@
#include "../src/global.h"
#include "edit.h"
#include "edit-impl.h"
#include "editlock.h"
#include "edit-widget.h"
#include "editcmddef.h"
@ -83,6 +83,9 @@ int option_edit_bottom_extreme = 0;
const char *option_whole_chars_search = "0123456789abcdefghijklmnopqrstuvwxyz_";
char *option_backup_ext = NULL;
int edit_stack_iterator = 0;
edit_stack_type edit_history_moveto [MAX_HISTORY_MOVETO];
/*-
*
* here's a quick sketch of the layout: (don't run this through indent.)
@ -858,7 +861,7 @@ edit_reload_line (WEdit *edit, const char *filename, long line)
If the stack long int is 0-255 it represents a normal insert (from a backspace),
256-512 is an insert ahead (from a delete), If it is betwen 600 and 700 it is one
of the cursor functions #define'd in edit.h. 1000 through 700'000'000 is to
of the cursor functions #define'd in edit-impl.h. 1000 through 700'000'000 is to
set edit->mark1 position. 700'000'000 through 1400'000'000 is to set edit->mark2
position.
@ -1519,6 +1522,12 @@ void edit_update_curs_col (WEdit * edit)
edit->curs_col = edit_move_forward3(edit, edit_bol(edit, edit->curs1), 0, edit->curs1) + option_line_state_width;
}
int
edit_get_curs_col (const WEdit *edit)
{
return edit->curs_col;
}
/*moves the display start position up by i lines */
void edit_scroll_upward (WEdit * edit, unsigned long i)
{
@ -3041,7 +3050,7 @@ user_menu (WEdit * edit)
int nomark;
struct stat status;
long start_mark, end_mark;
char *block_file = concat_dir_and_file (home_dir, BLOCK_FILE);
char *block_file = concat_dir_and_file (home_dir, EDIT_BLOCK_FILE);
int rc = 0;
nomark = eval_marks (edit, &start_mark, &end_mark);
@ -3076,3 +3085,25 @@ user_menu (WEdit * edit)
cleanup:
g_free (block_file);
}
void
edit_stack_init (void)
{
for (edit_stack_iterator = 0;
edit_stack_iterator < MAX_HISTORY_MOVETO;
edit_stack_iterator++ ) {
edit_history_moveto[edit_stack_iterator].filename = NULL;
edit_history_moveto[edit_stack_iterator].line = -1;
}
edit_stack_iterator = 0;
}
void
edit_stack_free (void)
{
for (edit_stack_iterator = 0;
edit_stack_iterator < MAX_HISTORY_MOVETO;
edit_stack_iterator++)
g_free (edit_history_moveto[edit_stack_iterator].filename);
}

View File

@ -1,8 +1,8 @@
/* edit.h - main include file
/* edit.h - editor public API
Copyright (C) 1996, 1997 Free Software Foundation, Inc.
Copyright (C) 2009 Free Software Foundation, Inc.
Authors: 1996, 1997 Paul Sheer
Authors: 2009 Andrew Borodin
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -20,280 +20,25 @@
02110-1301, USA.
*/
/** \file
* \brief Source: editor low level data handling and cursor fundamentals
* edit.h - main include file
* \author Paul Sheer
* \date 1996, 1997
/** \file edit.h
* \brief Header: editor public API
* \author Andrew Borodin
* \date 2009
*/
#ifndef MC_EDIT_H
#define MC_EDIT_H
#include <stdio.h>
#include "../src/global.h" /* PATH_SEP_STR */
#define SEARCH_DIALOG_OPTION_NO_SCANF (1 << 0)
#define SEARCH_DIALOG_OPTION_NO_REGEX (1 << 1)
#define SEARCH_DIALOG_OPTION_NO_CASE (1 << 2)
#define SEARCH_DIALOG_OPTION_BACKWARDS (1 << 3)
#define SEARCH_DIALOG_OPTION_BOOKMARK (1 << 4)
/* Editor widget */
struct WEdit;
typedef struct WEdit WEdit;
#define EDIT_KEY_EMULATION_NORMAL 0
#define EDIT_KEY_EMULATION_EMACS 1
#define EDIT_KEY_EMULATION_USER 2
#define REDRAW_LINE (1 << 0)
#define REDRAW_LINE_ABOVE (1 << 1)
#define REDRAW_LINE_BELOW (1 << 2)
#define REDRAW_AFTER_CURSOR (1 << 3)
#define REDRAW_BEFORE_CURSOR (1 << 4)
#define REDRAW_PAGE (1 << 5)
#define REDRAW_IN_BOUNDS (1 << 6)
#define REDRAW_CHAR_ONLY (1 << 7)
#define REDRAW_COMPLETELY (1 << 8)
#define EDIT_TEXT_HORIZONTAL_OFFSET 0
#define EDIT_TEXT_VERTICAL_OFFSET 1
#define EDIT_RIGHT_EXTREME option_edit_right_extreme
#define EDIT_LEFT_EXTREME option_edit_left_extreme
#define EDIT_TOP_EXTREME option_edit_top_extreme
#define EDIT_BOTTOM_EXTREME option_edit_bottom_extreme
/*
* The editor keeps data in two arrays of buffers.
* All buffers have the same size, which must be a power of 2.
*/
/* Configurable: log2 of the buffer size in bytes */
#ifndef S_EDIT_BUF_SIZE
#define S_EDIT_BUF_SIZE 16
#endif
/* Size of the buffer */
#define EDIT_BUF_SIZE (((off_t) 1) << S_EDIT_BUF_SIZE)
/* Buffer mask (used to find cursor position relative to the buffer) */
#define M_EDIT_BUF_SIZE (EDIT_BUF_SIZE - 1)
/*
* Configurable: Maximal allowed number of buffers in each buffer array.
* This number can be increased for systems with enough physical memory.
*/
#ifndef MAXBUFF
#define MAXBUFF 1024
#endif
/* Maximal length of file that can be opened */
#define SIZE_LIMIT (EDIT_BUF_SIZE * (MAXBUFF - 2))
/* Initial size of the undo stack, in bytes */
#define START_STACK_SIZE 32
/* Some codes that may be pushed onto or returned from the undo stack */
#define CURS_LEFT 601
#define CURS_RIGHT 602
#define DELCHAR 603
#define BACKSPACE 604
#define STACK_BOTTOM 605
#define CURS_LEFT_LOTS 606
#define CURS_RIGHT_LOTS 607
#define COLUMN_ON 608
#define COLUMN_OFF 609
#define MARK_1 1000
#define MARK_2 700000000
#define KEY_PRESS 1400000000
/* Tabs spaces: (sofar only HALF_TAB_SIZE is used: */
#define TAB_SIZE option_tab_spacing
#define HALF_TAB_SIZE ((int) option_tab_spacing / 2)
/* max count stack files */
#define MAX_HISTORY_MOVETO 50
#define LINE_STATE_WIDTH 8
typedef struct edit_stack_type {
long line;
char *filename;
}edit_stack_type;
struct macro {
short command;
short ch;
};
struct WEdit;
typedef struct WEdit WEdit;
struct Menu;
/* type for file which is currently being edited */
typedef enum {
EDIT_FILE_COMMON = 0,
EDIT_FILE_SYNTAX = 1,
EDIT_FILE_MENU = 2
} edit_current_file_t;
int edit_drop_hotkey_menu (WEdit *e, int key);
void edit_menu_cmd (WEdit *e);
struct WMenu *edit_create_menu (void);
void edit_done_menu (struct WMenu *wmenu);
void edit_reload_menu (void);
void menu_save_mode_cmd (void);
int edit_file (const char *_file, int line);
int edit_translate_key (WEdit *edit, long x_key, int *cmd, int *ch);
int edit_get_byte (WEdit * edit, long byte_index);
char *edit_get_byte_ptr (WEdit * edit, long byte_index);
char *edit_get_buf_ptr (WEdit * edit, long byte_index);
int edit_get_utf (WEdit * edit, long byte_index, int *char_width);
int edit_get_prev_utf (WEdit * edit, long byte_index, int *char_width);
int edit_count_lines (WEdit * edit, long current, int upto);
long edit_move_forward (WEdit * edit, long current, int lines, long upto);
long edit_move_forward3 (WEdit * edit, long current, int cols, long upto);
long edit_move_backward (WEdit * edit, long current, int lines);
void edit_scroll_screen_over_cursor (WEdit * edit);
void edit_render_keypress (WEdit * edit);
void edit_scroll_upward (WEdit * edit, unsigned long i);
void edit_scroll_downward (WEdit * edit, int i);
void edit_scroll_right (WEdit * edit, int i);
void edit_scroll_left (WEdit * edit, int i);
void edit_move_up (WEdit * edit, unsigned long i, int scroll);
void edit_move_down (WEdit * edit, int i, int scroll);
void edit_move_to_prev_col (WEdit *edit, long p);
int edit_get_col (WEdit * edit);
long edit_bol (WEdit * edit, long current);
long edit_eol (WEdit * edit, long current);
void edit_update_curs_row (WEdit * edit);
void edit_update_curs_col (WEdit * edit);
void edit_find_bracket (WEdit * edit);
int edit_reload_line (WEdit *edit, const char *filename, long line);
void edit_block_copy_cmd (WEdit * edit);
void edit_block_move_cmd (WEdit * edit);
int edit_block_delete_cmd (WEdit * edit);
void edit_delete_line (WEdit * edit);
void insert_spaces_tab (WEdit * edit, int half);
int edit_delete (WEdit * edit, const int byte_delete);
void edit_insert (WEdit * edit, int c);
void edit_cursor_move (WEdit * edit, long increment);
void edit_move_block_to_right (WEdit * edit);
void edit_move_block_to_left (WEdit * edit);
void edit_push_action (WEdit * edit, long c, ...);
void edit_push_key_press (WEdit * edit);
void edit_insert_ahead (WEdit * edit, int c);
long edit_write_stream (WEdit * edit, FILE * f);
char *edit_get_write_filter (const char *writename, const char *filename);
int edit_save_confirm_cmd (WEdit * edit);
int edit_save_as_cmd (WEdit * edit);
WEdit *edit_init (WEdit *edit, int lines, int columns,
const char *filename, long line);
int edit_clean (WEdit * edit);
int edit_ok_to_exit (WEdit *edit);
int edit_renew (WEdit * edit);
int edit_new_cmd (WEdit * edit);
int edit_reload (WEdit *edit, const char *filename);
int edit_load_cmd (WEdit * edit, edit_current_file_t what);
void edit_mark_cmd (WEdit * edit, int unmark);
void edit_set_markers (WEdit * edit, long m1, long m2, int c1, int c2);
void edit_push_markers (WEdit * edit);
void edit_replace_cmd (WEdit * edit, int again);
void edit_search_cmd (WEdit * edit, int again);
void edit_complete_word_cmd (WEdit * edit);
void edit_get_match_keyword_cmd (WEdit *edit);
int edit_save_block (WEdit * edit, const char *filename, long start, long finish);
int edit_save_block_cmd (WEdit * edit);
int edit_insert_file_cmd (WEdit * edit);
int edit_insert_file (WEdit * edit, const char *filename);
int edit_load_back_cmd (WEdit * edit);
int edit_load_forward_cmd (WEdit * edit);
void edit_block_process_cmd (WEdit * edit, const char *shell_cmd, int block);
void edit_refresh_cmd (WEdit * edit);
void edit_date_cmd (WEdit * edit);
void edit_goto_cmd (WEdit * edit);
int eval_marks (WEdit * edit, long *start_mark, long *end_mark);
void edit_status (WEdit * edit);
void edit_execute_key_command (WEdit *edit, int command,
int char_for_insertion);
void edit_update_screen (WEdit * edit);
int edit_print_string (WEdit * e, const char *s);
void edit_move_to_line (WEdit * e, long line);
void edit_move_display (WEdit * e, long line);
void edit_word_wrap (WEdit * edit);
int edit_sort_cmd (WEdit * edit);
int edit_ext_cmd (WEdit * edit);
void edit_help_cmd (WEdit * edit);
int edit_save_macro_cmd (WEdit * edit, struct macro macro[], int n);
int edit_load_macro_cmd (WEdit * edit, struct macro macro[], int *n, int k);
void edit_delete_macro_cmd (WEdit * edit);
int edit_copy_to_X_buf_cmd (WEdit * edit);
int edit_cut_to_X_buf_cmd (WEdit * edit);
void edit_paste_from_X_buf_cmd (WEdit * edit);
void edit_select_codepage_cmd (WEdit *edit);
void edit_insert_literal_cmd (WEdit *edit);
void edit_execute_macro_cmd (WEdit *edit);
void edit_begin_end_macro_cmd(WEdit *edit);
void edit_paste_from_history (WEdit *edit);
void edit_set_filename (WEdit *edit, const char *name);
void edit_load_syntax (WEdit * edit, char ***pnames, const char *type);
void edit_free_syntax_rules (WEdit * edit);
void edit_get_syntax_color (WEdit * edit, long byte_index, int *color);
void book_mark_insert (WEdit * edit, int line, int c);
int book_mark_query_color (WEdit * edit, int line, int c);
int book_mark_query_all (WEdit * edit, int line, int *c);
struct _book_mark *book_mark_find (WEdit * edit, int line);
int book_mark_clear (WEdit * edit, int line, int c);
void book_mark_flush (WEdit * edit, int c);
void book_mark_inc (WEdit * edit, int line);
void book_mark_dec (WEdit * edit, int line);
int line_is_blank (WEdit *edit, long line);
int edit_indent_width (WEdit *edit, long p);
void edit_insert_indent (WEdit *edit, int indent);
void edit_options_dialog (void);
void edit_syntax_dialog (void);
void edit_mail_dialog (WEdit *edit);
void format_paragraph (WEdit *edit, int force);
/* either command or char_for_insertion must be passed as -1 */
void edit_execute_cmd (WEdit *edit, int command, int char_for_insertion);
#define get_sys_error(s) (s)
#define edit_error_dialog(h,s) query_dialog (h, s, D_ERROR, 1, _("&Dismiss"))
#define edit_query_dialog2(h,t,a,b) query_dialog (h, t, D_NORMAL, 2, a, b)
#define edit_query_dialog3(h,t,a,b,c) query_dialog (h, t, D_NORMAL, 3, a, b, c)
#define color_palette(x) win->color[x].pixel
#define NUM_SELECTION_HISTORY 64
#ifndef MAX_PATH_LEN
#ifdef PATH_MAX
#define MAX_PATH_LEN PATH_MAX
#else
#define MAX_PATH_LEN 1024
#endif
#endif
/*
what editor are we going to emulate? one of EDIT_KEY_EMULATION_NORMAL
or EDIT_KEY_EMULATION_EMACS
*/
extern int edit_key_emulation;
extern WEdit *wedit;
struct WMenu;
extern struct WMenu *edit_menubar;
extern int option_word_wrap_line_length;
extern int option_typewriter_wrap;
extern int option_auto_para_formatting;
@ -304,49 +49,41 @@ extern int option_backspace_through_tabs;
extern int option_fake_half_tabs;
extern int option_persistent_selections;
extern int option_line_state;
extern int option_line_state_width;
typedef enum {
EDIT_QUICK_SAVE = 0,
EDIT_SAFE_SAVE,
EDIT_DO_BACKUP
} edit_save_mode_t;
extern int option_save_mode;
extern int option_save_position;
extern int option_max_undo;
extern int option_syntax_highlighting;
extern int option_auto_syntax;
extern char *option_syntax_type;
extern int editor_option_check_nl_at_eof;
extern int option_edit_right_extreme;
extern int option_edit_left_extreme;
extern int option_edit_top_extreme;
extern int option_edit_bottom_extreme;
extern const char *option_whole_chars_search;
extern char *option_backup_ext;
/* what editor are we going to emulate? */
extern int edit_key_emulation;
extern int edit_confirm_save;
extern int column_highlighting;
extern int visible_tabs;
extern int visible_tws;
extern int simple_statusbar;
/* used in main() */
void edit_stack_init (void);
void edit_stack_free (void);
/* File names */
int edit_file (const char *_file, int line);
const char *edit_get_file_name (const WEdit *edit);
int edit_get_curs_col (const WEdit *edit);
const char *edit_get_syntax_type (const WEdit *edit);
/* editor home directory */
#define EDIT_DIR ".mc" PATH_SEP_STR "cedit"
#define SYNTAX_FILE EDIT_DIR PATH_SEP_STR "Syntax"
#define CLIP_FILE EDIT_DIR PATH_SEP_STR "cooledit.clip"
#define MACRO_FILE EDIT_DIR PATH_SEP_STR "cooledit.macros"
#define BLOCK_FILE EDIT_DIR PATH_SEP_STR "cooledit.block"
#define TEMP_FILE EDIT_DIR PATH_SEP_STR "cooledit.temp"
#define CEDIT_GLOBAL_MENU "cedit.menu"
#define CEDIT_LOCAL_MENU ".cedit.menu"
#define CEDIT_HOME_MENU ".mc" PATH_SEP_STR "cedit" PATH_SEP_STR "menu"
/* file names */
#define EDIT_SYNTAX_FILE EDIT_DIR PATH_SEP_STR "Syntax"
#define EDIT_CLIP_FILE EDIT_DIR PATH_SEP_STR "cooledit.clip"
#define EDIT_MACRO_FILE EDIT_DIR PATH_SEP_STR "cooledit.macros"
#define EDIT_BLOCK_FILE EDIT_DIR PATH_SEP_STR "cooledit.block"
#define EDIT_TEMP_FILE EDIT_DIR PATH_SEP_STR "cooledit.temp"
#define EDIT_GLOBAL_MENU "cedit.menu"
#define EDIT_LOCAL_MENU ".cedit.menu"
#define EDIT_HOME_MENU EDIT_DIR PATH_SEP_STR "menu"
#endif
#endif /* MC_EDIT_H */

View File

@ -47,7 +47,7 @@
#include "../src/global.h"
#include "../src/history.h"
#include "edit.h"
#include "edit-impl.h"
#include "editlock.h"
#include "editcmddef.h"
#include "edit-widget.h"
@ -545,7 +545,7 @@ static FILE *edit_open_macro_file (const char *r)
gchar *filename;
FILE *fd;
int file;
filename = g_strconcat ( home_dir, PATH_SEP_STR MACRO_FILE, (char *) NULL);
filename = concat_dir_and_file (home_dir, EDIT_MACRO_FILE);
if ((file = open (filename, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)) == -1){
g_free(filename);
return 0;
@ -588,7 +588,7 @@ edit_delete_macro (WEdit * edit, int k)
if (saved_macros_loaded)
if ((j = macro_exists (k)) < 0)
return 0;
tmp = g_strconcat (home_dir, PATH_SEP_STR TEMP_FILE, (char *) NULL);
tmp = concat_dir_and_file (home_dir, EDIT_TEMP_FILE);
g = fopen (tmp , "w");
g_free(tmp);
if (!g) {
@ -620,8 +620,8 @@ edit_delete_macro (WEdit * edit, int k)
}
fclose (f);
fclose (g);
tmp = g_strconcat (home_dir, PATH_SEP_STR TEMP_FILE, (char *) NULL);
tmp2 = g_strconcat (home_dir, PATH_SEP_STR MACRO_FILE, (char *) NULL);
tmp = concat_dir_and_file (home_dir, EDIT_TEMP_FILE);
tmp2 = concat_dir_and_file (home_dir, EDIT_MACRO_FILE);
if (rename ( tmp, tmp2) == -1) {
edit_error_dialog (_(" Delete macro "),
get_sys_error (_(" Cannot overwrite macro file ")));
@ -824,7 +824,7 @@ edit_load_syntax_file (WEdit * edit)
if (dir == 0) {
char *buffer;
buffer = concat_dir_and_file (home_dir, SYNTAX_FILE);
buffer = concat_dir_and_file (home_dir, EDIT_SYNTAX_FILE);
check_for_default (extdir, buffer);
edit_load_file_from_filename (edit, buffer);
g_free (buffer);
@ -847,30 +847,30 @@ edit_load_menu_file (WEdit * edit)
geteuid() ? 2 : 3, _("&Local"), _("&User"), _("&System Wide")
);
menufile = concat_dir_and_file (mc_home, CEDIT_GLOBAL_MENU);
menufile = concat_dir_and_file (mc_home, EDIT_GLOBAL_MENU);
if (!exist_file (menufile)) {
g_free (menufile);
menufile = concat_dir_and_file (mc_home_alt, CEDIT_GLOBAL_MENU);
menufile = concat_dir_and_file (mc_home_alt, EDIT_GLOBAL_MENU);
}
switch (dir) {
case 0:
buffer = g_strdup (CEDIT_LOCAL_MENU);
buffer = g_strdup (EDIT_LOCAL_MENU);
check_for_default (menufile, buffer);
chmod (buffer, 0600);
break;
case 1:
buffer = concat_dir_and_file (home_dir, CEDIT_HOME_MENU);
buffer = concat_dir_and_file (home_dir, EDIT_HOME_MENU);
check_for_default (menufile, buffer);
break;
case 2:
buffer = concat_dir_and_file (mc_home, CEDIT_GLOBAL_MENU);
buffer = concat_dir_and_file (mc_home, EDIT_GLOBAL_MENU);
if (!exist_file (buffer)) {
g_free (buffer);
buffer = concat_dir_and_file (mc_home_alt, CEDIT_GLOBAL_MENU);
buffer = concat_dir_and_file (mc_home_alt, EDIT_GLOBAL_MENU);
}
break;
@ -1705,7 +1705,7 @@ static int edit_save_block_to_clip_file (WEdit * edit, long start, long finish)
{
int ret;
gchar *tmp;
tmp = g_strconcat (home_dir, PATH_SEP_STR CLIP_FILE, (char *) NULL);
tmp = concat_dir_and_file (home_dir, EDIT_CLIP_FILE);
ret = edit_save_block (edit, tmp, start, finish);
g_free(tmp);
return ret;
@ -1748,7 +1748,7 @@ int edit_cut_to_X_buf_cmd (WEdit * edit)
void edit_paste_from_X_buf_cmd (WEdit * edit)
{
gchar *tmp;
tmp = g_strconcat (home_dir, PATH_SEP_STR CLIP_FILE, (char *) NULL);
tmp = concat_dir_and_file (home_dir, EDIT_CLIP_FILE);
edit_insert_file (edit, tmp);
g_free(tmp);
}
@ -1800,9 +1800,11 @@ edit_save_block_cmd (WEdit *edit)
{
long start_mark, end_mark;
char *exp, *tmp;
if (eval_marks (edit, &start_mark, &end_mark))
return 1;
tmp = g_strconcat (home_dir, PATH_SEP_STR CLIP_FILE, (char *) NULL);
tmp = concat_dir_and_file (home_dir, EDIT_CLIP_FILE);
exp =
input_expand_dialog (_(" Save Block "), _(" Enter file name: "),
MC_HISTORY_EDIT_SAVE_BLOCK,
@ -1838,7 +1840,7 @@ edit_insert_file_cmd (WEdit *edit)
gchar *tmp;
char *exp;
tmp = g_strconcat (home_dir, PATH_SEP_STR CLIP_FILE, (char *) NULL);
tmp = concat_dir_and_file (home_dir, EDIT_CLIP_FILE);
exp = input_expand_dialog (_(" Insert File "), _(" Enter file name: "),
MC_HISTORY_EDIT_INSERT_FILE,
tmp);
@ -1877,7 +1879,8 @@ int edit_sort_cmd (WEdit * edit)
edit_error_dialog (_(" Sort block "), _(" You must first highlight a block of text. "));
return 0;
}
tmp = g_strconcat (home_dir, PATH_SEP_STR BLOCK_FILE, (char *) NULL);
tmp = concat_dir_and_file (home_dir, EDIT_BLOCK_FILE);
edit_save_block (edit, tmp, start_mark, end_mark);
g_free(tmp);
@ -1889,7 +1892,8 @@ int edit_sort_cmd (WEdit * edit)
return 1;
g_free (old);
old = exp;
tmp = g_strconcat (" sort ", exp, " ", home_dir, PATH_SEP_STR BLOCK_FILE, " > ", home_dir, PATH_SEP_STR TEMP_FILE, (char *) NULL);
tmp = g_strconcat (" sort ", exp, " ", home_dir, PATH_SEP_STR EDIT_BLOCK_FILE, " > ",
home_dir, PATH_SEP_STR EDIT_TEMP_FILE, (char *) NULL);
e = system (tmp);
g_free(tmp);
if (e) {
@ -1910,7 +1914,7 @@ int edit_sort_cmd (WEdit * edit)
if (edit_block_delete_cmd (edit))
return 1;
tmp = g_strconcat (home_dir, PATH_SEP_STR TEMP_FILE, (char *) NULL);
tmp = concat_dir_and_file (home_dir, EDIT_TEMP_FILE);
edit_insert_file (edit, tmp);
g_free(tmp);
return 0;
@ -1934,7 +1938,7 @@ edit_ext_cmd (WEdit *edit)
if (!exp)
return 1;
tmp = g_strconcat (exp, " > ", home_dir, PATH_SEP_STR TEMP_FILE, (char *) NULL);
tmp = g_strconcat (exp, " > ", home_dir, PATH_SEP_STR EDIT_TEMP_FILE, (char *) NULL);
e = system (tmp);
g_free(tmp);
g_free (exp);
@ -1946,7 +1950,7 @@ edit_ext_cmd (WEdit *edit)
}
edit->force |= REDRAW_COMPLETELY;
tmp = g_strconcat (home_dir, PATH_SEP_STR TEMP_FILE, (char *) NULL);
tmp = concat_dir_and_file (home_dir, EDIT_TEMP_FILE);
edit_insert_file (edit, tmp);
g_free(tmp);
return 0;
@ -1968,7 +1972,7 @@ edit_block_process_cmd (WEdit *edit, const char *shell_cmd, int block)
o = g_strconcat (mc_home, shell_cmd, (char *) NULL); /* original source script */
h = g_strconcat (home_dir, PATH_SEP_STR EDIT_DIR, shell_cmd, (char *) NULL); /* home script */
b = g_strconcat (home_dir, PATH_SEP_STR BLOCK_FILE, (char *) NULL); /* block file */
b = concat_dir_and_file (home_dir, EDIT_BLOCK_FILE); /* block file */
if (!(script_home = fopen (h, "r"))) {
if (!(script_home = fopen (h, "w"))) {
@ -2023,7 +2027,7 @@ edit_block_process_cmd (WEdit *edit, const char *shell_cmd, int block)
* (for compatibility with old scripts).
*/
tmp = g_strconcat (" ", home_dir, PATH_SEP_STR EDIT_DIR, shell_cmd, " ", quoted_name,
" ", home_dir, PATH_SEP_STR BLOCK_FILE " /dev/null", (char *) NULL);
" ", home_dir, PATH_SEP_STR EDIT_BLOCK_FILE " /dev/null", (char *) NULL);
system (tmp);
g_free(tmp);
} else {

View File

@ -42,7 +42,7 @@
#include "../src/global.h"
#include "edit.h"
#include "edit-impl.h"
#include "edit-widget.h"
#define MAX_LINE_LEN 1024

View File

@ -41,7 +41,7 @@
#include "../src/global.h"
#include "edit.h"
#include "edit-impl.h"
#include "edit-widget.h" /* edit->macro_i */
#include "editcmd_dialogs.h"
#include "editcmddef.h" /* list of commands */

View File

@ -55,7 +55,7 @@
#include "../src/global.h"
#include "edit.h"
#include "edit-impl.h"
#include "editlock.h"
#include "../src/wtools.h" /* edit_query_dialog () */

View File

@ -44,7 +44,7 @@
#include "../src/global.h"
#include "edit.h"
#include "edit-impl.h"
#include "../src/cmd.h"
#include "../src/wtools.h" /* query_dialog() */
#include "../src/menu.h" /* menu_entry */

View File

@ -44,7 +44,7 @@
#include "../src/global.h"
#include "edit.h"
#include "edit-impl.h"
#include "usermap.h"
#include "../src/dialog.h" /* B_CANCEL */
#include "../src/wtools.h" /* QuickDialog */

View File

@ -43,7 +43,7 @@
#include "../src/global.h"
#include "edit.h"
#include "edit-impl.h"
#include "edit-widget.h"
#include "../src/tty.h" /* LINES */
@ -216,6 +216,12 @@ edit_file (const char *_file, int line)
return 1;
}
const char *
edit_get_file_name (const WEdit *edit)
{
return edit->filename;
}
static void edit_my_define (Dlg_head * h, int idx, const char *text,
void (*fn) (WEdit *), WEdit * edit)
{

View File

@ -47,7 +47,7 @@
#include "../src/global.h"
#include "edit.h"
#include "edit-impl.h"
#include "edit-widget.h"
#include "../src/color.h" /* use_colors */
#include "../src/main.h" /* mc_home */
@ -1186,7 +1186,7 @@ edit_load_syntax (WEdit *edit, char ***pnames, const char *type)
if (!*edit->filename && !type)
return;
}
f = concat_dir_and_file (home_dir, SYNTAX_FILE);
f = concat_dir_and_file (home_dir, EDIT_SYNTAX_FILE);
r = edit_read_syntax_file (edit, pnames, f, edit ? edit->filename : 0,
get_first_editor_line (edit), type);
if (r == -1) {
@ -1205,3 +1205,9 @@ edit_load_syntax (WEdit *edit, char ***pnames, const char *type)
}
g_free (f);
}
const char *
edit_get_syntax_type (const WEdit *edit)
{
return edit->syntax_type;
}

View File

@ -38,7 +38,7 @@
#include "../src/global.h"
#include "edit.h"
#include "edit-impl.h"
#include "edit-widget.h"
#include "editcmddef.h" /* list of commands */
#include "usermap.h"

View File

@ -10,9 +10,9 @@
#define MC_USERMAP ".mc/cedit/cooledit.bindings"
#include "edit.h"
#include "edit-impl.h"
/* load user map */
gboolean edit_load_user_map(WEdit *);
gboolean edit_load_user_map (WEdit *edit);
#endif

View File

@ -41,7 +41,7 @@
#include "../src/global.h"
#include "edit.h"
#include "edit-impl.h"
#include "edit-widget.h"
#define tab_width option_tab_spacing

View File

@ -295,11 +295,6 @@ char *mc_home_alt = NULL;
char cmd_buf[512];
#ifdef USE_INTERNAL_EDIT
int edit_stack_iterator = 0;
struct edit_stack_type edit_history_moveto[MAX_HISTORY_MOVETO];
#endif
static void
reload_panelized (WPanel *panel)
{
@ -2152,8 +2147,6 @@ main (int argc, char *argv[])
char *mc_dir;
/* We had LC_CTYPE before, LC_ALL includs LC_TYPE as well */
int i;
setlocale (LC_ALL, "");
bindtextdomain ("mc", LOCALEDIR);
textdomain ("mc");
@ -2175,10 +2168,7 @@ main (int argc, char *argv[])
vfs_init ();
#ifdef USE_INTERNAL_EDIT
for ( i = 0; i < MAX_HISTORY_MOVETO; i++ ) {
edit_history_moveto[i].filename = NULL;
edit_history_moveto[i].line = -1;
}
edit_stack_init ();
#endif
#ifdef HAVE_SLANG
@ -2315,9 +2305,7 @@ main (int argc, char *argv[])
g_free (other_dir);
#ifdef USE_INTERNAL_EDIT
for ( i = 0; i < MAX_HISTORY_MOVETO; i++ ) {
g_free(edit_history_moveto[i].filename);
}
edit_stack_free ();
#endif
return 0;

View File

@ -10,10 +10,6 @@
#include "panel.h"
#include "widget.h"
#ifdef USE_INTERNAL_EDIT
#include "../edit/edit.h"
#endif
/* Toggling functions */
void toggle_fast_reload (void);
void toggle_mix_all_files (void);
@ -47,11 +43,6 @@ extern int mou_auto_repeat;
extern char *other_dir;
extern int mouse_move_pages;
#ifdef USE_INTERNAL_EDIT
extern int edit_stack_iterator;
struct edit_stack_type edit_history_moveto[MAX_HISTORY_MOVETO];
#endif
#ifdef HAVE_CHARSET
extern int source_codepage;
extern int display_codepage;

View File

@ -42,7 +42,6 @@
#include "../src/search/search.h"
#include "../edit/edit.h" /* BLOCK_FILE */
#include "../edit/edit-widget.h" /* WEdit */
/* For the simple listbox manager */
#include "dialog.h"
@ -176,11 +175,11 @@ strip_ext(char *ss)
}
char *
expand_format (struct WEdit *edit_widget, char c, int quote)
expand_format (WEdit *edit_widget, char c, int quote)
{
WPanel *panel = NULL;
char *(*quote_func) (const char *, int);
char *fname;
char *fname = NULL;
char *result;
char c_lc;
@ -188,7 +187,7 @@ expand_format (struct WEdit *edit_widget, char c, int quote)
return g_strdup ("%");
if (edit_one_file != NULL)
fname = edit_widget->filename;
fname = str_unconst (edit_get_file_name (edit_widget));
else {
if (g_ascii_islower ((gchar) c))
panel = current_panel;
@ -233,16 +232,19 @@ expand_format (struct WEdit *edit_widget, char c, int quote)
}
case 'i': /* indent equal number cursor position in line */
if (edit_widget)
return g_strnfill (edit_widget->curs_col, ' ');
return g_strnfill (edit_get_curs_col (edit_widget), ' ');
break;
case 'y': /* syntax type */
if (edit_widget && edit_widget->syntax_type)
return g_strdup (edit_widget->syntax_type);
if (edit_widget) {
const char *syntax_type = edit_get_syntax_type (edit_widget);
if (syntax_type != NULL)
return g_strdup (syntax_type);
}
break;
case 'k': /* block file name */
case 'b': /* block file name / strip extension */ {
if (edit_widget) {
char *file = g_strconcat (home_dir, PATH_SEP_STR BLOCK_FILE, (char *) NULL);
char *file = concat_dir_and_file (home_dir, EDIT_BLOCK_FILE);
fname = (*quote_func) (file, 0);
g_free (file);
return fname;
@ -429,10 +431,12 @@ static char *test_condition (WEdit *edit_widget, char *p, int *condition)
*condition = panel && mc_search (arg, panel->dir.list [panel->selected].fname, MC_SEARCH_T_GLOB);
break;
case 'y': /* syntax pattern */
if (edit_widget && edit_widget->syntax_type) {
if (edit_widget) {
const char *syntax_type = edit_get_syntax_type (edit_widget);
if (syntax_type != NULL) {
p = extract_arg (p, arg, sizeof (arg));
*condition = panel &&
mc_search (arg, edit_widget->syntax_type, MC_SEARCH_T_NORMAL);
*condition = panel && mc_search (arg, syntax_type, MC_SEARCH_T_NORMAL);
}
}
break;
case 'd':
@ -715,7 +719,7 @@ menu_file_own(char* path)
* otherwise we are called from the mcedit menu.
*/
void
user_menu_cmd (struct WEdit *edit_widget)
user_menu_cmd (WEdit *edit_widget)
{
char *p;
char *data, **entries;
@ -730,19 +734,19 @@ user_menu_cmd (struct WEdit *edit_widget)
return;
}
menu = g_strdup (edit_widget ? CEDIT_LOCAL_MENU : MC_LOCAL_MENU);
menu = g_strdup (edit_widget ? EDIT_LOCAL_MENU : MC_LOCAL_MENU);
if (!exist_file (menu) || !menu_file_own (menu)){
g_free (menu);
menu = concat_dir_and_file \
(home_dir, edit_widget ? CEDIT_HOME_MENU : MC_HOME_MENU);
menu = concat_dir_and_file
(home_dir, edit_widget ? EDIT_HOME_MENU : MC_HOME_MENU);
if (!exist_file (menu)){
g_free (menu);
menu = concat_dir_and_file \
(mc_home, edit_widget ? CEDIT_GLOBAL_MENU : MC_GLOBAL_MENU);
menu = concat_dir_and_file
(mc_home, edit_widget ? EDIT_GLOBAL_MENU : MC_GLOBAL_MENU);
if (!exist_file (menu)) {
g_free (menu);
menu = concat_dir_and_file \
(mc_home_alt, edit_widget ? CEDIT_GLOBAL_MENU : MC_GLOBAL_MENU);
menu = concat_dir_and_file
(mc_home_alt, edit_widget ? EDIT_GLOBAL_MENU : MC_GLOBAL_MENU);
}
}
}

View File

@ -6,10 +6,10 @@
#ifndef MC_USER_H
#define MC_USER_H
#include "../edit/edit-widget.h"
#include "../edit/edit.h"
void user_menu_cmd (struct WEdit *edit_widget);
char *expand_format (struct WEdit *edit_widget, char c, int quote);
void user_menu_cmd (WEdit *edit_widget);
char *expand_format (WEdit *edit_widget, char c, int quote);
int check_format_view (const char *);
int check_format_var (const char *, char **);
int check_format_cd (const char *);