mirror of
https://github.com/MidnightCommander/mc
synced 2025-03-29 19:22:56 +03:00
editdraw.c, editmenu, editcmd.c: highlighting for Pascal
Added column text highlighting added. and block movements.
This commit is contained in:
parent
5d477ec6a3
commit
3cc82b6f4a
50
edit/edit.c
50
edit/edit.c
@ -264,11 +264,14 @@ WEdit *edit_init (WEdit * edit, int lines, int columns, const char *filename, co
|
||||
return 0;
|
||||
}
|
||||
edit->total_lines = edit_count_lines (edit, 0, edit->last_byte);
|
||||
#ifndef GTK
|
||||
/* *** */
|
||||
edit_load_syntax (edit, 0, 0);
|
||||
{
|
||||
int fg, bg;
|
||||
edit_get_syntax_color (edit, -1, &fg, &bg);
|
||||
}
|
||||
#endif
|
||||
return edit;
|
||||
}
|
||||
|
||||
@ -278,7 +281,10 @@ int edit_clean (WEdit * edit)
|
||||
{
|
||||
if (edit) {
|
||||
int j = 0;
|
||||
#ifndef GTK
|
||||
/* *** */
|
||||
edit_free_syntax_rules (edit);
|
||||
#endif
|
||||
for (; j <= MAXBUFF; j++) {
|
||||
if (edit->buffers1[j] != NULL)
|
||||
free (edit->buffers1[j]);
|
||||
@ -1387,6 +1393,7 @@ static void edit_left_delete_word (WEdit * edit)
|
||||
} while (my_type_of (c) == my_type_of (edit_get_byte (edit, edit->curs1 - 1)));
|
||||
}
|
||||
|
||||
extern int column_highlighting;
|
||||
|
||||
/*
|
||||
the start column position is not recorded, and hence does not
|
||||
@ -1415,6 +1422,12 @@ void edit_do_undo (WEdit * edit)
|
||||
case DELETE:
|
||||
edit_delete (edit);
|
||||
break;
|
||||
case COLUMN_ON:
|
||||
column_highlighting = 1;
|
||||
break;
|
||||
case COLUMN_OFF:
|
||||
column_highlighting = 0;
|
||||
break;
|
||||
}
|
||||
if (ac >= 256 && ac < 512)
|
||||
edit_insert_ahead (edit, ac - 256);
|
||||
@ -1423,8 +1436,10 @@ void edit_do_undo (WEdit * edit)
|
||||
|
||||
if (ac >= MARK_1 - 2 && ac < MARK_2 - 2) {
|
||||
edit->mark1 = ac - MARK_1;
|
||||
edit->column1 = edit_move_forward3 (edit, edit_bol (edit, edit->mark1), 0, edit->mark1);
|
||||
} else if (ac >= MARK_2 - 2 && ac < KEY_PRESS) {
|
||||
edit->mark2 = ac - MARK_2;
|
||||
edit->column2 = edit_move_forward3 (edit, edit_bol (edit, edit->mark2), 0, edit->mark2);
|
||||
}
|
||||
if (count++)
|
||||
edit->force |= REDRAW_PAGE; /* more than one pop usually means something big */
|
||||
@ -1438,9 +1453,9 @@ void edit_do_undo (WEdit * edit)
|
||||
edit->force |= REDRAW_PAGE;
|
||||
}
|
||||
edit->start_display = ac - KEY_PRESS; /* see push and pop above */
|
||||
edit_update_curs_row(edit);
|
||||
edit_update_curs_row (edit);
|
||||
|
||||
done_undo:;
|
||||
done_undo:;
|
||||
push_action_disabled = 0;
|
||||
}
|
||||
|
||||
@ -1741,6 +1756,14 @@ void edit_set_user_command (void (*func) (WEdit *, int))
|
||||
|
||||
void edit_mail_dialog (WEdit * edit);
|
||||
|
||||
#ifdef GTK
|
||||
/* *** */
|
||||
void format_paragraph (WEdit * edit, int x)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
This executes a command at a lower level than macro recording.
|
||||
It also does not push a key_press onto the undo stack. This means
|
||||
@ -1971,14 +1994,32 @@ int edit_execute_cmd (WEdit * edit, int command, int char_for_insertion)
|
||||
case CK_Toggle_Insert:
|
||||
edit->overwrite = (edit->overwrite == 0);
|
||||
#ifndef MIDNIGHT
|
||||
#ifdef GTK
|
||||
/* *** */
|
||||
#else
|
||||
CSetCursorColor (edit->overwrite ? color_palette (24) : color_palette (19));
|
||||
#endif
|
||||
#endif
|
||||
break;
|
||||
|
||||
case CK_Mark:
|
||||
if (edit->mark2 >= 0) {
|
||||
if (column_highlighting)
|
||||
edit_push_action (edit, COLUMN_ON);
|
||||
column_highlighting = 0;
|
||||
}
|
||||
edit_mark_cmd (edit, 0);
|
||||
break;
|
||||
case CK_Column_Mark:
|
||||
if (!column_highlighting)
|
||||
edit_push_action (edit, COLUMN_OFF);
|
||||
column_highlighting = 1;
|
||||
edit_mark_cmd (edit, 0);
|
||||
break;
|
||||
case CK_Unmark:
|
||||
if (column_highlighting)
|
||||
edit_push_action (edit, COLUMN_ON);
|
||||
column_highlighting = 0;
|
||||
edit_mark_cmd (edit, 1);
|
||||
break;
|
||||
|
||||
@ -2016,6 +2057,7 @@ int edit_execute_cmd (WEdit * edit, int command, int char_for_insertion)
|
||||
|
||||
case CK_Save_As:
|
||||
#ifndef MIDNIGHT
|
||||
/* if (COptionsOf (edit->widget) & EDITOR_NO_FILE) */
|
||||
if (edit->widget->options & EDITOR_NO_FILE)
|
||||
break;
|
||||
#endif
|
||||
@ -2023,14 +2065,14 @@ int edit_execute_cmd (WEdit * edit, int command, int char_for_insertion)
|
||||
break;
|
||||
case CK_Save:
|
||||
#ifndef MIDNIGHT
|
||||
if (edit->widget->options & EDITOR_NO_FILE)
|
||||
if (COptionsOf (edit->widget) & EDITOR_NO_FILE)
|
||||
break;
|
||||
#endif
|
||||
edit_save_confirm_cmd (edit);
|
||||
break;
|
||||
case CK_Load:
|
||||
#ifndef MIDNIGHT
|
||||
if (edit->widget->options & EDITOR_NO_FILE)
|
||||
if (COptionsOf (edit->widget) & EDITOR_NO_FILE)
|
||||
break;
|
||||
#endif
|
||||
edit_load_cmd (edit);
|
||||
|
40
edit/edit.h
40
edit/edit.h
@ -14,7 +14,7 @@
|
||||
# include <unistd.h>
|
||||
# endif
|
||||
# include <string.h>
|
||||
# include "../src/tty.h"
|
||||
# include "src/tty.h"
|
||||
# include <sys/stat.h>
|
||||
# include <errno.h>
|
||||
|
||||
@ -75,21 +75,21 @@
|
||||
|
||||
#else
|
||||
|
||||
# include "../src/main.h" /* for char *shell */
|
||||
# include "../src/mad.h"
|
||||
# include "../src/dlg.h"
|
||||
# include "../src/widget.h"
|
||||
# include "../src/color.h"
|
||||
# include "../src/dialog.h"
|
||||
# include "../src/mouse.h"
|
||||
# include "../src/global.h"
|
||||
# include "../src/help.h"
|
||||
# include "../src/key.h"
|
||||
# include "../src/wtools.h" /* for QuickWidgets */
|
||||
# include "../src/win.h"
|
||||
# include "../vfs/vfs.h"
|
||||
# include "../src/menu.h"
|
||||
# include "../src/regex.h"
|
||||
# include "src/main.h" /* for char *shell */
|
||||
# include "src/mad.h"
|
||||
# include "src/dlg.h"
|
||||
# include "src/widget.h"
|
||||
# include "src/color.h"
|
||||
# include "src/dialog.h"
|
||||
# include "src/mouse.h"
|
||||
# include "src/global.h"
|
||||
# include "src/help.h"
|
||||
# include "src/key.h"
|
||||
# include "src/wtools.h" /* for QuickWidgets */
|
||||
# include "src/win.h"
|
||||
# include "vfs/vfs.h"
|
||||
# include "src/menu.h"
|
||||
# include "src/regex.h"
|
||||
# define WANT_WIDGETS
|
||||
|
||||
# define WIDGET_COMMAND (WIDGET_USER + 10)
|
||||
@ -178,6 +178,8 @@
|
||||
#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
|
||||
@ -335,7 +337,7 @@ void edit_change_directory (void);
|
||||
int edit_man_page_cmd (WEdit * edit);
|
||||
void edit_search_replace_dialog (Window parent, int x, int y, char **search_text, char **replace_text, char **arg_order, char *heading, int option);
|
||||
void edit_search_dialog (WEdit * edit, char **search_text);
|
||||
long edit_find (long search_start, unsigned char *exp, int *len, long last_byte, int (*get_byte) (void *, long), void *data);
|
||||
long edit_find (long search_start, unsigned char *expr, int *len, long last_byte, int (*get_byte) (void *, long), void *data);
|
||||
void edit_set_foreground_colors (unsigned long normal, unsigned long bold, unsigned long italic);
|
||||
void edit_set_background_colors (unsigned long normal, unsigned long abnormal, unsigned long marked, unsigned long marked_abnormal, unsigned long highlighted);
|
||||
void edit_set_cursor_color (unsigned long c);
|
||||
@ -473,8 +475,8 @@ void edit_get_syntax_color (WEdit * edit, long byte_index, int *fg, int *bg);
|
||||
# define mkdir(s,m) mc_mkdir(s,m)
|
||||
# define itoa MY_itoa
|
||||
|
||||
# define edit_get_load_file(d,f,h) input_dialog (h, _(" Enter file name: "), f)
|
||||
# define edit_get_save_file(d,f,h) input_dialog (h, _(" Enter file name: "), f)
|
||||
# define edit_get_load_file(d,f,h) input_dialog (h, " Enter file name: ", f)
|
||||
# define edit_get_save_file(d,f,h) input_dialog (h, " Enter file name: ", f)
|
||||
# define CMalloc(x) malloc(x)
|
||||
|
||||
# define set_error_msg(s) edit_init_error_msg = strdup(s)
|
||||
|
@ -1,3 +1,10 @@
|
||||
Wed Jul 15 00:41:01 1998 Paul Sheer <psheer@obsidian.co.za>
|
||||
|
||||
* edit.c, editwidget.c, * syntax.c: Syntax
|
||||
editdraw.c, editmenu, editcmd.c: highlighting for Pascal
|
||||
Added column text highlighting added.
|
||||
and block movements.
|
||||
|
||||
1998-07-04 Carsten Schaar <nhadcasc@fs-maphy.uni-hannover.de>
|
||||
|
||||
* main.c (main): 'session_management_setup' will be called after
|
||||
|
Loading…
x
Reference in New Issue
Block a user