From c8bd032113ccc670e3acfaf2ee19009156e58718 Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Wed, 7 Jul 2010 13:50:03 +0400 Subject: [PATCH] Ticket #2035: added "Toggle syntax highlighting" menu item. Added "Toggle syntax highlighting" menu item. Described C-s shortcut in mcedit man page. Signed-off-by: Andrew Borodin --- doc/man/mcedit.1.in | 2 ++ src/editor/edit.c | 3 ++- src/editor/editmenu.c | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/doc/man/mcedit.1.in b/doc/man/mcedit.1.in index 885472e92..38a9c3416 100644 --- a/doc/man/mcedit.1.in +++ b/doc/man/mcedit.1.in @@ -369,6 +369,8 @@ A useful hint is to work with as much as possible with the things you can do rather than try to do things that this implementation cannot deal with. Also remember that the aim of syntax highlighting is to make programming less prone to error, not to make code look pretty. +.PP +The syntax highlighting can be toggled using Ctrl\-s shortcut. .SH COLORS The default colors may be changed by appending to the .B MC_COLOR_TABLE diff --git a/src/editor/edit.c b/src/editor/edit.c index 6030654b4..9e5831c01 100644 --- a/src/editor/edit.c +++ b/src/editor/edit.c @@ -3469,7 +3469,8 @@ edit_execute_cmd (WEdit * edit, unsigned long command, int char_for_insertion) break; case CK_Toggle_Syntax: - if ((option_syntax_highlighting ^= 1) == 1) + option_syntax_highlighting ^= 1; + if (option_syntax_highlighting == 1) edit_load_syntax (edit, NULL, edit->syntax_type); edit->force |= REDRAW_PAGE; break; diff --git a/src/editor/editmenu.c b/src/editor/editmenu.c index 8f86e92fd..23f073342 100644 --- a/src/editor/editmenu.c +++ b/src/editor/editmenu.c @@ -131,6 +131,8 @@ create_command_menu (void) g_list_append (entries, menu_entry_create (_("&Toggle line state"), CK_Toggle_Line_State)); entries = g_list_append (entries, menu_entry_create (_("Go to matching &bracket"), CK_Match_Bracket)); + entries = + g_list_append (entries, menu_entry_create (_("Toggle s&yntax highlighting"), CK_Toggle_Syntax)); entries = g_list_append (entries, menu_separator_create ()); entries = g_list_append (entries, menu_entry_create (_("&Find declaration"), CK_Find_Definition));