rpms/mc/devel mc-cedit-configurable-highlight.patch, NONE, 1.1 mc-utf8.patch, 1.28, 1.29 mc.spec, 1.136, 1.137
Jindrich Novy
jnovy at fedoraproject.org
Thu Oct 23 13:24:01 UTC 2008
Author: jnovy
Update of /cvs/pkgs/rpms/mc/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv10207
Modified Files:
mc-utf8.patch mc.spec
Added Files:
mc-cedit-configurable-highlight.patch
Log Message:
* Thu Oct 23 2008 Jindrich Novy <jnovy at redhat.com> 4.6.2-7.pre1
- allow switching of trailing spaces/tab highlighting with crtl-v,
patch from Jan Engelhardt (#464738)
- update the UTF-8 patch accordingly
mc-cedit-configurable-highlight.patch:
--- NEW FILE mc-cedit-configurable-highlight.patch ---
Move syntax highlighting options into their own menu, and make TAB and
Whitespace highlighting selectable.
Signed-off-by: Jan Engelhardt <jengelh at computergmbh.de>
---
edit/edit.c | 6 ++
edit/edit.h | 7 ++
edit/editcmddef.h | 1
edit/editdraw.c | 4 +
edit/editkeys.c | 1
edit/editmenu.c | 6 ++
edit/editoptions.c | 141 ++++++++++++++++++++++++++++++++++++++++-------------
src/setup.c | 1
8 files changed, 133 insertions(+), 34 deletions(-)
Index: mc/edit/edit.c
===================================================================
--- mc.orig/edit/edit.c
+++ mc/edit/edit.c
@@ -2487,6 +2487,12 @@ edit_execute_cmd (WEdit *edit, int comma
edit->force |= REDRAW_PAGE;
break;
+ case CK_Toggle_Syntax2:
+ ++option_highlighting;
+ option_highlighting %= 4;
+ edit->force |= REDRAW_PAGE;
+ break;
+
case CK_Find:
edit_search_cmd (edit, 0);
break;
Index: mc/edit/edit.h
===================================================================
--- mc.orig/edit/edit.h
+++ mc/edit/edit.h
@@ -228,6 +228,7 @@ int line_is_blank (WEdit *edit, long lin
int edit_indent_width (WEdit *edit, long p);
void edit_insert_indent (WEdit *edit, int indent);
void edit_options_dialog (void);
+void edit_syntax_opt_dialog(void);
void edit_syntax_dialog (void);
void edit_mail_dialog (WEdit *edit);
void format_paragraph (WEdit *edit, int force);
@@ -279,10 +280,16 @@ typedef enum {
EDIT_DO_BACKUP
} edit_save_mode_t;
+enum {
+ HL_WHITESPACE = 1 << 0,
+ HL_TABS = 1 << 1,
+};
+
extern int option_save_mode;
extern int option_save_position;
extern int option_max_undo;
extern int option_syntax_highlighting;
+extern unsigned int option_highlighting;
extern int option_auto_syntax;
extern char *option_syntax_type;
extern int editor_option_check_nl_at_eof;
Index: mc/edit/editcmddef.h
===================================================================
--- mc.orig/edit/editcmddef.h
+++ mc/edit/editcmddef.h
@@ -109,6 +109,7 @@
#define CK_Maximize 458
#define CK_Toggle_Syntax 480
+#define CK_Toggle_Syntax2 481
/* macro */
#define CK_Begin_Record_Macro 501
Index: mc/edit/editdraw.c
===================================================================
--- mc.orig/edit/editdraw.c
+++ mc/edit/editdraw.c
@@ -273,7 +273,9 @@ print_to_widget (WEdit *edit, long row,
}
}
-int visible_tabs = 1, visible_tws = 1;
+unsigned int option_highlighting = HL_TABS | HL_WHITESPACE;
+#define visible_tabs (option_highlighting & HL_TABS)
+#define visible_tws (option_highlighting & HL_WHITESPACE)
/* b is a pointer to the beginning of the line */
static void
Index: mc/edit/editkeys.c
===================================================================
--- mc.orig/edit/editkeys.c
+++ mc/edit/editkeys.c
@@ -114,6 +114,7 @@ static const edit_key_map_type common_ke
{ XCTRL ('l'), CK_Refresh },
{ XCTRL ('o'), CK_Shell },
{ XCTRL ('s'), CK_Toggle_Syntax },
+ { XCTRL ('v'), CK_Toggle_Syntax2 },
{ XCTRL ('u'), CK_Undo },
{ XCTRL ('t'), CK_Select_Codepage },
{ XCTRL ('q'), CK_Insert_Literal },
Index: mc/edit/editmenu.c
===================================================================
--- mc.orig/edit/editmenu.c
+++ mc/edit/editmenu.c
@@ -283,6 +283,11 @@ menu_options (void)
edit_options_dialog ();
}
+static void menu_syntax_options(void)
+{
+ edit_syntax_opt_dialog();
+}
+
static void
menu_syntax (void)
{
@@ -410,6 +415,7 @@ static menu_entry CmdMenuEmacs[] =
static menu_entry OptMenu[] =
{
{' ', N_("&General... "), 'G', menu_options},
+ {' ', N_("Highlight options... "), ' ', menu_syntax_options},
{' ', N_("&Save mode..."), 'S', menu_save_mode_cmd},
{' ', N_("Learn &Keys..."), 'K', learn_keys},
{' ', N_("Syntax &Highlighting..."), 'H', menu_syntax},
Index: mc/edit/editoptions.c
===================================================================
--- mc.orig/edit/editoptions.c
+++ mc/edit/editoptions.c
@@ -43,9 +43,6 @@
#include "../src/dialog.h" /* B_CANCEL */
#include "../src/wtools.h" /* QuickDialog */
-#define OPT_DLG_H 17
-#define OPT_DLG_W 72
-
#ifndef USE_INTERNAL_EDIT
#define USE_INTERNAL_EDIT 1
#endif
@@ -65,12 +62,98 @@ i18n_translate_array (const char *array[
}
}
+#define OPT_DLG_H 12
+#define OPT_DLG_W 40
+void edit_syntax_opt_dialog(void)
+{
+ int f_syntax_hl = option_syntax_highlighting;
+ int f_tab_hl = option_highlighting & HL_TABS;
+ int f_ws_hl = option_highlighting & HL_WHITESPACE;
+
+ int old_syntax_hl = f_syntax_hl;
+
+ QuickWidget quick_widgets[] = {
+ {
+ .widget_type = quick_button,
+ .relative_x = 6,
+ .x_divisions = 10,
+ .relative_y = OPT_DLG_H - 3,
+ .y_divisions = OPT_DLG_H,
+ .text = N_("&Cancel"),
+ .value = B_CANCEL,
+ },
+ {
+ .widget_type = quick_button,
+ .relative_x = 2,
+ .x_divisions = 10,
+ .relative_y = OPT_DLG_H - 3,
+ .y_divisions = OPT_DLG_H,
+ .text = N_("&OK"),
+ .value = B_ENTER,
+ },
+ {
+ .widget_type = quick_checkbox,
+ .relative_x = 6,
+ .x_divisions = OPT_DLG_W,
+ .relative_y = 6,
+ .y_divisions = OPT_DLG_H,
+ .text = N_("Whitespace highlighting"),
+ .result = &f_ws_hl,
+ },
+ {
+ .widget_type = quick_checkbox,
+ .relative_x = 6,
+ .x_divisions = OPT_DLG_W,
+ .relative_y = 5,
+ .y_divisions = OPT_DLG_H,
+ .text = N_("Tab highlighting"),
+ .result = &f_tab_hl,
+ },
+ {
+ .widget_type = quick_checkbox,
+ .relative_x = 6,
+ .x_divisions = OPT_DLG_W,
+ .relative_y = 4,
+ .y_divisions = OPT_DLG_H,
+ .text = N_("Syntax highlighting"),
+ .result = &f_syntax_hl,
+ },
+ NULL_QuickWidget,
+ };
+ QuickDialog quick_options = {
+ .xlen = OPT_DLG_W,
+ .ylen = OPT_DLG_H,
+ .xpos = -1,
+ .ypos = 0,
+ .title = N_(" Syntax options "),
+ .help = "",
+ .widgets = quick_widgets,
+ };
+
+ if (quick_dialog(&quick_options) == B_CANCEL)
+ return;
+
+ if (old_syntax_hl != f_syntax_hl)
+ /* Load or unload syntax rules if the option has changed */
+ edit_load_syntax(wedit, NULL, option_syntax_type);
+
+ option_syntax_highlighting = f_syntax_hl;
+ option_highlighting = 0;
+ if (f_tab_hl)
+ option_highlighting |= HL_TABS;
+ if (f_ws_hl)
+ option_highlighting |= HL_WHITESPACE;
+}
+#undef OPT_DLG_H
+#undef OPT_DLG_W
+
+#define OPT_DLG_H 17
+#define OPT_DLG_W 72
void
edit_options_dialog (void)
{
char wrap_length[32], tab_spacing[32], *p, *q;
int wrap_mode = 0;
- int old_syntax_hl;
int tedit_key_emulation = edit_key_emulation;
int toption_fill_tabs_with_spaces = option_fill_tabs_with_spaces;
int toption_save_position = option_save_position;
@@ -102,37 +185,34 @@ edit_options_dialog (void)
OPT_DLG_H, "", OPT_DLG_W / 2 - 4 - 24, 0, 0, 0,
"edit-tab-spacing"},
/* 6 */
- {quick_checkbox, OPT_DLG_W / 2 + 1, OPT_DLG_W, OPT_DLG_H - 8,
- OPT_DLG_H, N_("Synta&x highlighting"), 8, 0, 0, 0, NULL},
- /* 7 */
{quick_checkbox, OPT_DLG_W / 2 + 1, OPT_DLG_W, OPT_DLG_H - 9,
OPT_DLG_H, N_("Save file &position"), 0, 0, 0, 0, NULL},
- /* 8 */
+ /* 7 */
{quick_checkbox, OPT_DLG_W / 2 + 1, OPT_DLG_W, OPT_DLG_H - 10,
OPT_DLG_H, N_("Confir&m before saving"), 6, 0, 0, 0, NULL},
- /* 9 */
+ /* 8 */
{quick_checkbox, OPT_DLG_W / 2 + 1, OPT_DLG_W, OPT_DLG_H - 11,
OPT_DLG_H, N_("Fill tabs with &spaces"), 0, 0, 0, 0, NULL},
- /* 10 */
+ /* 9 */
{quick_checkbox, OPT_DLG_W / 2 + 1, OPT_DLG_W, OPT_DLG_H - 12,
OPT_DLG_H, N_("&Return does autoindent"), 0, 0, 0, 0, NULL},
- /* 11 */
+ /* 10 */
{quick_checkbox, OPT_DLG_W / 2 + 1, OPT_DLG_W, OPT_DLG_H - 13,
OPT_DLG_H, N_("&Backspace through tabs"), 0, 0, 0, 0, NULL},
- /* 12 */
+ /* 11 */
{quick_checkbox, OPT_DLG_W / 2 + 1, OPT_DLG_W, OPT_DLG_H - 14,
OPT_DLG_H, N_("&Fake half tabs"), 0, 0, 0, 0, NULL},
- /* 13 */
+ /* 12 */
{quick_radio, 5, OPT_DLG_W, OPT_DLG_H - 7, OPT_DLG_H, "", 3, 0, 0,
const_cast(char **, wrap_str), "wrapm"},
- /* 14 */
+ /* 13 */
{quick_label, 4, OPT_DLG_W, OPT_DLG_H - 8, OPT_DLG_H,
N_("Wrap mode"), 0, 0,
0, 0, NULL},
- /* 15 */
+ /* 14 */
{quick_radio, 5, OPT_DLG_W, OPT_DLG_H - 13, OPT_DLG_H, "", 3, 0, 0,
const_cast(char **, key_emu_str), "keyemu"},
- /* 16 */
+ /* 15 */
{quick_label, 4, OPT_DLG_W, OPT_DLG_H - 14, OPT_DLG_H,
N_("Key emulation"), 0, 0, 0, 0, NULL},
NULL_QuickWidget
@@ -156,13 +236,12 @@ edit_options_dialog (void)
quick_widgets[3].str_result = &p;
quick_widgets[5].text = tab_spacing;
quick_widgets[5].str_result = &q;
- quick_widgets[6].result = &tedit_syntax_highlighting;
- quick_widgets[7].result = &toption_save_position;
- quick_widgets[8].result = &tedit_confirm_save;
- quick_widgets[9].result = &toption_fill_tabs_with_spaces;
- quick_widgets[10].result = &toption_return_does_auto_indent;
- quick_widgets[11].result = &toption_backspace_through_tabs;
- quick_widgets[12].result = &toption_fake_half_tabs;
+ quick_widgets[6].result = &toption_save_position;
+ quick_widgets[7].result = &tedit_confirm_save;
+ quick_widgets[8].result = &toption_fill_tabs_with_spaces;
+ quick_widgets[9].result = &toption_return_does_auto_indent;
+ quick_widgets[10].result = &toption_backspace_through_tabs;
+ quick_widgets[11].result = &toption_fake_half_tabs;
if (option_auto_para_formatting)
wrap_mode = 1;
@@ -171,19 +250,17 @@ edit_options_dialog (void)
else
wrap_mode = 0;
- quick_widgets[13].result = &wrap_mode;
- quick_widgets[13].value = wrap_mode;
+ quick_widgets[12].result = &wrap_mode;
+ quick_widgets[12].value = wrap_mode;
- quick_widgets[15].result = &tedit_key_emulation;
- quick_widgets[15].value = tedit_key_emulation;
+ quick_widgets[14].result = &tedit_key_emulation;
+ quick_widgets[14].value = tedit_key_emulation;
Quick_options.widgets = quick_widgets;
if (quick_dialog (&Quick_options) == B_CANCEL)
return;
- old_syntax_hl = option_syntax_highlighting;
-
if (p) {
option_word_wrap_line_length = atoi (p);
g_free (p);
@@ -195,7 +272,6 @@ edit_options_dialog (void)
g_free (q);
}
- option_syntax_highlighting = tedit_syntax_highlighting;
edit_confirm_save = tedit_confirm_save;
option_save_position = toption_save_position;
option_fill_tabs_with_spaces = toption_fill_tabs_with_spaces;
@@ -220,9 +296,8 @@ edit_options_dialog (void)
edit_reload_menu ();
}
- /* Load or unload syntax rules if the option has changed */
- if (option_syntax_highlighting != old_syntax_hl)
- edit_load_syntax (wedit, NULL, option_syntax_type);
/* Load usermap if it's needed */
edit_load_user_map (wedit);
}
+#undef DLG_OPT_W
+#undef DLG_OPT_H
Index: mc/src/setup.c
===================================================================
--- mc.orig/src/setup.c
+++ mc/src/setup.c
@@ -216,6 +216,7 @@ static const struct {
{ "editor_option_typewriter_wrap", &option_typewriter_wrap },
{ "editor_edit_confirm_save", &edit_confirm_save },
{ "editor_syntax_highlighting", &option_syntax_highlighting },
+ { "editor_highlight", &option_highlighting },
#endif /* USE_INTERNAL_EDIT */
{ "nice_rotating_dash", &nice_rotating_dash },
mc-utf8.patch:
View full diff with command:
/usr/bin/cvs -f diff -kk -u -N -r 1.28 -r 1.29 mc-utf8.patch
Index: mc-utf8.patch
===================================================================
RCS file: /cvs/pkgs/rpms/mc/devel/mc-utf8.patch,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- mc-utf8.patch 27 Mar 2008 13:33:05 -0000 1.28
+++ mc-utf8.patch 23 Oct 2008 13:24:00 -0000 1.29
@@ -1,5423 +1,5398 @@
-diff -up mc-4.6.2-pre1/src/filegui.c.utf8 mc-4.6.2-pre1/src/filegui.c
---- mc-4.6.2-pre1/src/filegui.c.utf8 2007-08-23 15:16:39.000000000 +0200
-+++ mc-4.6.2-pre1/src/filegui.c 2008-02-25 14:56:22.000000000 +0100
-@@ -65,6 +65,7 @@
- #include "filegui.h"
- #include "key.h" /* get_event */
- #include "util.h" /* strip_password() */
-+#include "tty.h"
-
- /* }}} */
-
-@@ -563,8 +564,8 @@ init_replace (FileOpContext *ctx, enum O
- * longest of "Overwrite..." labels
- * (assume "Target date..." are short enough)
- */
-- l1 = max (strlen (rd_widgets[6].text),
-- strlen (rd_widgets[11].text));
-+ l1 = max (mbstrlen (rd_widgets[6].text),
-+ mbstrlen (rd_widgets[11].text));
-
- /* longest of button rows */
- i = sizeof (rd_widgets) / sizeof (rd_widgets[0]);
-@@ -575,7 +576,7 @@ init_replace (FileOpContext *ctx, enum O
- l2 = max (l2, l);
- l = 0;
- }
-- l += strlen (rd_widgets[i].text) + 4;
-+ l += mbstrlen (rd_widgets[i].text) + 4;
- }
- }
- l2 = max (l2, l); /* last row */
-@@ -593,12 +594,12 @@ init_replace (FileOpContext *ctx, enum O
- l = l1;
- }
- rd_widgets[i].xpos = l;
-- l += strlen (rd_widgets[i].text) + 4;
-+ l += mbstrlen (rd_widgets[i].text) + 4;
- }
- }
- /* Abort button is centered */
- rd_widgets[1].xpos =
-- (rd_xlen - strlen (rd_widgets[1].text) - 3) / 2;
-+ (rd_xlen - mbstrlen (rd_widgets[1].text) - 3) / 2;
- }
- #endif /* ENABLE_NLS */
-
-@@ -617,7 +618,7 @@ init_replace (FileOpContext *ctx, enum O
-
- ADD_RD_LABEL (ui, 0,
- name_trunc (ui->replace_filename,
-- rd_trunc - strlen (rd_widgets[0].text)), 0);
-+ rd_trunc - mbstrlen (rd_widgets[0].text)), 0);
- ADD_RD_BUTTON (1);
-
- ADD_RD_BUTTON (2);
-@@ -804,36 +805,36 @@ fmd_init_i18n (int force)
- if (fmd_widgets[i].text[0] != '\0')
- fmd_widgets[i].text = _(fmd_widgets[i].text);
-
-- len = strlen (fmd_widgets[FMCB11].text)
-- + strlen (fmd_widgets[FMCB21].text) + 15;
-+ len = mbstrlen (fmd_widgets[FMCB11].text)
-+ + mbstrlen (fmd_widgets[FMCB21].text) + 15;
- fmd_xlen = max (fmd_xlen, len);
-
-- len = strlen (fmd_widgets[FMCB12].text)
-- + strlen (fmd_widgets[FMCB22].text) + 15;
-+ len = mbstrlen (fmd_widgets[FMCB12].text)
-+ + mbstrlen (fmd_widgets[FMCB22].text) + 15;
- fmd_xlen = max (fmd_xlen, len);
-
-- len = strlen (fmd_widgets[FMBRGT].text)
-- + strlen (fmd_widgets[FMBLFT].text) + 11;
-+ len = mbstrlen (fmd_widgets[FMBRGT].text)
-+ + mbstrlen (fmd_widgets[FMBLFT].text) + 11;
+diff -up mc-4.6.2-pre1/acinclude.m4.utf8 mc-4.6.2-pre1/acinclude.m4
+--- mc-4.6.2-pre1/acinclude.m4.utf8 2006-09-07 17:59:51.000000000 +0200
++++ mc-4.6.2-pre1/acinclude.m4 2008-10-23 14:00:12.000000000 +0200
+@@ -399,14 +399,14 @@ AC_DEFUN([MC_WITH_SLANG], [
+ fi
- #ifdef FMBMID
-- len += strlen (fmd_widgets[FMBMID].text) + 6;
-+ len += mbstrlen (fmd_widgets[FMBMID].text) + 6;
- #endif
+ dnl Unless external S-Lang was requested, reject S-Lang with UTF-8 hacks
+- if test x$with_screen = xslang; then
+- :
+- m4_if([$1], strict, ,
+- [AC_CHECK_LIB([slang], [SLsmg_write_nwchars],
+- [AC_MSG_WARN([Rejecting S-Lang with UTF-8 support, \
+-it's not fully supported yet])
+- with_screen=mcslang])])
+- fi
++dnl if test x$with_screen = xslang; then
++dnl :
++dnl m4_if([$1], strict, ,
++dnl [AC_CHECK_LIB([slang], [SLsmg_write_nwchars],
++dnl [AC_MSG_WARN([Rejecting S-Lang with UTF-8 support, \
++dnl it's not fully supported yet])
++dnl with_screen=mcslang])])
++dnl fi
- fmd_xlen = max (fmd_xlen, len + 4);
+ if test x$with_screen = xslang; then
+ AC_DEFINE(HAVE_SYSTEM_SLANG, 1,
+diff -up mc-4.6.2-pre1/edit/editcmd.c.utf8 mc-4.6.2-pre1/edit/editcmd.c
+--- mc-4.6.2-pre1/edit/editcmd.c.utf8 2007-05-02 13:22:01.000000000 +0200
++++ mc-4.6.2-pre1/edit/editcmd.c 2008-10-23 14:00:12.000000000 +0200
+@@ -61,7 +61,7 @@
+ #define edit_get_save_file(f,h) input_expand_dialog (h, _(" Enter file name: "), f)
- len = (fmd_xlen - (len + 6)) / 2;
- i = fmd_widgets[FMBLFT].relative_x = len + 3;
-- i += strlen (fmd_widgets[FMBLFT].text) + 8;
-+ i += mbstrlen (fmd_widgets[FMBLFT].text) + 8;
+ struct selection {
+- unsigned char * text;
++ mc_wchar_t *text;
+ int len;
+ };
- #ifdef FMBMID
- fmd_widgets[FMBMID].relative_x = i;
-- i += strlen (fmd_widgets[FMBMID].text) + 6;
-+ i += mbstrlen (fmd_widgets[FMBMID].text) + 6;
- #endif
+@@ -84,12 +84,16 @@ int edit_confirm_save = 1;
+ #define MAX_REPL_LEN 1024
- fmd_widgets[FMBRGT].relative_x = i;
+ static int edit_save_cmd (WEdit *edit);
+-static unsigned char *edit_get_block (WEdit *edit, long start,
++static mc_wchar_t *edit_get_block (WEdit *edit, long start,
+ long finish, int *l);
- #define chkbox_xpos(i) \
-- fmd_widgets [i].relative_x = fmd_xlen - strlen (fmd_widgets [i].text) - 6
-+ fmd_widgets [i].relative_x = fmd_xlen - mbstrlen (fmd_widgets [i].text) - 6
+-static inline int my_lower_case (int c)
++static inline mc_wchar_t my_lower_case (mc_wchar_t c)
+ {
++#ifndef UTF8
+ return tolower(c & 0xFF);
++#else
++ return towlower(c);
++#endif
+ }
- chkbox_xpos (FMCB0);
- chkbox_xpos (FMCB21);
-@@ -855,7 +856,7 @@ fmd_init_i18n (int force)
+ static const char *
+@@ -124,11 +128,11 @@ static void *memmove (void *dest, const
+ #endif /* !HAVE_MEMMOVE */
- char *
- file_mask_dialog (FileOpContext *ctx, FileOperation operation, const char *text,
-- const char *def_text, int only_one, int *do_background)
-+ const char *def_text_orig, int only_one, int *do_background)
+ /* #define itoa MY_itoa <---- this line is now in edit.h */
+-static char *
++static mc_wchar_t *
+ MY_itoa (int i)
{
- int source_easy_patterns = easy_patterns;
- char *source_mask, *orig_mask, *dest_dir, *tmpdest;
-@@ -864,12 +865,20 @@ file_mask_dialog (FileOpContext *ctx, Fi
- struct stat buf;
- int val;
- QuickDialog Quick_input;
--
-+ char *def_text;
- g_return_val_if_fail (ctx != NULL, NULL);
+- static char t[14];
+- char *s = t + 13;
++ static mc_wchar_t t[14];
++ mc_wchar_t *s = t + 13;
+ int j = i;
+ *s-- = 0;
+ do {
+@@ -213,6 +217,48 @@ void edit_refresh_cmd (WEdit * edit)
+ doupdate();
+ }
+
++#ifdef UTF8
+
-+ def_text = g_strdup(def_text_orig);
++static size_t
++wchar_write(int fd, mc_wchar_t *buf, size_t len)
++{
[...9999 lines suppressed...]
+ int hotpos; /* offset hot KEY char in text */
++ wchar_t hotwc;
+ } WCheck;
- #define get_sys_error(s) (s)
+ typedef struct WGauge {
+@@ -57,16 +59,20 @@ char *show_hist (GList *history, int wid
-diff -up mc-4.6.2-pre1/edit/editkeys.c.utf8 mc-4.6.2-pre1/edit/editkeys.c
---- mc-4.6.2-pre1/edit/editkeys.c.utf8 2006-02-01 18:07:11.000000000 +0100
-+++ mc-4.6.2-pre1/edit/editkeys.c 2008-02-25 14:56:22.000000000 +0100
-@@ -182,10 +182,10 @@ static const edit_key_map_type common_ke
- * 'command' is one of the editor commands from editcmddef.h.
- */
- int
--edit_translate_key (WEdit *edit, long x_key, int *cmd, int *ch)
-+edit_translate_key (WEdit *edit, long x_key, int *cmd, mc_wint_t *ch)
- {
- int command = CK_Insert_Char;
-- int char_for_insertion = -1;
-+ mc_wint_t char_for_insertion = -1;
- int i = 0;
- int extmod = 0;
- const edit_key_map_type *key_map = NULL;
-@@ -242,9 +242,30 @@ edit_translate_key (WEdit *edit, long x_
- /* an ordinary insertable character */
- if (x_key < 256 && !extmod) {
- int c = convert_from_input_c (x_key);
--
+ typedef struct {
+ Widget widget;
+- int point; /* cursor position in the input line */
+- int mark; /* The mark position */
+- int first_shown; /* Index of the first shown character */
+- int current_max_len; /* Maximum length of input line */
+- int field_len; /* Length of the editing field */
++ int point; /* cursor position in the input line (mb chars) */
++ int mark; /* The mark position (mb chars) */
++ int first_shown; /* Index of the first shown character (mb chars) */
++ int current_max_len; /* Maximum length of input line (bytes) */
++ int field_len; /* Length of the editing field (mb chars) */
+ int color; /* color used */
+ int first; /* Is first keystroke? */
+ int disable_update; /* Do we want to skip updates? */
+ int is_password; /* Is this a password input line? */
+ char *buffer; /* pointer to editing buffer */
+#ifdef UTF8
-+ mbstate_t mbs;
-+ int res;
-+ mc_wchar_t wc;
-+
-+ memset (&mbs, 0, sizeof (mbs));
-+
-+ if (edit->charpoint >= MB_CUR_MAX) edit->charpoint = 0;
-+
-+ edit->charbuf[edit->charpoint++] = c;
-+
-+ res = mbrtowc(&wc, (char *)edit->charbuf, edit->charpoint, &mbs);
-+ if (res < 0) {
-+ if (res != -2) edit->charpoint = 0; /* broken multibyte char, skip */
-+ return 0;
-+ }
-+ edit->charpoint = 0;
-+
-+ if (iswprint (wc)) {
-+ char_for_insertion = wc;
-+#else
- if (is_printable (c)) {
- char_for_insertion = c;
++ char charbuf[MB_LEN_MAX];
+#endif /* UTF8 */
- goto fin;
- }
- }
-@@ -283,7 +304,7 @@ edit_translate_key (WEdit *edit, long x_
- *cmd = command;
- *ch = char_for_insertion;
++ int charpoint;
+ GList *history; /* The history */
+ int need_push; /* need to push the current Input on hist? */
+ char **completions; /* Possible completions array */
+diff -up mc-4.6.2-pre1/src/wtools.c.utf8 mc-4.6.2-pre1/src/wtools.c
+--- mc-4.6.2-pre1/src/wtools.c.utf8 2006-09-14 11:12:49.000000000 +0200
++++ mc-4.6.2-pre1/src/wtools.c 2008-10-23 14:00:12.000000000 +0200
+@@ -49,11 +49,11 @@ create_listbox_window (int cols, int lin
+ /* Adjust sizes */
+ lines = (lines > LINES - 6) ? LINES - 6 : lines;
-- if (command == CK_Insert_Char && char_for_insertion == -1) {
-+ if (command == CK_Insert_Char && char_for_insertion == (mc_wint_t)-1) {
- /* unchanged, key has no function here */
- return 0;
- }
-diff -up mc-4.6.2-pre1/acinclude.m4.utf8 mc-4.6.2-pre1/acinclude.m4
---- mc-4.6.2-pre1/acinclude.m4.utf8 2006-09-07 17:59:51.000000000 +0200
-+++ mc-4.6.2-pre1/acinclude.m4 2008-02-25 14:56:22.000000000 +0100
-@@ -399,14 +399,14 @@ AC_DEFUN([MC_WITH_SLANG], [
- fi
+- if (title && (cols < (len = strlen (title) + 2)))
++ if (title && (cols < (len = mbstrlen (title) + 2)))
+ cols = len;
- dnl Unless external S-Lang was requested, reject S-Lang with UTF-8 hacks
-- if test x$with_screen = xslang; then
-- :
-- m4_if([$1], strict, ,
-- [AC_CHECK_LIB([slang], [SLsmg_write_nwchars],
-- [AC_MSG_WARN([Rejecting S-Lang with UTF-8 support, \
--it's not fully supported yet])
-- with_screen=mcslang])])
-- fi
-+dnl if test x$with_screen = xslang; then
-+dnl :
-+dnl m4_if([$1], strict, ,
-+dnl [AC_CHECK_LIB([slang], [SLsmg_write_nwchars],
-+dnl [AC_MSG_WARN([Rejecting S-Lang with UTF-8 support, \
-+dnl it's not fully supported yet])
-+dnl with_screen=mcslang])])
-+dnl fi
+ /* no &, but 4 spaces around button for brackets and such */
+- if (cols < (len = strlen (cancel_string) + 3))
++ if (cols < (len = mbstrlen (cancel_string) + 3))
+ cols = len;
- if test x$with_screen = xslang; then
- AC_DEFINE(HAVE_SYSTEM_SLANG, 1,
-diff -Nrbu mc-4.6.1a/src/view.c mc-4.6.1a-OK/src/view.c
---- mc-4.6.2-pre1/src/view.c 2006-05-05 19:01:49.000000000 +0400
-+++ mc-4.6.2-pre1/src/view.c 2006-05-05 18:39:24.000000000 +0400
-@@ -2006,16 +2006,19 @@
- if (col >= view->dpy_text_column
- && col - view->dpy_text_column < width) {
- widget_move (view, top + row, left + (col - view->dpy_text_column));
--#ifndef UTF8
-+#ifdef UTF8
-+ if (SLsmg_is_utf8_mode ()) {
-+ if (!iswprint (wc))
-+ wc = '.';
-+ tty_print_char (wc);
-+ } else {
-+#endif
- c = convert_to_display_c (c);
- if (!is_printable (c))
- c = '.';
- tty_print_char (c);
--#else
-- wc = convert_to_display_c (wc);
-- if (!iswprint (wc))
-- wc = '.';
-- tty_print_char (wc);
-+#ifdef UTF8
-+ }
- #endif
+ cols = cols > COLS - 6 ? COLS - 6 : cols;
+@@ -124,7 +124,7 @@ query_dialog (const char *header, const
+ va_start (ap, count);
+ for (i = 0; i < count; i++) {
+ char *cp = va_arg (ap, char *);
+- win_len += strlen (cp) + 6;
++ win_len += mbstrlen (cp) + 6;
+ if (strchr (cp, '&') != NULL)
+ win_len--;
}
- col++;
+@@ -133,7 +133,7 @@ query_dialog (const char *header, const
+
+ /* count coordinates */
+ msglen (text, &lines, &cols);
+- cols = 6 + max (win_len, max ((int) strlen (header), cols));
++ cols = 6 + max (win_len, max ((int) mbstrlen (header), cols));
+ lines += 4 + (count > 0 ? 2 : 0);
+ xpos = COLS / 2 - cols / 2;
+ ypos = LINES / 3 - (lines - 3) / 2;
+@@ -148,7 +148,7 @@ query_dialog (const char *header, const
+ va_start (ap, count);
+ for (i = 0; i < count; i++) {
+ cur_name = va_arg (ap, char *);
+- xpos = strlen (cur_name) + 6;
++ xpos = mbstrlen (cur_name) + 6;
+ if (strchr (cur_name, '&') != NULL)
+ xpos--;
+
+@@ -463,7 +463,7 @@ fg_input_dialog_help (const char *header
+ quick_widgets[2].histname = histname;
+
+ msglen (text, &lines, &cols);
+- len = max ((int) strlen (header), cols) + 4;
++ len = max ((int) mbstrlen (header), cols) + 4;
+ len = max (len, 64);
+
+ /* The special value of def_text is used to identify password boxes
+@@ -485,7 +485,7 @@ fg_input_dialog_help (const char *header
+ quick_widgets[1].text = _(quick_widgets[1].text);
+ quick_widgets[0].relative_x = len / 2 + 4;
+ quick_widgets[1].relative_x =
+- len / 2 - (strlen (quick_widgets[1].text) + 9);
++ len / 2 - (mbstrlen (quick_widgets[1].text) + 9);
+ quick_widgets[0].x_divisions = quick_widgets[1].x_divisions = len;
+ #endif /* ENABLE_NLS */
+
Index: mc.spec
===================================================================
RCS file: /cvs/pkgs/rpms/mc/devel/mc.spec,v
retrieving revision 1.136
retrieving revision 1.137
diff -u -r1.136 -r1.137
--- mc.spec 2 Sep 2008 09:52:26 -0000 1.136
+++ mc.spec 23 Oct 2008 13:24:00 -0000 1.137
@@ -1,7 +1,7 @@
Summary: User-friendly text console file manager and visual shell
Name: mc
Version: 4.6.2
-Release: 6.pre1%{?dist}
+Release: 7.pre1%{?dist}
Epoch: 1
License: GPLv2
Group: System Environment/Shells
@@ -34,6 +34,7 @@
Patch20: mc-7zip.patch
Patch21: mc-oldrpmtags.patch
Patch22: mc-shellcwd.patch
+Patch23: mc-cedit-configurable-highlight.patch
%description
Midnight Commander is a visual shell much like a file manager, only
@@ -67,6 +68,7 @@
%patch20 -p1 -b .7zip
%patch21 -p1 -b .oldrpmtags
%patch22 -p1 -b .shellcwd
+%patch23 -p1 -b .cedit-configurable-highlight
# convert files in /lib to UTF-8
pushd lib
@@ -204,6 +206,11 @@
%dir %{_libexecdir}/mc
%changelog
+* Thu Oct 23 2008 Jindrich Novy <jnovy at redhat.com> 4.6.2-7.pre1
+- allow switching of trailing spaces/tab highlighting with crtl-v,
+ patch from Jan Engelhardt (#464738)
+- update the UTF-8 patch accordingly
+
* Tue Sep 2 2008 Jindrich Novy <jnovy at redhat.com> 4.6.2-6.pre1
- do not change directory in panel to subshell directory
when switched back from subshell (#460633)
More information about the fedora-extras-commits
mailing list