From 556d3c027b31b47978f51825dd674d909fb3ac80 Mon Sep 17 00:00:00 2001 From: Jindrich Novy Date: Fri, 8 Jul 2005 09:56:28 +0000 Subject: [PATCH] - update to mc-4.6.1-pre5 - sync .utf8, .userhost patch - drop upstreamed .fixes patch --- .cvsignore | 1 + mc-userhost.patch | 24 +- mc-utf8.patch | 1011 +++++++++++++++++++++++---------------------- mc.spec | 15 +- sources | 2 +- 5 files changed, 530 insertions(+), 523 deletions(-) diff --git a/.cvsignore b/.cvsignore index 7ee3a30..88cd527 100644 --- a/.cvsignore +++ b/.cvsignore @@ -12,3 +12,4 @@ mc-4.6.1a-20050309.tar.bz2 mc-4.6.1a-20050324.tar.bz2 mc-4.6.1a-20050504.tar.bz2 mc-4.6.1a-20050606.tar.bz2 +mc-4.6.1-pre5.tar.bz2 diff --git a/mc-userhost.patch b/mc-userhost.patch index 4a51d9b..4b7bb69 100644 --- a/mc-userhost.patch +++ b/mc-userhost.patch @@ -1,17 +1,17 @@ ---- mc-4.6.1a/src/main.c.userhost 2005-06-06 13:35:08.926427736 +0200 -+++ mc-4.6.1a/src/main.c 2005-06-06 13:39:11.551543112 +0200 -@@ -32,6 +32,7 @@ - #include - #include - #include -+#include +--- mc-4.6.1-pre5/src/main.c.userhost 2005-07-08 11:04:37.718907992 +0200 ++++ mc-4.6.1-pre5/src/main.c 2005-07-08 11:07:53.888085744 +0200 +@@ -33,6 +33,7 @@ + # include + #endif - #include "global.h" - #include "tty.h" -@@ -1611,9 +1612,22 @@ void ++#include + #include + #include + #include +@@ -1607,9 +1608,22 @@ void update_xterm_title_path (void) { - char *p, *s; + unsigned char *p, *s; + char h[64]; + struct passwd *pw; @@ -30,4 +30,4 @@ + } do { #ifndef UTF8 - if (!is_printable ((unsigned char) *s)) + if (!is_printable (*s)) diff --git a/mc-utf8.patch b/mc-utf8.patch index cf21752..1b86d8e 100644 --- a/mc-utf8.patch +++ b/mc-utf8.patch @@ -1,6 +1,6 @@ ---- mc-4.6.1a/edit/editdraw.c.utf8 2005-05-27 05:35:12.000000000 +0200 -+++ mc-4.6.1a/edit/editdraw.c 2005-06-06 14:46:19.160253520 +0200 -@@ -61,7 +61,7 @@ +--- mc-4.6.1-pre5/edit/editdraw.c.utf8 2005-05-27 16:19:18.000000000 +0200 ++++ mc-4.6.1-pre5/edit/editdraw.c 2005-07-08 11:22:41.891088768 +0200 +@@ -48,7 +48,7 @@ static void status_string (WEdit * edit, char *s, int w) { @@ -9,7 +9,7 @@ /* * If we are at the end of file, print , -@@ -69,11 +69,16 @@ static void status_string (WEdit * edit, +@@ -56,11 +56,16 @@ static void status_string (WEdit * edit, * as decimal and as hex. */ if (edit->curs1 < edit->last_byte) { @@ -29,7 +29,7 @@ } else { strcpy (byte_str, ""); } -@@ -198,11 +203,16 @@ void edit_scroll_screen_over_cursor (WEd +@@ -183,11 +188,16 @@ void edit_scroll_screen_over_cursor (WEd #define lowlevel_set_color(x) attrset(MY_COLOR_PAIR(color)) #endif @@ -48,7 +48,7 @@ int x = start_col_real + EDIT_TEXT_HORIZONTAL_OFFSET; int x1 = start_col + EDIT_TEXT_HORIZONTAL_OFFSET; -@@ -216,9 +226,9 @@ print_to_widget (WEdit *edit, long row, +@@ -201,9 +211,9 @@ print_to_widget (WEdit *edit, long row, edit_move (x1 + FONT_OFFSET_X, y + FONT_OFFSET_Y); p = line; @@ -60,7 +60,7 @@ int color; if (cols_to_skip) { -@@ -227,9 +237,9 @@ print_to_widget (WEdit *edit, long row, +@@ -212,9 +222,9 @@ print_to_widget (WEdit *edit, long row, continue; } @@ -73,7 +73,7 @@ if (style & MOD_ABNORMAL) { /* Non-printable - use black background */ -@@ -243,8 +253,11 @@ print_to_widget (WEdit *edit, long row, +@@ -228,8 +238,11 @@ print_to_widget (WEdit *edit, long row, } else { lowlevel_set_color (color); } @@ -86,7 +86,7 @@ p++; } } -@@ -254,11 +267,11 @@ static void +@@ -239,11 +252,11 @@ static void edit_draw_this_line (WEdit *edit, long b, long row, long start_col, long end_col) { @@ -101,7 +101,7 @@ int color; int i, book_mark = -1; -@@ -280,66 +293,96 @@ edit_draw_this_line (WEdit *edit, long b +@@ -265,66 +278,96 @@ edit_draw_this_line (WEdit *edit, long b if (row <= edit->total_lines - edit->start_line) { while (col <= end_col - edit->start_col) { @@ -218,7 +218,7 @@ } col++; break; -@@ -349,7 +392,7 @@ edit_draw_this_line (WEdit *edit, long b +@@ -334,7 +377,7 @@ edit_draw_this_line (WEdit *edit, long b } else { start_col_real = start_col = 0; } @@ -227,9 +227,9 @@ print_to_widget (edit, row, start_col, start_col_real, end_col, line); } ---- mc-4.6.1a/edit/editkeys.c.utf8 2005-05-27 05:35:12.000000000 +0200 -+++ mc-4.6.1a/edit/editkeys.c 2005-06-06 14:46:19.161253368 +0200 -@@ -176,10 +176,10 @@ static long const common_key_map[] = { +--- mc-4.6.1-pre5/edit/editkeys.c.utf8 2005-05-27 16:19:18.000000000 +0200 ++++ mc-4.6.1-pre5/edit/editkeys.c 2005-07-08 11:22:41.892088616 +0200 +@@ -162,10 +162,10 @@ static long const common_key_map[] = { * 'command' is one of the editor commands from editcmddef.h. */ int @@ -242,7 +242,7 @@ int i = 0; static const long *key_map; -@@ -256,9 +256,30 @@ edit_translate_key (WEdit *edit, long x_ +@@ -242,9 +242,30 @@ edit_translate_key (WEdit *edit, long x_ /* an ordinary insertable character */ if (x_key < 256) { int c = convert_from_input_c (x_key); @@ -274,7 +274,7 @@ goto fin; } } -@@ -299,7 +320,7 @@ edit_translate_key (WEdit *edit, long x_ +@@ -285,7 +306,7 @@ edit_translate_key (WEdit *edit, long x_ *cmd = command; *ch = char_for_insertion; @@ -283,9 +283,9 @@ /* unchanged, key has no function here */ return 0; } ---- mc-4.6.1a/edit/editwidget.c.utf8 2005-05-27 05:35:12.000000000 +0200 -+++ mc-4.6.1a/edit/editwidget.c 2005-06-06 14:46:19.162253216 +0200 -@@ -349,7 +349,8 @@ edit_callback (Widget *w, widget_msg_t m +--- mc-4.6.1-pre5/edit/editwidget.c.utf8 2005-05-27 16:19:18.000000000 +0200 ++++ mc-4.6.1-pre5/edit/editwidget.c 2005-07-08 11:22:41.893088464 +0200 +@@ -337,7 +337,8 @@ edit_callback (WEdit *e, widget_msg_t ms case WIDGET_KEY: { @@ -295,9 +295,9 @@ /* first check alt-f, alt-e, alt-s, etc for drop menus */ if (edit_drop_hotkey_menu (e, parm)) ---- mc-4.6.1a/edit/wordproc.c.utf8 2005-05-27 05:35:12.000000000 +0200 -+++ mc-4.6.1a/edit/wordproc.c 2005-06-06 14:46:19.162253216 +0200 -@@ -40,7 +40,12 @@ +--- mc-4.6.1-pre5/edit/wordproc.c.utf8 2005-05-27 16:19:18.000000000 +0200 ++++ mc-4.6.1-pre5/edit/wordproc.c 2005-07-08 11:22:41.894088312 +0200 +@@ -24,7 +24,12 @@ #define tab_width option_tab_spacing @@ -310,7 +310,7 @@ #define FONT_MEAN_WIDTH 1 static long -@@ -57,14 +62,21 @@ line_start (WEdit *edit, long line) +@@ -41,14 +46,21 @@ line_start (WEdit *edit, long line) p = edit_move_forward (edit, p, line - l, 0); p = edit_bol (edit, p); @@ -333,7 +333,7 @@ c = edit_get_byte (edit, p); if (c == '.') { /* `...' is acceptable */ if (edit_get_byte (edit, p + 1) == '.') -@@ -78,7 +90,13 @@ static int bad_line_start (WEdit * edit, +@@ -62,7 +74,13 @@ static int bad_line_start (WEdit * edit, return 0; /* `---' is acceptable */ return 1; } @@ -347,7 +347,7 @@ return 1; return 0; } -@@ -131,33 +149,37 @@ end_paragraph (WEdit *edit, int force) +@@ -115,33 +133,37 @@ end_paragraph (WEdit *edit, int force) i - edit->curs_line, 0)); } @@ -393,7 +393,7 @@ while (size--) { *p = *p == '\n' ? ' ' : *p; p++; -@@ -174,7 +196,7 @@ static inline int next_tab_pos (int x) +@@ -158,7 +180,7 @@ static inline int next_tab_pos (int x) { return x += tab_width - x % tab_width; } @@ -402,32 +402,25 @@ { int x = 0, c, xn = 0; for (;;) { -@@ -198,7 +220,7 @@ static int line_pixel_length (unsigned c +@@ -182,7 +204,7 @@ static int line_pixel_length (unsigned c } - static int --next_word_start (unsigned char *t, int q) -+next_word_start (mc_wchar_t *t, int q) + /* find the start of a word */ +-static int next_word_start (unsigned char *t, int q, int size) ++static int next_word_start (mc_wchar_t *t, int q, int size) { int i; for (i = q;; i++) { -@@ -220,13 +242,13 @@ next_word_start (unsigned char *t, int q +@@ -203,7 +225,7 @@ static int next_word_start (unsigned cha + } /* find the start of a word */ - static int --word_start (unsigned char *t, int q) -+word_start (mc_wchar_t *t, int q) +-static int word_start (unsigned char *t, int q, int size) ++static int word_start (mc_wchar_t *t, int q, int size) { int i = q; if (t[q] == ' ' || t[q] == '\t') - return next_word_start (t, q); - for (;;) { -- int c; -+ mc_wchar_t c; - if (!i) - return -1; - c = t[i - 1]; -@@ -239,7 +261,7 @@ word_start (unsigned char *t, int q) +@@ -222,7 +244,7 @@ static int word_start (unsigned char *t, } /* replaces ' ' with '\n' to properly format a paragraph */ @@ -436,7 +429,7 @@ { int q = 0, ww; strip_newlines (t, size); -@@ -267,7 +289,7 @@ static void format_this (unsigned char * +@@ -250,7 +272,7 @@ static void format_this (unsigned char * } } @@ -445,23 +438,23 @@ { edit_cursor_move (edit, q - edit->curs1); edit_delete (edit); -@@ -276,18 +298,27 @@ static void replace_at (WEdit * edit, lo +@@ -258,18 +280,27 @@ static void replace_at (WEdit * edit, lo + } /* replaces a block of text */ - static void --put_paragraph (WEdit * edit, unsigned char *t, long p, int indent, int size) -+put_paragraph (WEdit * edit, mc_wchar_t *t, long p, int indent, int size) +-static void put_paragraph (WEdit * edit, unsigned char *t, long p, long q, int indent, int size) ++static void put_paragraph (WEdit * edit, mc_wchar_t *t, long p, long q, int indent, int size) { long cursor; - int i, c = 0; + int i; -+ mc_wint_t c = 0; ++ mc_wchar_t c = 0; cursor = edit->curs1; if (indent) +#ifndef UTF8 while (strchr ("\t ", edit_get_byte (edit, p))) +#else /* UTF8 */ -+ while (wcschr (L"\t ", edit_get_byte (edit, p))) ++ while (wcschr (L"\t ", edit_get_byte (edit, p))) +#endif /* UTF8 */ p++; for (i = 0; i < size; i++, p++) { @@ -470,12 +463,12 @@ +#ifndef UTF8 while (strchr ("\t ", edit_get_byte (edit, p))) +#else /* UTF8 */ -+ while (wcschr (L"\t ", edit_get_byte (edit, p))) ++ while (wcschr (L"\t ", edit_get_byte (edit, p))) +#endif /* UTF8 */ p++; } else if (t[i - 1] == '\n') { long curs; -@@ -299,7 +330,11 @@ put_paragraph (WEdit * edit, unsigned ch +@@ -281,7 +312,11 @@ static void put_paragraph (WEdit * edit, p = edit->curs1; } else if (c == '\n') { edit_cursor_move (edit, p - edit->curs1); @@ -487,7 +480,7 @@ edit_delete (edit); if (cursor > edit->curs1) cursor--; -@@ -332,7 +367,7 @@ format_paragraph (WEdit *edit, int force +@@ -314,7 +349,7 @@ format_paragraph (WEdit *edit, int force { long p, q; int size; @@ -496,7 +489,7 @@ int indent = 0; if (option_word_wrap_line_length < 2) return; -@@ -342,17 +377,25 @@ format_paragraph (WEdit *edit, int force +@@ -324,17 +359,25 @@ format_paragraph (WEdit *edit, int force q = end_paragraph (edit, force); indent = test_indent (edit, p, q); t = get_paragraph (edit, p, q, indent, &size); @@ -523,9 +516,9 @@ g_free (t); return; } ---- mc-4.6.1a/edit/editcmd.c.utf8 2005-05-27 05:35:12.000000000 +0200 -+++ mc-4.6.1a/edit/editcmd.c 2005-06-06 14:46:19.166252608 +0200 -@@ -58,7 +58,7 @@ +--- mc-4.6.1-pre5/edit/editcmd.c.utf8 2005-05-27 16:19:18.000000000 +0200 ++++ mc-4.6.1-pre5/edit/editcmd.c 2005-07-08 11:22:41.897087856 +0200 +@@ -46,7 +46,7 @@ #define edit_get_save_file(f,h) input_expand_dialog (h, _(" Enter file name: "), f) struct selection { @@ -534,7 +527,7 @@ int len; }; -@@ -81,12 +81,16 @@ int edit_confirm_save = 1; +@@ -69,12 +69,16 @@ int edit_confirm_save = 1; #define MAX_REPL_LEN 1024 static int edit_save_cmd (WEdit *edit); @@ -552,8 +545,8 @@ +#endif } - static const char * -@@ -121,11 +125,11 @@ static void *memmove (void *dest, const + static const char *strcasechr (const unsigned char *s, int c) +@@ -108,11 +112,11 @@ static void *memmove (void *dest, const #endif /* !HAVE_MEMMOVE */ /* #define itoa MY_itoa <---- this line is now in edit.h */ @@ -568,7 +561,7 @@ int j = i; *s-- = 0; do { -@@ -210,6 +214,48 @@ void edit_refresh_cmd (WEdit * edit) +@@ -196,6 +200,48 @@ void edit_refresh_cmd (WEdit * edit) doupdate(); } @@ -617,7 +610,7 @@ /* If 0 (quick save) then a) create/truncate file, b) save to ; if 1 (safe save) then a) save to , -@@ -317,32 +363,48 @@ edit_save_file (WEdit *edit, const char +@@ -303,32 +349,48 @@ edit_save_file (WEdit *edit, const char buf = 0; filelen = edit->last_byte; while (buf <= (edit->curs1 >> S_EDIT_BUF_SIZE) - 1) { @@ -669,7 +662,7 @@ EDIT_BUF_SIZE) != EDIT_BUF_SIZE) { filelen = -1; break; -@@ -655,13 +717,21 @@ edit_delete_macro (WEdit * edit, int k) +@@ -643,13 +705,21 @@ edit_delete_macro (WEdit * edit, int k) if (!n || n == EOF) break; n = 0; @@ -691,7 +684,7 @@ fprintf (g, ";\n"); } } -@@ -694,7 +764,11 @@ int edit_save_macro_cmd (WEdit * edit, s +@@ -685,7 +755,11 @@ int edit_save_macro_cmd (WEdit * edit, s if (f) { fprintf (f, ("key '%d 0': "), s); for (i = 0; i < n; i++) @@ -703,7 +696,7 @@ fprintf (f, ";\n"); fclose (f); if (saved_macros_loaded) { -@@ -744,10 +818,18 @@ int edit_load_macro_cmd (WEdit * edit, s +@@ -734,10 +808,18 @@ int edit_load_macro_cmd (WEdit * edit, s saved_macro[i++] = s; if (!found) { *n = 0; @@ -722,7 +715,7 @@ } fscanf (f, ";\n"); if (s == k) -@@ -894,7 +976,7 @@ int eval_marks (WEdit * edit, long *star +@@ -886,7 +968,7 @@ int eval_marks (WEdit * edit, long *star #define space_width 1 static void @@ -731,7 +724,7 @@ { long cursor; int i, col; -@@ -942,7 +1024,7 @@ edit_block_copy_cmd (WEdit *edit) +@@ -934,7 +1016,7 @@ edit_block_copy_cmd (WEdit *edit) { long start_mark, end_mark, current = edit->curs1; int size, x; @@ -740,7 +733,7 @@ edit_update_curs_col (edit); x = edit->curs_col; -@@ -987,7 +1069,7 @@ edit_block_move_cmd (WEdit *edit) +@@ -979,7 +1061,7 @@ edit_block_move_cmd (WEdit *edit) { long count; long current; @@ -749,7 +742,7 @@ long start_mark, end_mark; int deleted = 0; int x = 0; -@@ -1048,7 +1130,7 @@ edit_block_move_cmd (WEdit *edit) +@@ -1040,7 +1122,7 @@ edit_block_move_cmd (WEdit *edit) edit_push_action (edit, COLUMN_ON); column_highlighting = 0; } else { @@ -758,19 +751,19 @@ edit_cursor_move (edit, start_mark - edit->curs1); edit_scroll_screen_over_cursor (edit); count = start_mark; -@@ -1386,7 +1468,11 @@ static long sargs[NUM_REPL_ARGS][256 / s +@@ -1371,7 +1453,11 @@ static long sargs[NUM_REPL_ARGS][256 / s /* This function is a modification of mc-3.2.10/src/view.c:regexp_view_search() */ /* returns -3 on error in pattern, -1 on not found, found_len = 0 if either */ static int +#ifndef UTF8 - string_regexp_search (char *pattern, char *string, int match_type, + string_regexp_search (char *pattern, char *string, int len, int match_type, +#else /* UTF8 */ +string_regexp_search (char *pattern, mc_wchar_t *wstring, int match_type, +#endif /* UTF8 */ int match_bol, int icase, int *found_len, void *d) { static regex_t r; -@@ -1395,6 +1481,11 @@ string_regexp_search (char *pattern, cha +@@ -1380,6 +1466,11 @@ string_regexp_search (char *pattern, cha regmatch_t *pmatch; static regmatch_t s[1]; @@ -782,7 +775,7 @@ pmatch = (regmatch_t *) d; if (!pmatch) pmatch = s; -@@ -1414,13 +1505,51 @@ string_regexp_search (char *pattern, cha +@@ -1399,13 +1490,51 @@ string_regexp_search (char *pattern, cha old_type = match_type; old_icase = icase; } @@ -834,7 +827,7 @@ *found_len = pmatch[0].rm_eo - pmatch[0].rm_so; return (pmatch[0].rm_so); } -@@ -1428,13 +1557,29 @@ string_regexp_search (char *pattern, cha +@@ -1413,13 +1542,29 @@ string_regexp_search (char *pattern, cha /* thanks to Liviu Daia for getting this (and the above) routines to work properly - paul */ @@ -865,7 +858,7 @@ int n = 0; for (p = 0; p < l; p++) /* count conversions... */ -@@ -1443,19 +1588,22 @@ edit_find_string (long start, unsigned c +@@ -1428,19 +1573,22 @@ edit_find_string (long start, unsigned c n++; if (replace_scanf || replace_regexp) { @@ -895,7 +888,7 @@ if (replace_case) { for (p = start; p < last_byte && p < start + MAX_REPL_LEN; p++) buf[p - start] = (*get_byte) (data, p); -@@ -1469,20 +1617,36 @@ edit_find_string (long start, unsigned c +@@ -1454,20 +1602,36 @@ edit_find_string (long start, unsigned c } buf[(q = p - start)] = 0; @@ -933,7 +926,7 @@ if (q + start < last_byte) { if (replace_case) { buf[q] = (*get_byte) (data, q + start); -@@ -1496,7 +1660,11 @@ edit_find_string (long start, unsigned c +@@ -1481,7 +1645,11 @@ edit_find_string (long start, unsigned c start++; buf++; /* move the window along */ if (buf == mbuf + MAX_REPL_LEN) { /* the window is about to go past the end of array, so... */ @@ -945,25 +938,25 @@ buf = mbuf; } q--; -@@ -1522,10 +1690,17 @@ edit_find_string (long start, unsigned c +@@ -1507,10 +1675,17 @@ edit_find_string (long start, unsigned c buf = mbuf; while (q) { +#ifndef UTF8 - found_start = string_regexp_search ((char *) exp, (char *) buf, match_normal, match_bol, !replace_case, len, d); + found_start = string_regexp_search ((char *) exp, (char *) buf, q, match_normal, match_bol, !replace_case, len, d); +#else /* UTF8 */ -+ found_start = string_regexp_search ((char *) exp_mb, buf, match_normal, match_bol, !replace_case, len, d); ++ found_start = string_regexp_search ((char *) exp_mb, buf, match_normal, match_bol, !replace_case, len, d); +#endif /* UTF8 */ if (found_start <= -2) { /* regcomp/regexec error */ *len = 0; +#ifdef UTF8 -+ g_free (exp_backup); ++ g_free (exp_backup); +#endif /* UTF8 */ return -3; } else if (found_start == -1) /* not found: try next line */ -@@ -1536,15 +1711,27 @@ edit_find_string (long start, unsigned c +@@ -1521,15 +1696,27 @@ edit_find_string (long start, unsigned c match_bol = 0; continue; } @@ -993,35 +986,35 @@ memmove (mbuf, buf, q); p = start + q; move_win = 1; -@@ -1554,36 +1741,59 @@ edit_find_string (long start, unsigned c +@@ -1539,36 +1726,59 @@ edit_find_string (long start, unsigned c } } } else { +#ifndef UTF8 - *len = strlen ((const char *) exp); + *len = strlen ((const char *) exp); +#else /* UTF8 */ -+ *len = wcslen (exp); ++ *len = wcslen (exp); +#endif /* UTF8 */ if (replace_case) { for (p = start; p <= last_byte - l; p++) { -- if ((*get_byte) (data, p) == (unsigned char)exp[0]) { /* check if first char matches */ -+ if ((*get_byte) (data, p) == exp[0]) { /* check if first char matches */ +- if ((*get_byte) (data, p) == (unsigned char)exp[0]) { /* check if first char matches */ ++ if ((*get_byte) (data, p) == exp[0]) { /* check if first char matches */ for (f = 0, q = 0; q < l && f < 1; q++) -- if ((*get_byte) (data, q + p) != (unsigned char)exp[q]) -+ if ((*get_byte) (data, q + p) != exp[q]) +- if ((*get_byte) (data, q + p) != (unsigned char)exp[q]) ++ if ((*get_byte) (data, q + p) != exp[q]) f = 1; - if (f == 0) -+ if (f == 0) { ++ if (f == 0) { +#ifdef UTF8 -+ g_free (exp_backup); ++ g_free (exp_backup); +#endif /* UTF8 */ return p; + } } - if (once_only) -+ if (once_only) { ++ if (once_only) { +#ifdef UTF8 -+ g_free(exp_backup); ++ g_free(exp_backup); +#endif /* UTF8 */ return -2; + } @@ -1032,15 +1025,15 @@ for (p = start; p <= last_byte - l; p++) { - if (my_lower_case ((*get_byte) (data, p)) == (unsigned char)exp[0]) { -+ if (my_lower_case ((*get_byte) (data, p)) == exp[0]) { ++ if (my_lower_case ((*get_byte) (data, p)) == exp[0]) { for (f = 0, q = 0; q < l && f < 1; q++) - if (my_lower_case ((*get_byte) (data, q + p)) != (unsigned char)exp[q]) -+ if (my_lower_case ((*get_byte) (data, q + p)) != exp[q]) ++ if (my_lower_case ((*get_byte) (data, q + p)) != exp[q]) f = 1; - if (f == 0) + if (f == 0) { +#ifdef UTF8 -+ g_free (exp_backup); ++ g_free (exp_backup); +#endif /* UTF8 */ return p; + } @@ -1048,7 +1041,7 @@ - if (once_only) + if (once_only) { +#ifdef UTF8 -+ g_free (exp_backup); ++ g_free (exp_backup); +#endif /* UTF8 */ return -2; + } @@ -1061,7 +1054,7 @@ return -2; } -@@ -1597,9 +1807,14 @@ edit_find_forwards (long search_start, u +@@ -1582,9 +1792,14 @@ edit_find_forwards (long search_start, u while ((p = edit_find_string (p, exp, len, last_byte, get_byte, data, once_only, d)) >= 0) { if (replace_whole) { @@ -1076,7 +1069,7 @@ return p; if (once_only) return -2; -@@ -1631,6 +1846,7 @@ edit_find (long search_start, unsigned c +@@ -1616,6 +1831,7 @@ edit_find (long search_start, unsigned c #define is_digit(x) ((x) >= '0' && (x) <= '9') @@ -1084,7 +1077,7 @@ #define snprint(v) { \ *p1++ = *p++; \ *p1 = '\0'; \ -@@ -1638,33 +1854,48 @@ edit_find (long search_start, unsigned c +@@ -1623,33 +1839,48 @@ edit_find (long search_start, unsigned c if (n >= (size_t) (e - s)) goto nospc; \ s += n; \ } @@ -1141,7 +1134,7 @@ s += n; q = p; p1 = q1; -@@ -1692,45 +1923,78 @@ static int snprintf_p (char *str, size_t +@@ -1677,45 +1908,78 @@ static int snprintf_p (char *str, size_t *p1++ = *p++; if (*p == '*') { p++; @@ -1230,7 +1223,7 @@ snprint (*va_arg (ap, long *)); } else if (*p == 'p') { snprint (*va_arg (ap, void **)); -@@ -1739,10 +2003,17 @@ static int snprintf_p (char *str, size_t +@@ -1724,10 +1988,17 @@ static int snprintf_p (char *str, size_t q = p; } va_end (ap); @@ -1248,12 +1241,12 @@ return s + n - str; nospc: va_end (ap); -@@ -1921,8 +2192,11 @@ edit_replace_cmd (WEdit *edit, int again +@@ -1902,8 +2173,11 @@ edit_replace_cmd (WEdit *edit, int again } } if (replace_yes) { /* delete then insert new */ +#ifdef UTF8 -+ mc_wchar_t *winput2 = mbstr_to_wchar(input2); ++ mc_wchar_t *winput2 = mbstr_to_wchar(exp2); +#endif /* UTF8 */ if (replace_scanf || replace_regexp) { - char repl_str[MAX_REPL_LEN + 2]; @@ -1261,7 +1254,7 @@ int ret = 0; /* we need to fill in sargs just like with scanf */ -@@ -1931,17 +2205,25 @@ edit_replace_cmd (WEdit *edit, int again +@@ -1912,17 +2186,25 @@ edit_replace_cmd (WEdit *edit, int again for (k = 1; k < NUM_REPL_ARGS && pmatch[k].rm_eo >= 0; k++) { @@ -1288,42 +1281,49 @@ edit-> search_start - -@@ -1958,9 +2240,15 @@ edit_replace_cmd (WEdit *edit, int again +@@ -1939,13 +2221,22 @@ edit_replace_cmd (WEdit *edit, int again sargs[k - 1][0] = 0; } if (!ret) +#ifndef UTF8 - ret = - snprintf_p (repl_str, MAX_REPL_LEN + 2, input2, - PRINTF_ARGS); + ret = snprintf_p (repl_str, MAX_REPL_LEN + 2, exp2, PRINTF_ARGS); +#else /* UTF8 */ -+ ret = -+ snprintf_p (repl_str, MAX_REPL_LEN + 2, winput2, -+ PRINTF_ARGS); ++ ret = snprintf_p (repl_str, MAX_REPL_LEN + 2, winput2, PRINTF_ARGS); +#endif /* UTF8 */ if (ret >= 0) { times_replaced++; while (i--) -@@ -1980,10 +2268,18 @@ edit_replace_cmd (WEdit *edit, int again + edit_delete (edit); ++#ifndef UTF8 + while (repl_str[++i]) + edit_insert (edit, repl_str[i]); ++#else /* UTF8 */ ++ while (winput2[++i]) ++ edit_insert (edit, winput2[i]); ++#endif /* UTF8 */ + } else { + edit_error_dialog (_(" Replace "), + ret == -2 +@@ -1957,10 +2248,18 @@ edit_replace_cmd (WEdit *edit, int again times_replaced++; while (i--) edit_delete (edit); +#ifndef UTF8 - while (input2[++i]) - edit_insert (edit, input2[i]); + while (exp2[++i]) + edit_insert (edit, exp2[i]); +#else /* UTF8 */ + while (winput2[++i]) + edit_insert (edit, winput2[i]); -+#endif /* UTF8 */ ++#endif } edit->found_len = i; +#ifdef UTF8 -+ g_free (winput2); ++ g_free (winput2); +#endif /* UTF8 */ } /* so that we don't find the same string again */ if (replace_backwards) { -@@ -2157,16 +2453,17 @@ edit_ok_to_exit (WEdit *edit) +@@ -2132,16 +2431,17 @@ edit_ok_to_exit (WEdit *edit) #define TEMP_BUF_LEN 1024 /* Return a null terminated length of text. Result must be g_free'd */ @@ -1345,7 +1345,7 @@ x = edit_move_forward3 (edit, edit_bol (edit, start), 0, start); c = edit_get_byte (edit, start); -@@ -2199,11 +2496,15 @@ edit_save_block (WEdit * edit, const cha +@@ -2174,11 +2474,15 @@ edit_save_block (WEdit * edit, const cha return 0; if (column_highlighting) { @@ -1362,7 +1362,7 @@ if (r < 0) break; p += r; -@@ -2211,15 +2512,19 @@ edit_save_block (WEdit * edit, const cha +@@ -2186,15 +2490,19 @@ edit_save_block (WEdit * edit, const cha } g_free (block); } else { @@ -1384,7 +1384,7 @@ start = end; } g_free (buf); -@@ -2558,17 +2863,20 @@ edit_block_process_cmd (WEdit *edit, con +@@ -2531,17 +2839,20 @@ edit_block_process_cmd (WEdit *edit, con /* prints at the cursor */ /* returns the number of chars printed */ @@ -1407,14 +1407,14 @@ static void pipe_mail (WEdit *edit, char *to, char *subject, char *cc) { FILE *p = 0; -@@ -2662,15 +2970,20 @@ void edit_mail_dialog (WEdit * edit) +@@ -2635,15 +2946,20 @@ void edit_mail_dialog (WEdit * edit) /* find first character of current word */ static int edit_find_word_start (WEdit *edit, long *word_start, int *word_len) { - int i, c, last; + int i; + mc_wint_t c, last; - + /* return if at begin of file */ if (edit->curs1 <= 0) return 0; @@ -1427,12 +1427,12 @@ +#else /* UTF8 */ + if (iswspace (c) || !(iswalnum (c) || c == '_')) +#endif /* UTF8 */ - return 0; + return 0; /* search start of word to be completed */ -@@ -2680,11 +2993,19 @@ static int edit_find_word_start (WEdit * +@@ -2653,11 +2969,19 @@ static int edit_find_word_start (WEdit * return 0; - + last = c; - c = (unsigned char) edit_get_byte (edit, edit->curs1 - i); + c = edit_get_byte (edit, edit->curs1 - i); @@ -1451,32 +1451,34 @@ return 0; *word_start = edit->curs1 - (i - 1); /* start found */ -@@ -2717,7 +3038,7 @@ edit_collect_completions (WEdit *edit, l +@@ -2690,7 +3014,7 @@ edit_collect_completions (WEdit *edit, l int *num) { int len, max_len = 0, i, skip; -- unsigned char *bufpos; +- char *bufpos; + mc_wchar_t *bufpos; /* collect max MAX_WORD_COMPLETIONS completions */ while (*num < MAX_WORD_COMPLETIONS) { -@@ -2736,9 +3057,15 @@ edit_collect_completions (WEdit *edit, l +@@ -2711,9 +3035,16 @@ edit_collect_completions (WEdit *edit, l buffers1[start >> S_EDIT_BUF_SIZE][start & M_EDIT_BUF_SIZE]; skip = 0; for (i = 0; i < *num; i++) { +#ifndef UTF8 if (strncmp - ((char *) &compl[i].text[word_len], - (char *) &bufpos[word_len], max (len, + (&compl[i].text[word_len], &bufpos[word_len], +- max (len, compl[i].len) - word_len) == 0) { ++ max (len, +#else /* UTF8 */ + if (wcsncmp -+ ((wchar_t *) &compl[i].text[word_len], -+ (wchar_t *) &bufpos[word_len], max (len, ++ ((wchar_t *) &compl[i].text[word_len], ++ (wchar_t *) &bufpos[word_len], max (len, +#endif /* UTF8 */ - compl[i].len) - - word_len) == 0) { ++ compl[i].len) - word_len) == 0) { skip = 1; -@@ -2748,7 +3075,7 @@ edit_collect_completions (WEdit *edit, l + break; /* skip it, already added */ + } +@@ -2721,7 +3052,7 @@ edit_collect_completions (WEdit *edit, l if (skip) continue; @@ -1485,7 +1487,7 @@ compl[*num].len = len; for (i = 0; i < len; i++) compl[*num].text[i] = *(bufpos + i); -@@ -2762,6 +3089,18 @@ edit_collect_completions (WEdit *edit, l +@@ -2735,6 +3066,18 @@ edit_collect_completions (WEdit *edit, l return max_len; } @@ -1504,23 +1506,24 @@ /* let the user select its preferred completion */ static void -@@ -2774,6 +3113,9 @@ edit_completion_dialog (WEdit * edit, in +@@ -2747,6 +3090,10 @@ edit_completion_dialog (WEdit *edit, int WListbox *compl_list; - int compl_dlg_h; /* completion dialog height */ - int compl_dlg_w; /* completion dialog width */ + int compl_dlg_h; /* completion dialog height */ + int compl_dlg_w; /* completion dialog width */ +#ifdef UTF8 + char *mbtext; +#endif /* UTF8 */ ++ /* calculate the dialog metrics */ compl_dlg_h = num_compl + 2; -@@ -2809,8 +3151,16 @@ edit_completion_dialog (WEdit * edit, in +@@ -2782,8 +3129,16 @@ edit_completion_dialog (WEdit *edit, int add_widget (compl_dlg, compl_list); /* fill the listbox with the completions */ +#ifndef UTF8 for (i = 0; i < num_compl; i++) - listbox_add_item (compl_list, 0, 0, (char *) compl[i].text, NULL); + listbox_add_item (compl_list, 0, 0, compl[i].text, NULL); +#else /* UTF8 */ + for (i = 0; i < num_compl; i++) { + mbtext = wchar_to_mbstr(compl[i].text); @@ -1531,7 +1534,7 @@ /* pop up the dialog */ run_dlg (compl_dlg); -@@ -2818,9 +3168,17 @@ edit_completion_dialog (WEdit * edit, in +@@ -2791,9 +3146,17 @@ edit_completion_dialog (WEdit *edit, int /* apply the choosen completion */ if (compl_dlg->ret_value == B_ENTER) { listbox_get_current (compl_list, &curr, NULL); @@ -1550,11 +1553,11 @@ } /* destroy dialog before return */ -@@ -2837,8 +3195,9 @@ edit_complete_word_cmd (WEdit *edit) +@@ -2810,8 +3173,9 @@ edit_complete_word_cmd (WEdit *edit) { int word_len = 0, i, num_compl = 0, max_len; long word_start = 0; -- unsigned char *bufpos; +- char *bufpos; - char *match_expr; + mc_wchar_t *bufpos; + mc_wchar_t *match_expr; @@ -1562,7 +1565,7 @@ struct selection compl[MAX_WORD_COMPLETIONS]; /* completions */ /* don't want to disturb another search */ -@@ -2855,16 +3214,32 @@ edit_complete_word_cmd (WEdit *edit) +@@ -2828,16 +3192,32 @@ edit_complete_word_cmd (WEdit *edit) /* prepare match expression */ bufpos = &edit->buffers1[word_start >> S_EDIT_BUF_SIZE] [word_start & M_EDIT_BUF_SIZE]; @@ -1595,18 +1598,18 @@ if (num_compl > 0) { /* insert completed word if there is only one match */ ---- mc-4.6.1a/edit/edit.c.utf8 2005-05-27 05:35:12.000000000 +0200 -+++ mc-4.6.1a/edit/edit.c 2005-06-06 14:46:19.168252304 +0200 -@@ -102,7 +102,7 @@ char *option_backup_ext = "~"; - static void edit_move_to_prev_col (WEdit *edit, long p); - static void user_menu (WEdit *edit); +--- mc-4.6.1-pre5/edit/edit.c.utf8 2005-05-27 16:19:18.000000000 +0200 ++++ mc-4.6.1-pre5/edit/edit.c 2005-07-08 11:22:41.900087400 +0200 +@@ -93,7 +93,7 @@ static void user_menu (WEdit *edit); + + #ifndef NO_INLINE_GETBYTE -int edit_get_byte (WEdit * edit, long byte_index) +mc_wchar_t edit_get_byte (WEdit * edit, long byte_index) { unsigned long p; if (byte_index >= (edit->curs1 + edit->curs2) || byte_index < 0) -@@ -131,7 +131,7 @@ edit_init_buffers (WEdit *edit) +@@ -125,7 +125,7 @@ edit_init_buffers (WEdit *edit) edit->curs1 = 0; edit->curs2 = 0; @@ -1615,7 +1618,7 @@ } /* -@@ -156,7 +156,7 @@ edit_load_file_fast (WEdit *edit, const +@@ -152,7 +152,7 @@ edit_load_file_fast (WEdit *edit, const } if (!edit->buffers2[buf2]) @@ -1624,7 +1627,7 @@ mc_read (file, (char *) edit->buffers2[buf2] + EDIT_BUF_SIZE - -@@ -166,7 +166,7 @@ edit_load_file_fast (WEdit *edit, const +@@ -162,7 +162,7 @@ edit_load_file_fast (WEdit *edit, const for (buf = buf2 - 1; buf >= 0; buf--) { /* edit->buffers2[0] is already allocated */ if (!edit->buffers2[buf]) @@ -1633,7 +1636,7 @@ mc_read (file, (char *) edit->buffers2[buf], EDIT_BUF_SIZE); } -@@ -239,9 +239,44 @@ edit_insert_stream (WEdit * edit, FILE * +@@ -242,9 +242,44 @@ edit_insert_stream (WEdit * edit, FILE * { int c; long i = 0; @@ -1679,7 +1682,7 @@ } return i; } -@@ -249,9 +284,32 @@ edit_insert_stream (WEdit * edit, FILE * +@@ -252,9 +287,32 @@ edit_insert_stream (WEdit * edit, FILE * long edit_write_stream (WEdit * edit, FILE * f) { long i; @@ -1712,7 +1715,7 @@ return i; } -@@ -290,12 +348,46 @@ edit_insert_file (WEdit *edit, const cha +@@ -294,12 +352,46 @@ edit_insert_file (WEdit *edit, const cha int i, file, blocklen; long current = edit->curs1; unsigned char *buf; @@ -1759,7 +1762,7 @@ } edit_cursor_move (edit, current - edit->curs1); g_free (buf); -@@ -385,7 +477,11 @@ cleanup: +@@ -393,7 +485,11 @@ check_file_access (WEdit *edit, const ch static int edit_load_file (WEdit *edit) { @@ -1771,7 +1774,7 @@ /* Cannot do fast load if a filter is used */ if (edit_find_filter (edit->filename) >= 0) -@@ -532,7 +628,7 @@ edit_init (WEdit *edit, int lines, int c +@@ -540,7 +636,7 @@ edit_init (WEdit *edit, int lines, int c edit_set_filename (edit, filename); edit->stack_size = START_STACK_SIZE; edit->stack_size_mask = START_STACK_SIZE - 1; @@ -1780,7 +1783,7 @@ if (edit_load_file (edit)) { /* edit_load_file already gives an error message */ if (to_free) -@@ -557,7 +653,7 @@ edit_init (WEdit *edit, int lines, int c +@@ -565,7 +661,7 @@ edit_init (WEdit *edit, int lines, int c edit_move_display (edit, line - 1); edit_move_to_line (edit, line - 1); } @@ -1789,7 +1792,7 @@ return edit; } -@@ -685,13 +781,23 @@ void edit_push_action (WEdit * edit, lon +@@ -693,13 +789,23 @@ void edit_push_action (WEdit * edit, lon { unsigned long sp = edit->stack_pointer; unsigned long spm1; @@ -1815,7 +1818,7 @@ if (t) { edit->undo_stack = t; edit->stack_size <<= 1; -@@ -706,7 +812,7 @@ void edit_push_action (WEdit * edit, lon +@@ -714,7 +820,7 @@ void edit_push_action (WEdit * edit, lon #ifdef FAST_MOVE_CURSOR if (c == CURS_LEFT_LOTS || c == CURS_RIGHT_LOTS) { va_list ap; @@ -1824,7 +1827,7 @@ edit->stack_pointer = (edit->stack_pointer + 1) & edit->stack_size_mask; va_start (ap, c); c = -(va_arg (ap, int)); -@@ -717,12 +823,14 @@ void edit_push_action (WEdit * edit, lon +@@ -725,12 +831,14 @@ void edit_push_action (WEdit * edit, lon && spm1 != edit->stack_bottom && ((sp - 2) & edit->stack_size_mask) != edit->stack_bottom) { int d; @@ -1844,7 +1847,7 @@ return; } } -@@ -730,19 +838,20 @@ void edit_push_action (WEdit * edit, lon +@@ -738,19 +846,20 @@ void edit_push_action (WEdit * edit, lon #ifndef NO_STACK_CURSMOVE_ANIHILATION else if ((c == CURS_LEFT && d == CURS_RIGHT) || (c == CURS_RIGHT && d == CURS_LEFT)) { /* a left then a right anihilate each other */ @@ -1870,7 +1873,7 @@ goto check_bottom; } #ifndef NO_STACK_CURSMOVE_ANIHILATION -@@ -754,7 +863,9 @@ void edit_push_action (WEdit * edit, lon +@@ -762,7 +871,9 @@ void edit_push_action (WEdit * edit, lon #endif } } @@ -1881,7 +1884,7 @@ check_bottom: edit->stack_pointer = (edit->stack_pointer + 1) & edit->stack_size_mask; -@@ -767,10 +878,10 @@ void edit_push_action (WEdit * edit, lon +@@ -775,10 +886,10 @@ void edit_push_action (WEdit * edit, lon (((unsigned long) c + 1) & edit->stack_size_mask) == edit->stack_bottom) do { edit->stack_bottom = (edit->stack_bottom + 1) & edit->stack_size_mask; @@ -1894,7 +1897,7 @@ edit->stack_bottom = edit->stack_pointer = 0; } -@@ -779,30 +890,30 @@ void edit_push_action (WEdit * edit, lon +@@ -787,30 +898,30 @@ void edit_push_action (WEdit * edit, lon then the file should be as it was when he loaded up. Then set edit->modified to 0. */ static long @@ -1936,7 +1939,7 @@ } /* is called whenever a modification is made by one of the four routines below */ -@@ -823,7 +934,7 @@ static inline void edit_modification (WE +@@ -831,7 +942,7 @@ static inline void edit_modification (WE */ void @@ -1945,7 +1948,7 @@ { /* check if file has grown to large */ if (edit->last_byte >= SIZE_LIMIT) -@@ -861,12 +972,11 @@ edit_insert (WEdit *edit, int c) +@@ -869,12 +980,11 @@ edit_insert (WEdit *edit, int c) /* add a new buffer if we've reached the end of the last one */ if (!(edit->curs1 & M_EDIT_BUF_SIZE)) edit->buffers1[edit->curs1 >> S_EDIT_BUF_SIZE] = @@ -1961,7 +1964,7 @@ /* update file length */ edit->last_byte++; -@@ -877,7 +987,7 @@ edit_insert (WEdit *edit, int c) +@@ -885,7 +995,7 @@ edit_insert (WEdit *edit, int c) /* same as edit_insert and move left */ @@ -1970,7 +1973,7 @@ { if (edit->last_byte >= SIZE_LIMIT) return; -@@ -900,7 +1010,7 @@ void edit_insert_ahead (WEdit * edit, in +@@ -908,7 +1018,7 @@ void edit_insert_ahead (WEdit * edit, in edit->last_get_rule += (edit->last_get_rule >= edit->curs1); if (!((edit->curs2 + 1) & M_EDIT_BUF_SIZE)) @@ -1979,7 +1982,7 @@ edit->buffers2[edit->curs2 >> S_EDIT_BUF_SIZE][EDIT_BUF_SIZE - (edit->curs2 & M_EDIT_BUF_SIZE) - 1] = c; edit->last_byte++; -@@ -910,7 +1020,7 @@ void edit_insert_ahead (WEdit * edit, in +@@ -918,7 +1028,7 @@ void edit_insert_ahead (WEdit * edit, in int edit_delete (WEdit * edit) { @@ -1988,7 +1991,7 @@ if (!edit->curs2) return 0; -@@ -934,7 +1044,7 @@ int edit_delete (WEdit * edit) +@@ -942,7 +1052,7 @@ int edit_delete (WEdit * edit) edit->total_lines--; edit->force |= REDRAW_AFTER_CURSOR; } @@ -1997,7 +2000,7 @@ if (edit->curs1 < edit->start_display) { edit->start_display--; if (p == '\n') -@@ -948,7 +1058,7 @@ int edit_delete (WEdit * edit) +@@ -956,7 +1066,7 @@ int edit_delete (WEdit * edit) static int edit_backspace (WEdit * edit) { @@ -2006,7 +2009,7 @@ if (!edit->curs1) return 0; -@@ -972,7 +1082,7 @@ edit_backspace (WEdit * edit) +@@ -980,7 +1090,7 @@ edit_backspace (WEdit * edit) edit->total_lines--; edit->force |= REDRAW_AFTER_CURSOR; } @@ -2015,7 +2018,7 @@ if (edit->curs1 < edit->start_display) { edit->start_display--; -@@ -985,10 +1095,18 @@ edit_backspace (WEdit * edit) +@@ -993,10 +1103,18 @@ edit_backspace (WEdit * edit) #ifdef FAST_MOVE_CURSOR @@ -2035,7 +2038,7 @@ edit->curs_line--; next -= (unsigned long) dest; n -= next; -@@ -1001,7 +1119,7 @@ int +@@ -1009,7 +1127,7 @@ int edit_move_backward_lots (WEdit *edit, long increment) { int r, s, t; @@ -2044,7 +2047,7 @@ if (increment > edit->curs1) increment = edit->curs1; -@@ -1041,7 +1159,7 @@ edit_move_backward_lots (WEdit *edit, lo +@@ -1049,7 +1167,7 @@ edit_move_backward_lots (WEdit *edit, lo edit->buffers2[edit->curs2 >> S_EDIT_BUF_SIZE] = p; else edit->buffers2[edit->curs2 >> S_EDIT_BUF_SIZE] = @@ -2053,7 +2056,7 @@ } else { g_free (p); } -@@ -1079,7 +1197,7 @@ edit_move_backward_lots (WEdit *edit, lo +@@ -1087,7 +1205,7 @@ edit_move_backward_lots (WEdit *edit, lo edit->buffers2[edit->curs2 >> S_EDIT_BUF_SIZE] = p; else edit->buffers2[edit->curs2 >> S_EDIT_BUF_SIZE] = @@ -2062,7 +2065,7 @@ } else { g_free (p); } -@@ -1111,7 +1229,7 @@ int edit_cursor_move (WEdit * edit, long +@@ -1119,7 +1237,7 @@ int edit_cursor_move (WEdit * edit, long c = edit_get_byte (edit, edit->curs1 - 1); if (!((edit->curs2 + 1) & M_EDIT_BUF_SIZE)) @@ -2071,7 +2074,7 @@ edit->buffers2[edit->curs2 >> S_EDIT_BUF_SIZE][EDIT_BUF_SIZE - (edit->curs2 & M_EDIT_BUF_SIZE) - 1] = c; edit->curs2++; c = edit->buffers1[(edit->curs1 - 1) >> S_EDIT_BUF_SIZE][(edit->curs1 - 1) & M_EDIT_BUF_SIZE]; -@@ -1136,7 +1254,7 @@ int edit_cursor_move (WEdit * edit, long +@@ -1144,7 +1262,7 @@ int edit_cursor_move (WEdit * edit, long c = edit_get_byte (edit, edit->curs1); if (!(edit->curs1 & M_EDIT_BUF_SIZE)) @@ -2080,7 +2083,7 @@ edit->buffers1[edit->curs1 >> S_EDIT_BUF_SIZE][edit->curs1 & M_EDIT_BUF_SIZE] = c; edit->curs1++; c = edit->buffers2[(edit->curs2 - 1) >> S_EDIT_BUF_SIZE][EDIT_BUF_SIZE - ((edit->curs2 - 1) & M_EDIT_BUF_SIZE) - 1]; -@@ -1243,7 +1361,7 @@ long edit_move_forward3 (WEdit * edit, l +@@ -1251,7 +1369,7 @@ long edit_move_forward3 (WEdit * edit, l q = edit->last_byte + 2; for (col = 0, p = current; p < q; p++) { @@ -2089,7 +2092,7 @@ if (cols != -10) { if (col == cols) return p; -@@ -1261,7 +1379,7 @@ long edit_move_forward3 (WEdit * edit, l +@@ -1269,7 +1387,7 @@ long edit_move_forward3 (WEdit * edit, l } else if (c < 32 || c == 127) col += 2; /* Caret notation for control characters */ else @@ -2098,7 +2101,7 @@ } return col; } -@@ -1394,7 +1512,7 @@ static int +@@ -1402,7 +1520,7 @@ static int is_blank (WEdit *edit, long offset) { long s, f; @@ -2107,7 +2110,7 @@ s = edit_bol (edit, offset); f = edit_eol (edit, offset) - 1; while (s <= f) { -@@ -1766,13 +1884,13 @@ static void edit_left_delete_word (WEdit +@@ -1774,13 +1892,13 @@ static void edit_left_delete_word (WEdit static void edit_do_undo (WEdit * edit) { @@ -2124,7 +2127,7 @@ case STACK_BOTTOM: goto done_undo; case CURS_RIGHT: -@@ -1793,31 +1911,33 @@ edit_do_undo (WEdit * edit) +@@ -1801,31 +1919,33 @@ edit_do_undo (WEdit * edit) case COLUMN_OFF: column_highlighting = 0; break; @@ -2171,7 +2174,7 @@ edit_update_curs_row (edit); done_undo:; -@@ -2094,7 +2214,7 @@ static void edit_goto_matching_bracket ( +@@ -2102,7 +2222,7 @@ static void edit_goto_matching_bracket ( * passed as -1. Commands are executed, and char_for_insertion is * inserted at the cursor. */ @@ -2180,7 +2183,7 @@ { if (command == CK_Begin_Record_Macro) { edit->macro_i = 0; -@@ -2129,7 +2249,7 @@ static const char * const shell_cmd[] = +@@ -2137,7 +2257,7 @@ static const char * const shell_cmd[] = all of them. It also does not check for the Undo command. */ void @@ -2189,7 +2192,7 @@ { edit->force |= REDRAW_LINE; -@@ -2162,7 +2282,7 @@ edit_execute_cmd (WEdit *edit, int comma +@@ -2170,7 +2290,7 @@ edit_execute_cmd (WEdit *edit, int comma } /* An ordinary key press */ @@ -2198,9 +2201,9 @@ if (edit->overwrite) { if (edit_get_byte (edit, edit->curs1) != '\n') edit_delete (edit); ---- mc-4.6.1a/edit/edit-widget.h.utf8 2005-05-11 01:04:32.000000000 +0200 -+++ mc-4.6.1a/edit/edit-widget.h 2005-06-06 14:46:19.169252152 +0200 -@@ -25,6 +25,11 @@ struct syntax_rule { +--- mc-4.6.1-pre5/edit/edit-widget.h.utf8 2003-10-29 09:54:47.000000000 +0100 ++++ mc-4.6.1-pre5/edit/edit-widget.h 2005-07-08 11:22:41.900087400 +0200 +@@ -24,6 +24,11 @@ struct syntax_rule { unsigned char border; }; @@ -2212,7 +2215,7 @@ struct WEdit { Widget widget; -@@ -37,8 +42,17 @@ struct WEdit { +@@ -36,8 +41,17 @@ struct WEdit { /* dynamic buffers and cursor position for editor: */ long curs1; /* position of the cursor from the beginning of the file. */ long curs2; /* position from the end of the file */ @@ -2230,7 +2233,7 @@ /* search variables */ long search_start; /* First character to start searching from */ -@@ -82,7 +96,7 @@ struct WEdit { +@@ -81,7 +95,7 @@ struct WEdit { /* undo stack and pointers */ unsigned long stack_pointer; @@ -2239,11 +2242,11 @@ unsigned long stack_size; unsigned long stack_size_mask; unsigned long stack_bottom; ---- mc-4.6.1a/edit/edit.h.utf8 2005-05-27 05:35:12.000000000 +0200 -+++ mc-4.6.1a/edit/edit.h 2005-06-06 14:46:19.169252152 +0200 -@@ -23,6 +23,27 @@ - #ifndef MC_EDIT_H - #define MC_EDIT_H +--- mc-4.6.1-pre5/edit/edit.h.utf8 2005-05-27 16:19:18.000000000 +0200 ++++ mc-4.6.1-pre5/edit/edit.h 2005-07-08 11:22:41.901087248 +0200 +@@ -39,6 +39,27 @@ + + #include "../src/global.h" +#include "src/tty.h" + @@ -2268,41 +2271,17 @@ + #define N_menus 5 - #define SEARCH_DIALOG_OPTION_NO_SCANF (1 << 0) -@@ -83,18 +104,20 @@ + #define SEARCH_DIALOG_OPTION_NO_SCANF 1 +@@ -99,6 +120,8 @@ #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 -+#define CHAR_INSERT 65 -+#define CHAR_INSERT_AHEAD 66 -+#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 -@@ -102,7 +125,7 @@ ++#define CHAR_INSERT 65 ++#define CHAR_INSERT_AHEAD 66 + #define CURS_LEFT 601 + #define CURS_RIGHT 602 + #define DELCHAR 603 +@@ -118,7 +141,7 @@ struct macro { short command; @@ -2311,18 +2290,36 @@ }; struct WEdit; -@@ -117,8 +140,8 @@ void edit_reload_menu (void); +@@ -132,26 +155,8 @@ void edit_done_menu (void); void menu_save_mode_cmd (void); int edit_raw_key_query (const char *heading, const char *query, int cancel); int edit_file (const char *_file, int line); -int edit_translate_key (WEdit *edit, long x_key, int *cmd, int *ch); +- +-#ifndef NO_INLINE_GETBYTE -int edit_get_byte (WEdit * edit, long byte_index); +-#else +-static inline int edit_get_byte (WEdit * edit, long byte_index) +-{ +- unsigned long p; +- if (byte_index >= (edit->curs1 + edit->curs2) || byte_index < 0) +- return '\n'; +- +- if (byte_index >= edit->curs1) { +- p = edit->curs1 + edit->curs2 - byte_index - 1; +- return edit->buffers2[p >> S_EDIT_BUF_SIZE][EDIT_BUF_SIZE - (p & M_EDIT_BUF_SIZE) - 1]; +- } else { +- return edit->buffers1[byte_index >> S_EDIT_BUF_SIZE][byte_index & M_EDIT_BUF_SIZE]; +- } +-} +-#endif +- +int edit_translate_key (WEdit *edit, long x_key, int *cmd, mc_wint_t *ch); +mc_wchar_t edit_get_byte (WEdit * edit, long byte_index); 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); -@@ -143,11 +166,11 @@ int edit_block_delete_cmd (WEdit * edit) +@@ -176,11 +181,11 @@ int edit_block_delete_cmd (WEdit * edit) void edit_delete_line (WEdit * edit); int edit_delete (WEdit * edit); @@ -2336,7 +2333,7 @@ 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); -@@ -178,7 +201,7 @@ void edit_goto_cmd (WEdit * edit); +@@ -212,7 +217,7 @@ 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, @@ -2345,7 +2342,7 @@ void edit_update_screen (WEdit * edit); int edit_print_string (WEdit * e, const char *s); void edit_move_to_line (WEdit * e, long line); -@@ -222,7 +245,7 @@ void edit_mail_dialog (WEdit *edit); +@@ -256,7 +261,7 @@ void edit_mail_dialog (WEdit *edit); void format_paragraph (WEdit *edit, int force); /* either command or char_for_insertion must be passed as -1 */ @@ -2354,9 +2351,9 @@ #define get_sys_error(s) (s) ---- mc-4.6.1a/src/help.c.utf8 2005-05-27 05:35:15.000000000 +0200 -+++ mc-4.6.1a/src/help.c 2005-06-06 14:46:19.170252000 +0200 -@@ -449,10 +449,28 @@ static void help_show (Dlg_head *h, cons +--- mc-4.6.1-pre5/src/help.c.utf8 2005-05-27 16:19:18.000000000 +0200 ++++ mc-4.6.1-pre5/src/help.c 2005-07-08 11:22:41.902087096 +0200 +@@ -445,10 +445,28 @@ static void help_show (Dlg_head *h, cons #ifndef HAVE_SLANG addch (acs_map [c]); #else @@ -2385,7 +2382,7 @@ col++; break; } -@@ -798,6 +816,12 @@ interactive_display (const char *filenam +@@ -771,6 +789,12 @@ interactive_display (const char *filenam message (1, MSG_ERROR, _(" Cannot open file %s \n %s "), filename ? filename : hlpfile, unix_error_string (errno)); } @@ -2398,9 +2395,9 @@ if (!filename) g_free (hlpfile); ---- mc-4.6.1a/src/learn.c.utf8 2005-05-27 05:35:15.000000000 +0200 -+++ mc-4.6.1a/src/learn.c 2005-06-06 14:46:19.171251848 +0200 -@@ -237,7 +237,7 @@ init_learn (void) +--- mc-4.6.1-pre5/src/learn.c.utf8 2005-05-27 16:19:18.000000000 +0200 ++++ mc-4.6.1-pre5/src/learn.c 2005-07-08 11:22:41.902087096 +0200 +@@ -236,7 +236,7 @@ init_learn (void) learn_but[0].x = 78 / 2 + 4; learn_but[1].text = _(learn_but[1].text); @@ -2409,22 +2406,22 @@ learn_title = _(learn_title); i18n_flag = 1; ---- mc-4.6.1a/src/main.c.utf8 2005-05-29 13:54:22.000000000 +0200 -+++ mc-4.6.1a/src/main.c 2005-06-06 14:46:19.172251696 +0200 -@@ -1613,7 +1613,11 @@ update_xterm_title_path (void) +--- mc-4.6.1-pre5/src/main.c.utf8 2005-07-01 17:47:06.000000000 +0200 ++++ mc-4.6.1-pre5/src/main.c 2005-07-08 11:22:41.904086792 +0200 +@@ -1609,7 +1609,11 @@ update_xterm_title_path (void) if (xterm_flag && xterm_title) { p = s = g_strdup (strip_home_and_password (current_panel->cwd)); do { +#ifndef UTF8 - if (!is_printable ((unsigned char) *s)) + if (!is_printable (*s)) +#else /* UTF8 */ + if (*s < ' ') +#endif /* UTF8 */ *s = '?'; } while (*++s); fprintf (stdout, "\33]0;mc - %s\7", p); ---- mc-4.6.1a/src/myslang.h.utf8 2005-03-19 18:27:36.000000000 +0100 -+++ mc-4.6.1a/src/myslang.h 2005-06-06 14:46:19.173251544 +0200 +--- mc-4.6.1-pre5/src/myslang.h.utf8 2004-10-12 06:32:04.000000000 +0200 ++++ mc-4.6.1-pre5/src/myslang.h 2005-07-08 11:22:41.904086792 +0200 @@ -11,6 +11,10 @@ #endif /* HAVE_SLANG_SLANG_H */ #endif @@ -2436,29 +2433,21 @@ enum { KEY_BACKSPACE = 400, KEY_END, KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT, ---- mc-4.6.1a/src/util.c.utf8 2005-05-27 05:35:15.000000000 +0200 -+++ mc-4.6.1a/src/util.c 2005-06-06 14:46:19.174251392 +0200 -@@ -24,6 +24,9 @@ - #include - +--- mc-4.6.1-pre5/src/util.c.utf8 2005-05-27 16:19:18.000000000 +0200 ++++ mc-4.6.1-pre5/src/util.c 2005-07-08 11:22:41.906086488 +0200 +@@ -32,7 +32,11 @@ + #include + #include #include +#include +#include -+#include - #include - #include - #include -@@ -33,7 +36,9 @@ - #include - #include - #include +#include +#include "tty.h" #include "global.h" #include "profile.h" #include "main.h" /* mc_home */ -@@ -45,6 +50,10 @@ +@@ -44,6 +48,10 @@ #include "charsets.h" #endif @@ -2469,7 +2458,7 @@ static const char app_text [] = "Midnight-Commander"; int easy_patterns = 1; -@@ -78,9 +87,106 @@ is_8bit_printable (unsigned char c) +@@ -77,9 +85,106 @@ is_8bit_printable (unsigned char c) return (c > 31 && c != 127 && c != 155); } @@ -2576,28 +2565,37 @@ c &= 0xff; #ifdef HAVE_CHARSET -@@ -110,8 +216,18 @@ void msglen (const char *text, int *line - nlines++; - colindex = 0; +@@ -97,7 +202,7 @@ is_printable (int c) + #endif /* !HAVE_CHARSET */ + } + +-/* Returns the message dimensions (lines and columns) */ ++/* Returns the message dimensions columns */ + int msglen (const char *text, int *lines) + { + int max = 0; +@@ -108,8 +213,18 @@ int msglen (const char *text, int *lines + line_len = 0; + (*lines)++; } else { -- colindex++; -- if (colindex > ncolumns) +- line_len++; +- if (line_len > max) +#ifdef UTF8 -+ size_t len; -+ wchar_t c; ++ size_t len; ++ wchar_t c; + -+ len = mbrtowc (&c, text, MB_CUR_MAX, NULL); -+ if (len > 0 && len != (size_t)(-1) && len != (size_t)(-2)) { -+ int wcsize = wcwidth(c); -+ colindex += wcsize > 0 ? wcsize-1 : -1; -+ text += len-1; -+ } ++ len = mbrtowc (&c, text, MB_CUR_MAX, NULL); ++ if (len > 0 && len != (size_t)(-1) && len != (size_t)(-2)) { ++ int wcsize = wcwidth(c); ++ line_len += wcsize > 0 ? wcsize-1 : -1; ++ text += len-1; ++ } +#endif -+ if (++colindex > ncolumns) - ncolumns = colindex; ++ if (++line_len > max) + max = line_len; } } -@@ -205,7 +321,24 @@ name_quote (const char *s, int quote_per +@@ -201,7 +316,24 @@ name_quote (const char *s, int quote_per *d++ = '\\'; break; } @@ -2622,7 +2620,7 @@ } *d = '\0'; return ret; -@@ -227,25 +360,90 @@ const char * +@@ -222,25 +354,90 @@ const char * name_trunc (const char *txt, int trunc_len) { static char x[MC_MAXPATHLEN + MC_MAXPATHLEN]; @@ -2727,7 +2725,7 @@ return x; } -@@ -650,11 +848,61 @@ char *load_file (const char *filename) +@@ -650,11 +847,61 @@ char *load_file (const char *filename) } char * @@ -2789,7 +2787,7 @@ hintfile_base = concat_dir_and_file (mc_home, filename); lang = guess_message_value (); -@@ -687,7 +935,10 @@ load_mc_home_file (const char *filename, +@@ -687,7 +934,10 @@ load_mc_home_file (const char *filename, else g_free (hintfile); @@ -2801,7 +2799,7 @@ } /* Check strftime() results. Some systems (i.e. Solaris) have different -@@ -695,12 +946,14 @@ short-month-name sizes for different loc +@@ -695,12 +945,14 @@ short-month-name sizes for different loc size_t i18n_checktimelength (void) { size_t length, a, b; @@ -2820,7 +2818,7 @@ length = max (a, b); /* Don't handle big differences. Use standard value (email bug, please) */ -@@ -712,15 +965,12 @@ size_t i18n_checktimelength (void) +@@ -712,15 +964,12 @@ size_t i18n_checktimelength (void) const char *file_date (time_t when) { @@ -2838,7 +2836,7 @@ /* strftime() format string for old dates */ fmtyear = _("%b %e %Y"); /* strftime() format string for recent dates */ -@@ -740,7 +990,7 @@ const char *file_date (time_t when) +@@ -740,7 +989,7 @@ const char *file_date (time_t when) else fmt = fmttime; @@ -2847,7 +2845,7 @@ return timebuf; } -@@ -863,10 +1113,27 @@ char *strip_ctrl_codes (char *s) +@@ -863,10 +1112,27 @@ char *strip_ctrl_codes (char *s) r++; continue; } @@ -2876,9 +2874,9 @@ } *w = 0; return s; ---- mc-4.6.1a/src/util.h.utf8 2005-05-23 13:21:26.000000000 +0200 -+++ mc-4.6.1a/src/util.h 2005-06-06 14:46:19.175251240 +0200 -@@ -109,6 +109,13 @@ void init_uid_gid_cache (void); +--- mc-4.6.1-pre5/src/util.h.utf8 2005-01-13 20:20:47.000000000 +0100 ++++ mc-4.6.1-pre5/src/util.h 2005-07-08 11:22:41.907086336 +0200 +@@ -93,6 +93,13 @@ void init_uid_gid_cache (void); char *get_group (int); char *get_owner (int); @@ -2892,10 +2890,10 @@ #define MAX_I18NTIMELENGTH 14 #define MIN_I18NTIMELENGTH 10 #define STD_I18NTIMELENGTH 12 ---- mc-4.6.1a/src/widget.c.utf8 2005-05-27 05:35:15.000000000 +0200 -+++ mc-4.6.1a/src/widget.c 2005-06-06 14:51:52.342602104 +0200 -@@ -35,6 +35,9 @@ - +--- mc-4.6.1-pre5/src/widget.c.utf8 2005-05-27 16:19:19.000000000 +0200 ++++ mc-4.6.1-pre5/src/widget.c 2005-07-08 11:22:41.909086032 +0200 +@@ -33,6 +33,9 @@ + #include #include "global.h" #include "tty.h" +#ifdef UTF8 @@ -2904,7 +2902,7 @@ #include "color.h" #include "mouse.h" #include "dialog.h" -@@ -153,6 +156,11 @@ button_callback (Widget *w, widget_msg_t +@@ -148,6 +151,11 @@ button_callback (WButton *b, widget_msg_ if (b->hotpos >= 0) { attrset ((b->selected) ? HOT_FOCUSC : HOT_NORMALC); widget_move (&b->widget, 0, b->hotpos + off); @@ -2916,7 +2914,7 @@ addch ((unsigned char) b->text[b->hotpos]); } return MSG_HANDLED; -@@ -186,7 +194,7 @@ button_event (Gpm_Event *event, void *da +@@ -179,7 +187,7 @@ button_event (Gpm_Event *event, WButton static int button_len (const char *text, unsigned int flags) { @@ -2925,7 +2923,7 @@ switch (flags){ case DEFPUSH_BUTTON: ret += 6; -@@ -209,14 +217,36 @@ button_len (const char *text, unsigned i +@@ -202,14 +210,36 @@ button_len (const char *text, unsigned i * the button text is g_malloc()ed, we can safely change and shorten it. */ static void @@ -2937,10 +2935,10 @@ if (cp != NULL && cp[1] != '\0') { - g_strlcpy (cp, cp + 1, strlen (cp)); -- b->hotkey = tolower ((unsigned char) *cp); +- b->hotkey = tolower (*cp); - b->hotpos = cp - b->text; +#ifdef UTF8 -+ if (SLsmg_Is_Unicode) { ++ if (SLsmg_Is_Unicode) { + mbstate_t s; + int len; + @@ -2967,7 +2965,7 @@ } } -@@ -237,8 +267,9 @@ button_new (int y, int x, int action, in +@@ -231,22 +261,23 @@ button_new (int y, int x, int action, in widget_want_hotkey (b->widget, 1); b->hotkey = 0; b->hotpos = -1; @@ -2978,7 +2976,6 @@ return b; } -@@ -251,14 +282,14 @@ button_get_text (WButton *b) void button_set_text (WButton *b, const char *text) { @@ -2994,9 +2991,9 @@ - + /* Radio button widget */ - static int radio_event (Gpm_Event *event, void *); + static int radio_event (Gpm_Event *event, WRadio *r); -@@ -333,16 +364,37 @@ radio_callback (Widget *w, widget_msg_t +@@ -320,16 +351,37 @@ radio_callback (WRadio *r, int msg, int widget_move (&r->widget, i, 0); printw ("(%c) ", (r->sel == i) ? '*' : ' '); @@ -3043,7 +3040,7 @@ } return MSG_HANDLED; -@@ -381,7 +433,7 @@ radio_new (int y, int x, int count, cons +@@ -365,7 +417,7 @@ radio_new (int y, int x, int count, cons /* Compute the longest string */ max = 0; for (i = 0; i < count; i++){ @@ -3052,7 +3049,7 @@ if (m > max) max = m; } -@@ -442,6 +494,11 @@ check_callback (Widget *w, widget_msg_t +@@ -426,6 +478,11 @@ check_callback (WCheck *c, widget_msg_t if (c->hotpos >= 0) { attrset ((msg == WIDGET_FOCUS) ? HOT_FOCUSC : HOT_NORMALC); widget_move (&c->widget, 0, +c->hotpos + 4); @@ -3064,17 +3061,17 @@ addch ((unsigned char) c->text[c->hotpos]); } return MSG_HANDLED; -@@ -479,31 +536,17 @@ WCheck * +@@ -460,32 +517,18 @@ WCheck * check_new (int y, int x, int state, const char *text) { WCheck *c = g_new (WCheck, 1); - const char *s; - char *t; -- + - init_widget (&c->widget, y, x, 1, strlen (text), -+ + init_widget (&c->widget, y, x, 1, mbstrlen (text), - check_callback, check_event); + (callback_fn)check_callback, + (mouse_h) check_event); c->state = state ? C_BOOL : 0; c->text = g_strdup (text); c->hotkey = 0; @@ -3090,7 +3087,7 @@ - } - s++; - if (*s){ -- c->hotkey = tolower ((unsigned char) *s); +- c->hotkey = tolower (*s); - c->hotpos = t - c->text; - } - *t = *s; @@ -3100,7 +3097,7 @@ return c; } -@@ -546,7 +589,7 @@ label_callback (Widget *w, widget_msg_t +@@ -527,7 +570,7 @@ label_callback (WLabel *l, int msg, int } widget_move (&l->widget, y, 0); printw ("%s", p); @@ -3109,7 +3106,7 @@ if (xlen > 0) printw ("%*s", xlen, " "); if (!q) -@@ -580,7 +623,7 @@ label_set_text (WLabel *label, const cha +@@ -561,7 +604,7 @@ label_set_text (WLabel *label, const cha if (text){ label->text = g_strdup (text); if (label->auto_adjust_cols) { @@ -3118,7 +3115,7 @@ if (newcols > label->widget.cols) label->widget.cols = newcols; } -@@ -604,7 +647,7 @@ label_new (int y, int x, const char *tex +@@ -585,7 +628,7 @@ label_new (int y, int x, const char *tex if (!text || strchr(text, '\n')) width = 1; else @@ -3126,8 +3123,8 @@ + width = mbstrlen (text); l = g_new (WLabel, 1); - init_widget (&l->widget, y, x, 1, width, label_callback, NULL); -@@ -752,13 +795,69 @@ static void draw_history_button (WInput + init_widget (&l->widget, y, x, 1, width, +@@ -734,13 +777,69 @@ static void draw_history_button (WInput /* Pointer to killed data */ static char *kill_buffer = 0; @@ -3199,7 +3196,7 @@ if (should_show_history_button (in)) has_history = HISTORY_BUTTON_WIDTH; -@@ -768,7 +867,7 @@ update_input (WInput *in, int clear_firs +@@ -750,7 +849,7 @@ update_input (WInput *in, int clear_firs /* Make the point visible */ if ((in->point < in->first_shown) || @@ -3208,7 +3205,7 @@ in->first_shown = in->point - (in->field_len / 3); if (in->first_shown < 0) in->first_shown = 0; -@@ -788,14 +887,29 @@ update_input (WInput *in, int clear_firs +@@ -770,14 +869,29 @@ update_input (WInput *in, int clear_firs addch (' '); widget_move (&in->widget, 0, 0); @@ -3240,7 +3237,7 @@ if (clear_first) in->first = 0; -@@ -937,7 +1051,7 @@ char * +@@ -919,7 +1033,7 @@ char * show_hist (GList *history, int widget_x, int widget_y) { GList *hi, *z; @@ -3249,7 +3246,7 @@ int x, y, w, h; char *q, *r = 0; Dlg_head *query_dlg; -@@ -950,7 +1064,7 @@ show_hist (GList *history, int widget_x, +@@ -932,7 +1046,7 @@ show_hist (GList *history, int widget_x, z = g_list_first (history); hi = z; while (hi) { @@ -3258,7 +3255,7 @@ maxlen = i; count++; hi = g_list_next (hi); -@@ -1122,35 +1236,83 @@ new_input (WInput *in) +@@ -1104,35 +1218,83 @@ new_input (WInput *in) in->need_push = 1; in->buffer [0] = 0; in->point = 0; @@ -3345,7 +3342,7 @@ return MSG_HANDLED; } -@@ -1158,12 +1320,14 @@ static void +@@ -1140,12 +1302,14 @@ static void beginning_of_line (WInput *in) { in->point = 0; @@ -3361,7 +3358,7 @@ } static void -@@ -1171,18 +1335,21 @@ backward_char (WInput *in) +@@ -1153,18 +1317,21 @@ backward_char (WInput *in) { if (in->point) in->point--; @@ -3378,14 +3375,14 @@ } static void - forward_word (WInput * in) + forward_word (WInput *in) { +#ifndef UTF8 - char *p = in->buffer + in->point; + unsigned char *p = in->buffer+in->point; - while (*p -@@ -1192,11 +1359,39 @@ forward_word (WInput * in) - while (*p && isalnum ((unsigned char) *p)) + while (*p && (isspace (*p) || ispunct (*p))) +@@ -1172,11 +1339,39 @@ forward_word (WInput *in) + while (*p && isalnum (*p)) p++; in->point = p - in->buffer; +#else /* UTF8 */ @@ -3394,23 +3391,23 @@ + memset (&mbs, 0, sizeof (mbs)); + + while (in->point < len) { -+ wchar_t c; -+ char *p = in->buffer + charpos(in,in->point); -+ size_t res = mbrtowc(&c, p, strlen(p), &mbs); -+ if (res <= 0 || !(iswspace (c) || iswpunct (c))) -+ break; -+ in->point++; ++ wchar_t c; ++ char *p = in->buffer + charpos(in,in->point); ++ size_t res = mbrtowc(&c, p, strlen(p), &mbs); ++ if (res <= 0 || !(iswspace (c) || iswpunct (c))) ++ break; ++ in->point++; + } + + memset (&mbs, 0, sizeof (mbs)); + + while (in->point < len) { -+ wchar_t c; -+ char *p = in->buffer + charpos(in,in->point); -+ size_t res = mbrtowc(&c, p, strlen(p), &mbs); -+ if (res <= 0 || !iswalnum (c)) -+ break; -+ in->point++; ++ wchar_t c; ++ char *p = in->buffer + charpos(in,in->point); ++ size_t res = mbrtowc(&c, p, strlen(p), &mbs); ++ if (res <= 0 || !iswalnum (c)) ++ break; ++ in->point++; + } + + in->charpoint = 0; @@ -3421,11 +3418,11 @@ backward_word (WInput *in) { +#ifndef UTF8 - char *p = in->buffer + in->point; + unsigned char *p = in->buffer+in->point; - while (p - 1 > in->buffer - 1 && (isspace ((unsigned char) *(p - 1)) -@@ -1206,6 +1401,32 @@ backward_word (WInput *in) - while (p - 1 > in->buffer - 1 && isalnum ((unsigned char) *(p - 1))) + while (p-1 > in->buffer-1 && (isspace (*(p-1)) || ispunct (*(p-1)))) +@@ -1184,6 +1379,32 @@ backward_word (WInput *in) + while (p-1 > in->buffer-1 && isalnum (*(p-1))) p--; in->point = p - in->buffer; +#else /* UTF8 */ @@ -3457,7 +3454,7 @@ } static void -@@ -1238,8 +1459,9 @@ backward_delete (WInput *in) +@@ -1216,8 +1437,9 @@ backward_delete (WInput *in) if (!in->point) return; @@ -3469,7 +3466,7 @@ in->need_push = 1; in->point--; } -@@ -1247,10 +1469,8 @@ backward_delete (WInput *in) +@@ -1225,10 +1447,8 @@ backward_delete (WInput *in) static void delete_char (WInput *in) { @@ -3482,7 +3479,7 @@ in->need_push = 1; } -@@ -1265,6 +1485,9 @@ copy_region (WInput *in, int x_first, in +@@ -1243,6 +1463,9 @@ copy_region (WInput *in, int x_first, in g_free (kill_buffer); @@ -3492,7 +3489,7 @@ kill_buffer = g_strndup(in->buffer+first,last-first); } -@@ -1273,11 +1496,13 @@ delete_region (WInput *in, int x_first, +@@ -1251,11 +1474,13 @@ delete_region (WInput *in, int x_first, { int first = min (x_first, x_last); int last = max (x_first, x_last); @@ -3508,7 +3505,7 @@ in->need_push = 1; } -@@ -1294,6 +1519,8 @@ kill_word (WInput *in) +@@ -1272,6 +1497,8 @@ kill_word (WInput *in) copy_region (in, old_point, new_point); delete_region (in, old_point, new_point); in->need_push = 1; @@ -3517,7 +3514,7 @@ } static void -@@ -1337,16 +1564,20 @@ yank (WInput *in) +@@ -1315,16 +1542,20 @@ yank (WInput *in) if (!kill_buffer) return; @@ -3540,7 +3537,7 @@ } void -@@ -1356,9 +1587,10 @@ assign_text (WInput *in, const char *tex +@@ -1334,9 +1565,10 @@ assign_text (WInput *in, const char *tex g_free (in->buffer); in->buffer = g_strdup (text); /* was in->buffer->text */ in->current_max_len = strlen (in->buffer) + 1; @@ -3552,7 +3549,7 @@ } static void -@@ -1485,6 +1717,7 @@ port_region_marked_for_delete (WInput *i +@@ -1461,6 +1693,7 @@ port_region_marked_for_delete (WInput *i *in->buffer = 0; in->point = 0; in->first = 0; @@ -3560,7 +3557,7 @@ } cb_ret_t -@@ -1513,7 +1746,11 @@ handle_char (WInput *in, int c_code) +@@ -1489,7 +1722,11 @@ handle_char (WInput *in, int c_code) } } if (!input_map [i].fn){ @@ -3572,7 +3569,7 @@ return MSG_NOT_HANDLED; if (in->first){ port_region_marked_for_delete (in); -@@ -1547,6 +1784,9 @@ input_set_point (WInput *in, int pos) +@@ -1523,6 +1760,9 @@ input_set_point (WInput *in, int pos) if (pos != in->point) free_completions (in); in->point = pos; @@ -3582,7 +3579,7 @@ update_input (in, 1); } -@@ -1587,7 +1827,7 @@ input_callback (Widget *w, widget_msg_t +@@ -1562,7 +1802,7 @@ input_callback (WInput *in, widget_msg_t return MSG_HANDLED; case WIDGET_CURSOR: @@ -3591,7 +3588,7 @@ return MSG_HANDLED; case WIDGET_DESTROY: -@@ -1611,7 +1851,7 @@ input_event (Gpm_Event * event, void *da +@@ -1584,7 +1824,7 @@ input_event (Gpm_Event * event, WInput * && should_show_history_button (in)) { do_show_hist (in); } else { @@ -3600,7 +3597,7 @@ if (event->x - in->first_shown - 1 < in->point) in->point = event->x - in->first_shown - 1; if (in->point < 0) -@@ -1668,7 +1908,8 @@ input_new (int y, int x, int color, int +@@ -1642,7 +1882,8 @@ input_new (int y, int x, int color, int in->is_password = 0; strcpy (in->buffer, def_text); @@ -3610,9 +3607,9 @@ return in; } ---- mc-4.6.1a/src/dialog.c.utf8 2005-05-27 05:35:15.000000000 +0200 -+++ mc-4.6.1a/src/dialog.c 2005-06-06 14:46:19.178250784 +0200 -@@ -166,7 +166,7 @@ common_dialog_repaint (struct Dlg_head * +--- mc-4.6.1-pre5/src/dialog.c.utf8 2005-05-27 16:19:18.000000000 +0200 ++++ mc-4.6.1-pre5/src/dialog.c 2005-07-08 11:22:41.910085880 +0200 +@@ -162,7 +162,7 @@ common_dialog_repaint (struct Dlg_head * if (h->title) { attrset (HOT_NORMALC); @@ -3621,8 +3618,8 @@ addstr (h->title); } } ---- mc-4.6.1a/src/hotlist.c.utf8 2005-05-27 05:35:15.000000000 +0200 -+++ mc-4.6.1a/src/hotlist.c 2005-06-06 14:46:19.180250480 +0200 +--- mc-4.6.1-pre5/src/hotlist.c.utf8 2005-05-27 16:19:18.000000000 +0200 ++++ mc-4.6.1-pre5/src/hotlist.c 2005-07-08 11:22:41.912085576 +0200 @@ -555,7 +555,7 @@ init_i18n_stuff(int list_type, int cols) row = hotlist_but [i].y; @@ -3656,25 +3653,25 @@ } space = (len - 4 - l[0] - l[1] - l[2]) / 4; -@@ -863,7 +863,7 @@ add_new_entry_input (const char *header, - - msglen(text1, &lines1, &cols1); - msglen(text2, &lines2, &cols2); -- len = max ((int) strlen (header), cols1); -+ len = max ((int) mbstrlen (header), cols1); - len = max (len, cols2) + 4; - len = max (len, 64); - -@@ -959,7 +959,7 @@ add_new_group_input (const char *header, +@@ -860,7 +860,7 @@ add_new_entry_input (const char *header, + static int i18n_flag = 0; #endif /* ENABLE_NLS */ - msglen (label, &lines, &cols); -- len = max ((int) strlen (header), cols) + 4; -+ len = max ((int) mbstrlen (header), cols) + 4; +- len = max (strlen (header), (size_t) msglen (text1, &lines1)); ++ len = max ((int) mbstrlen (header), (size_t) msglen (text1, &lines1)); + len = max (len, (size_t) msglen (text2, &lines2)) + 4; + len = max (len, 64); + +@@ -955,7 +955,7 @@ add_new_group_input (const char *header, + static int i18n_flag = 0; + #endif /* ENABLE_NLS */ + +- len = max (strlen (header), (size_t) msglen (label, &lines)) + 4; ++ len = max ((int) mbstrlen (header), (size_t) msglen (label, &lines)) + 4; len = max (len, 64); #ifdef ENABLE_NLS -@@ -1015,7 +1015,7 @@ void add2hotlist_cmd (void) +@@ -1011,7 +1011,7 @@ void add2hotlist_cmd (void) { char *prompt, *label; const char *cp = _("Label for \"%s\":"); @@ -3683,8 +3680,8 @@ char *label_string = g_strdup (current_panel->cwd); strip_password (label_string, 1); ---- mc-4.6.1a/src/panelize.c.utf8 2005-05-27 05:35:15.000000000 +0200 -+++ mc-4.6.1a/src/panelize.c 2005-06-06 14:46:19.180250480 +0200 +--- mc-4.6.1-pre5/src/panelize.c.utf8 2005-05-27 16:19:18.000000000 +0200 ++++ mc-4.6.1-pre5/src/panelize.c 2005-07-08 11:22:41.912085576 +0200 @@ -127,7 +127,7 @@ init_panelize (void) i = sizeof (panelize_but) / sizeof (panelize_but[0]); while (i--) { @@ -3709,9 +3706,9 @@ #endif /* ENABLE_NLS */ ---- mc-4.6.1a/src/layout.c.utf8 2005-05-27 05:35:15.000000000 +0200 -+++ mc-4.6.1a/src/layout.c 2005-06-06 14:46:19.182250176 +0200 -@@ -369,36 +369,36 @@ init_layout (void) +--- mc-4.6.1-pre5/src/layout.c.utf8 2005-05-27 16:19:18.000000000 +0200 ++++ mc-4.6.1-pre5/src/layout.c 2005-07-08 11:22:41.914085272 +0200 +@@ -362,36 +362,36 @@ init_layout (void) while (i--) { s_split_direction[i] = _(s_split_direction[i]); @@ -3755,7 +3752,7 @@ if (l1 > second_width) second_width = l1; } -@@ -412,14 +412,14 @@ init_layout (void) +@@ -405,14 +405,14 @@ init_layout (void) * * Now the last thing to do - properly space buttons... */ @@ -3775,7 +3772,7 @@ i18n_layt_flag = 1; } -@@ -687,7 +687,7 @@ setup_panels (void) +@@ -684,7 +684,7 @@ setup_panels (void) panel_do_cols (0); panel_do_cols (1); @@ -3784,8 +3781,8 @@ widget_set_size (&the_menubar->widget, 0, 0, 1, COLS); ---- mc-4.6.1a/src/menu.h.utf8 2004-12-03 20:17:47.000000000 +0100 -+++ mc-4.6.1a/src/menu.h 2005-06-06 14:46:19.182250176 +0200 +--- mc-4.6.1-pre5/src/menu.h.utf8 2004-09-18 16:30:59.000000000 +0200 ++++ mc-4.6.1-pre5/src/menu.h 2005-07-08 11:22:41.914085272 +0200 @@ -21,6 +21,8 @@ typedef struct Menu { menu_entry *entries; int start_x; /* position relative to menubar start */ @@ -3795,9 +3792,9 @@ } Menu; extern int menubar_visible; ---- mc-4.6.1a/src/screen.c.utf8 2005-05-27 05:35:15.000000000 +0200 -+++ mc-4.6.1a/src/screen.c 2005-06-06 14:46:19.184249872 +0200 -@@ -171,22 +171,59 @@ add_permission_string (char *dest, int w +--- mc-4.6.1-pre5/src/screen.c.utf8 2005-05-27 16:19:18.000000000 +0200 ++++ mc-4.6.1-pre5/src/screen.c 2005-07-08 11:22:41.916084968 +0200 +@@ -169,22 +169,59 @@ add_permission_string (char *dest, int w static const char * string_file_name (file_entry *fe, int len) { @@ -3867,7 +3864,7 @@ buffer[i] = 0; return buffer; -@@ -450,42 +487,6 @@ static struct { +@@ -425,42 +462,6 @@ static struct { { "dot", 1, 0, J_RIGHT, " ", 0, string_dot, NULL }, }; @@ -3910,7 +3907,7 @@ static int file_compute_color (int attr, file_entry *fe) { -@@ -539,14 +540,18 @@ file_compute_color (int attr, file_entry +@@ -514,14 +515,18 @@ file_compute_color (int attr, file_entry /* Formats the file number file_index of panel in the buffer dest */ static void @@ -3932,7 +3929,7 @@ length = 0; empty_line = (file_index >= panel->count); -@@ -564,34 +569,137 @@ format_file (char *dest, int limit, WPan +@@ -539,34 +544,137 @@ format_file (char *dest, int limit, WPan break; if (format->string_fn){ @@ -4084,7 +4081,7 @@ } else { if (attr == SELECTED || attr == MARKED_SELECTED) attrset (SELECTED_COLOR); -@@ -614,7 +722,6 @@ repaint_file (WPanel *panel, int file_in +@@ -589,7 +697,6 @@ repaint_file (WPanel *panel, int file_in { int second_column = 0; int width, offset; @@ -4092,7 +4089,7 @@ offset = 0; if (!isstatus && panel->split){ -@@ -643,7 +750,7 @@ repaint_file (WPanel *panel, int file_in +@@ -618,7 +725,7 @@ repaint_file (WPanel *panel, int file_in widget_move (&panel->widget, file_index - panel->top_file + 2, 1); } @@ -4101,7 +4098,7 @@ if (!isstatus && panel->split){ if (second_column) -@@ -1092,6 +1199,12 @@ paint_frame (WPanel *panel) +@@ -1068,6 +1175,12 @@ paint_frame (WPanel *panel) int side, width; const char *txt; @@ -4114,7 +4111,7 @@ if (!panel->split) adjust_top_file (panel); -@@ -1116,16 +1229,37 @@ paint_frame (WPanel *panel) +@@ -1092,16 +1205,37 @@ paint_frame (WPanel *panel) if (format->string_fn){ txt = format->title; @@ -4154,17 +4151,17 @@ } else { attrset (NORMAL_COLOR); one_vline (); ---- mc-4.6.1a/src/file.c.utf8 2005-05-27 05:35:15.000000000 +0200 -+++ mc-4.6.1a/src/file.c 2005-06-06 14:46:19.185249720 +0200 -@@ -164,15 +164,20 @@ static const char * - do_transform_source (FileOpContext *ctx, const char *source) +--- mc-4.6.1-pre5/src/file.c.utf8 2005-05-27 16:19:18.000000000 +0200 ++++ mc-4.6.1-pre5/src/file.c 2005-07-08 11:22:41.918084664 +0200 +@@ -165,15 +165,20 @@ static const unsigned char * + do_transform_source (FileOpContext *ctx, const unsigned char *source) { size_t j, k, l, len; -- const char *fnsource = x_basename (source); -+ char *fnsource = g_strdup(x_basename (source)); +- unsigned const char *fnsource = x_basename (source); ++ unsigned const char *fnsource = g_strdup (x_basename (source)); int next_reg; enum CaseConvs case_conv = NO_CONV; - static char fntarget[MC_MAXPATHLEN]; + static unsigned char fntarget[MC_MAXPATHLEN]; +#ifdef UTF8 + fix_utf8(fnsource); @@ -4174,11 +4171,11 @@ j = re_match (&ctx->rx, fnsource, len, 0, &ctx->regs); if (j != len) { transform_error = FILE_SKIP; -+ g_free(fnsource); ++ g_free(fnsource); return NULL; } for (next_reg = 1, j = 0, k = 0; j < strlen (ctx->dest_mask); j++) { -@@ -216,6 +221,7 @@ do_transform_source (FileOpContext *ctx, +@@ -217,6 +222,7 @@ do_transform_source (FileOpContext *ctx, || ctx->regs.start[next_reg] < 0) { message (1, MSG_ERROR, _(" Invalid target mask ")); transform_error = FILE_ABORT; @@ -4186,7 +4183,7 @@ return NULL; } for (l = (size_t) ctx->regs.start[next_reg]; -@@ -230,6 +236,7 @@ do_transform_source (FileOpContext *ctx, +@@ -231,6 +237,7 @@ do_transform_source (FileOpContext *ctx, } } fntarget[k] = 0; @@ -4194,11 +4191,11 @@ return fntarget; } ---- mc-4.6.1a/src/view.c.utf8 2005-06-06 01:43:49.000000000 +0200 -+++ mc-4.6.1a/src/view.c 2005-06-06 14:46:19.188249264 +0200 -@@ -43,6 +43,10 @@ - #include - #include +--- mc-4.6.1-pre5/src/view.c.utf8 2005-05-27 16:19:18.000000000 +0200 ++++ mc-4.6.1-pre5/src/view.c 2005-07-08 11:22:41.920084360 +0200 +@@ -36,6 +36,10 @@ + #include + #include +#ifdef UTF8 +#include @@ -4207,7 +4204,7 @@ #include "global.h" #include "tty.h" #include "cmd.h" /* For view_other_cmd */ -@@ -1410,7 +1414,7 @@ view_status (WView *view) +@@ -793,7 +797,7 @@ view_status (WView *view, gboolean updat if (!i18n_adjust) { file_label = _("File: %s"); @@ -4216,7 +4213,7 @@ } if (w < i18n_adjust + 6) -@@ -1472,7 +1476,11 @@ view_display_clean (WView *view, int hei +@@ -849,7 +853,11 @@ view_display_clean (WView *view, int hei widget_erase ((Widget *) view); } @@ -4228,18 +4225,25 @@ #define view_add_one_vline() one_vline() #define view_add_string(view,s) addstr (s) #define view_gotoyx(v,r,c) widget_move (v,r,c) -@@ -1690,7 +1698,43 @@ display (WView *view) - view_place_cursor (view); - } else { - for (; row < bottom && (c = get_byte (view, from)) != -1; from++) { +@@ -1071,6 +1079,12 @@ display (WView *view) + if (view->growing_buffer && from == view->last_byte) + get_byte (view, from); + for (; row < height && from < view->last_byte; from++) { +#ifdef UTF8 + mbstate_t mbs; + char mbbuf[MB_LEN_MAX]; + int mblen; + wchar_t wc; +#endif /* UTF8 */ + c = get_byte (view, from); + if ((c == '\n') || (col >= width && view->wrap_mode)) { + col = frame_shift; +@@ -1084,7 +1098,37 @@ display (WView *view) + col = ((col - frame_shift) / 8) * 8 + 8 + frame_shift; + continue; + } +#ifndef UTF8 - if (view->text_nroff_mode && c == '\b') { + if (view->viewer_nroff_flag && c == '\b') { +#else /* UTF8 */ + mblen = 1; + mbbuf[0] = convert_to_display_c (c); @@ -4267,14 +4271,14 @@ + + from += mblen - 1; + -+ if (view->text_nroff_mode && wc == '\b') { ++ if (view->viewer_nroff_flag && wc == '\b') { +#endif /* UTF8 */ int c_prev; int c_next; -@@ -1745,12 +1789,23 @@ display (WView *view) - && (unsigned int) col < right + view->dpy_text_column) { - view_gotoyx (view, row, col - view->dpy_text_column); +@@ -1122,12 +1166,23 @@ display (WView *view) + && col < width - view->start_col) { + view_gotoyx (view, row, col + view->start_col); +#ifndef UTF8 c = convert_to_display_c (c); @@ -4298,9 +4302,9 @@ } col++; if (boldflag != MARK_NORMAL) { ---- mc-4.6.1a/src/wtools.c.utf8 2005-05-27 05:35:15.000000000 +0200 -+++ mc-4.6.1a/src/wtools.c 2005-06-06 14:46:19.189249112 +0200 -@@ -49,11 +49,11 @@ create_listbox_window (int cols, int lin +--- mc-4.6.1-pre5/src/wtools.c.utf8 2005-05-27 16:19:19.000000000 +0200 ++++ mc-4.6.1-pre5/src/wtools.c 2005-07-08 11:43:22.900426672 +0200 +@@ -48,11 +48,11 @@ create_listbox_window (int cols, int lin /* Adjust sizes */ lines = (lines > LINES - 6) ? LINES - 6 : lines; @@ -4314,7 +4318,7 @@ cols = len; cols = cols > COLS - 6 ? COLS - 6 : cols; -@@ -124,7 +124,7 @@ query_dialog (const char *header, const +@@ -123,7 +123,7 @@ query_dialog (const char *header, const va_start (ap, count); for (i = 0; i < count; i++) { char *cp = va_arg (ap, char *); @@ -4323,16 +4327,16 @@ if (strchr (cp, '&') != NULL) win_len--; } -@@ -133,7 +133,7 @@ query_dialog (const char *header, const +@@ -131,7 +131,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)); +- cols = 6 + max (win_len, max ((int) strlen (header), msglen (text, &lines))); ++ cols = 6 + max (win_len, max ((int) mbstrlen (header), msglen (text, &lines))); 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 +@@ -146,7 +146,7 @@ query_dialog (const char *header, const va_start (ap, count); for (i = 0; i < count; i++) { cur_name = va_arg (ap, char *); @@ -4341,16 +4345,16 @@ if (strchr (cur_name, '&') != NULL) xpos--; -@@ -461,7 +461,7 @@ fg_input_dialog_help (const char *header +@@ -457,7 +457,7 @@ fg_input_dialog_help (const char *header + g_strlcpy (histname + 3, header, 61); 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 ((int) strlen (header), msglen (text, &lines)) + 4; ++ len = max ((int) mbstrlen (header), msglen (text, &lines)) + 4; len = max (len, 64); /* The special value of def_text is used to identify password boxes -@@ -481,7 +481,7 @@ fg_input_dialog_help (const char *header +@@ -477,7 +477,7 @@ fg_input_dialog_help (const char *header */ quick_widgets[0].relative_x = len / 2 + 4; quick_widgets[1].relative_x = @@ -4359,9 +4363,9 @@ quick_widgets[0].x_divisions = quick_widgets[1].x_divisions = len; #endif /* ENABLE_NLS */ ---- mc-4.6.1a/src/find.c.utf8 2005-05-27 05:35:15.000000000 +0200 -+++ mc-4.6.1a/src/find.c 2005-06-06 14:46:19.190248960 +0200 -@@ -217,7 +217,7 @@ find_parameters (char **start_dir, char +--- mc-4.6.1-pre5/src/find.c.utf8 2005-05-27 16:19:18.000000000 +0200 ++++ mc-4.6.1-pre5/src/find.c 2005-07-08 11:22:41.922084056 +0200 +@@ -205,7 +205,7 @@ find_parameters (char **start_dir, char int l1, maxlen = 0; while (i--) { @@ -4370,7 +4374,7 @@ if (l1 > maxlen) maxlen = l1; } -@@ -226,7 +226,7 @@ find_parameters (char **start_dir, char +@@ -214,7 +214,7 @@ find_parameters (char **start_dir, char FIND_X = i; for (i = sizeof (buts) / sizeof (buts[0]), l1 = 0; i--;) { @@ -4379,7 +4383,7 @@ } l1 += 21; if (l1 > FIND_X) -@@ -235,8 +235,8 @@ find_parameters (char **start_dir, char +@@ -223,8 +223,8 @@ find_parameters (char **start_dir, char ilen = FIND_X - 7 - maxlen; /* for the case of very long buttons :) */ istart = FIND_X - 3 - ilen; @@ -4390,7 +4394,7 @@ i18n_flag = 1; case_label = _(case_label); -@@ -857,7 +857,7 @@ setup_gui (void) +@@ -813,7 +813,7 @@ setup_gui (void) if (!i18n_flag) { register int i = sizeof (fbuts) / sizeof (fbuts[0]); while (i--) @@ -4399,9 +4403,9 @@ fbuts[2].len += 2; /* DEFPUSH_BUTTON */ i18n_flag = 1; } ---- mc-4.6.1a/src/widget.h.utf8 2005-05-24 13:50:12.000000000 +0200 -+++ mc-4.6.1a/src/widget.h 2005-06-06 14:46:19.191248808 +0200 -@@ -22,6 +22,7 @@ typedef struct WButton { +--- mc-4.6.1-pre5/src/widget.h.utf8 2004-08-29 20:46:16.000000000 +0200 ++++ mc-4.6.1-pre5/src/widget.h 2005-07-08 11:22:41.922084056 +0200 +@@ -25,6 +25,7 @@ typedef struct WButton { char *text; /* text of button */ int hotkey; /* hot KEY */ int hotpos; /* offset hot KEY char in text */ @@ -4411,7 +4415,7 @@ @@ -43,6 +44,7 @@ typedef struct WCheck { char *text; /* text of check button */ - int hotkey; /* hot KEY */ + int hotkey; /* hot KEY */ int hotpos; /* offset hot KEY char in text */ + wchar_t hotwc; } WCheck; @@ -4435,7 +4439,7 @@ 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 */ + unsigned char *buffer; /* pointer to editing buffer */ +#ifdef UTF8 + unsigned char charbuf[MB_LEN_MAX]; +#endif /* UTF8 */ @@ -4443,9 +4447,9 @@ GList *history; /* The history */ int need_push; /* need to push the current Input on hist? */ char **completions; /* Possible completions array */ ---- mc-4.6.1a/src/boxes.c.utf8 2005-05-29 14:10:08.000000000 +0200 -+++ mc-4.6.1a/src/boxes.c 2005-06-06 14:46:19.192248656 +0200 -@@ -153,23 +153,23 @@ display_init (int radio_sel, char *init_ +--- mc-4.6.1-pre5/src/boxes.c.utf8 2005-05-27 16:19:18.000000000 +0200 ++++ mc-4.6.1-pre5/src/boxes.c 2005-07-08 11:22:41.924083752 +0200 +@@ -150,23 +150,23 @@ display_init (int radio_sel, char *init_ display_title = _(display_title); for (i = 0; i < LIST_TYPES; i++) { displays[i] = _(displays[i]); @@ -4474,7 +4478,7 @@ if (i > DISPLAY_X) DISPLAY_X = i; -@@ -288,20 +288,20 @@ sort_box (sortfn *sort_fn, int *reverse, +@@ -285,20 +285,20 @@ sort_box (sortfn *sort_fn, int *reverse, int maxlen = 0; for (i = SORT_TYPES - 1; i >= 0; i--) { sort_orders_names[i] = _(sort_orders[i].sort_name); @@ -4500,7 +4504,7 @@ if (i > l) l = i; -@@ -310,7 +310,7 @@ sort_box (sortfn *sort_fn, int *reverse, +@@ -307,7 +307,7 @@ sort_box (sortfn *sort_fn, int *reverse, if (i > SORT_X) SORT_X = i; @@ -4509,7 +4513,7 @@ if (i > SORT_X) SORT_X = i; -@@ -405,7 +405,7 @@ confirm_box (void) +@@ -402,7 +402,7 @@ confirm_box (void) while (i--) { conf_widgets [i].text = _(conf_widgets [i].text); @@ -4518,7 +4522,7 @@ if (l1 > maxlen) maxlen = l1; } -@@ -420,8 +420,8 @@ confirm_box (void) +@@ -417,8 +417,8 @@ confirm_box (void) * And this for the case when buttons with some space to the right * do not fit within 2/6 */ @@ -4529,7 +4533,7 @@ if (i > l1) l1 = i; -@@ -492,11 +492,11 @@ display_bits_box (void) +@@ -489,11 +489,11 @@ display_bits_box (void) { display_widgets [i].text = _(display_widgets[i].text); display_bits_str [i] = _(display_bits_str [i]); @@ -4543,7 +4547,7 @@ if (l1 > maxlen) maxlen = l1; -@@ -504,8 +504,8 @@ display_bits_box (void) +@@ -501,8 +501,8 @@ display_bits_box (void) display_bits.xlen = (maxlen + 5) * 6 / 4; /* See above confirm_box */ @@ -4554,7 +4558,7 @@ if (i > l1) l1 = i; -@@ -600,7 +600,7 @@ init_disp_bits_box (void) +@@ -597,7 +597,7 @@ init_disp_bits_box (void) cpname = _("&Select"); add_widget (dbits_dlg, @@ -4563,7 +4567,7 @@ NORMAL_BUTTON, cpname, sel_charset_button)); return dbits_dlg; -@@ -811,7 +811,7 @@ cd_dialog (void) +@@ -803,7 +803,7 @@ cd_dialog (void) quick_widgets [1].y_divisions = quick_widgets [0].y_divisions = Quick_input.ylen = 5; @@ -4572,7 +4576,7 @@ quick_widgets [0].relative_x = quick_widgets [1].relative_x + len + 1; -@@ -970,7 +970,7 @@ jobs_cmd (void) +@@ -962,7 +962,7 @@ jobs_cmd (void) { job_buttons [i].name = _(job_buttons [i].name); @@ -4581,7 +4585,7 @@ JOBS_X = max (JOBS_X, startx + len + 3); job_buttons [i].xpos = startx; -@@ -979,7 +979,7 @@ jobs_cmd (void) +@@ -971,7 +971,7 @@ jobs_cmd (void) /* Last button - Ok a.k.a. Cancel :) */ job_buttons [n_buttons - 1].xpos = @@ -4590,7 +4594,7 @@ i18n_flag = 1; } -@@ -1037,7 +1037,7 @@ vfs_smb_get_authinfo (const char *host, +@@ -1029,7 +1029,7 @@ vfs_smb_get_authinfo (const char *host, while (i--) { @@ -4599,7 +4603,7 @@ if (l1 > maxlen) maxlen = l1; } -@@ -1047,7 +1047,7 @@ vfs_smb_get_authinfo (const char *host, +@@ -1039,7 +1039,7 @@ vfs_smb_get_authinfo (const char *host, for (i = sizeof(buts)/sizeof(buts[0]), l1 = 0; i--; ) { @@ -4608,7 +4612,7 @@ } l1 += 15; if (l1 > dialog_x) -@@ -1056,7 +1056,7 @@ vfs_smb_get_authinfo (const char *host, +@@ -1048,7 +1048,7 @@ vfs_smb_get_authinfo (const char *host, ilen = dialog_x - 7 - maxlen; /* for the case of very long buttons :) */ istart = dialog_x - 3 - ilen; @@ -4617,9 +4621,9 @@ i18n_flag = 1; } ---- mc-4.6.1a/src/achown.c.utf8 2005-05-27 05:35:14.000000000 +0200 -+++ mc-4.6.1a/src/achown.c 2005-06-06 14:46:19.193248504 +0200 -@@ -579,6 +579,12 @@ init_chown_advanced (void) +--- mc-4.6.1-pre5/src/achown.c.utf8 2005-05-27 16:19:18.000000000 +0200 ++++ mc-4.6.1-pre5/src/achown.c 2005-07-08 11:22:41.925083600 +0200 +@@ -583,6 +583,12 @@ init_chown_advanced (void) b_att[2] = button_new (XTRACT (6)); b_user = button_new (XTRACT (5)); b_group = button_new (XTRACT (4)); @@ -4632,17 +4636,18 @@ add_widget (ch_dlg, b_group); add_widget (ch_dlg, b_user); ---- mc-4.6.1a/src/menu.c.utf8 2005-05-27 05:35:15.000000000 +0200 -+++ mc-4.6.1a/src/menu.c 2005-06-06 14:46:19.194248352 +0200 -@@ -22,6 +22,7 @@ - #include - +--- mc-4.6.1-pre5/src/menu.c.utf8 2005-05-27 16:19:18.000000000 +0200 ++++ mc-4.6.1-pre5/src/menu.c 2005-07-08 11:22:41.926083448 +0200 +@@ -20,6 +20,8 @@ + #include #include + #include +#include - ++ #include "global.h" #include "tty.h" -@@ -53,33 +54,96 @@ create_menu (const char *name, menu_entr + #include "menu.h" +@@ -50,33 +52,96 @@ create_menu (const char *name, menu_entr { Menu *menu; const char *cp; @@ -4682,23 +4687,23 @@ cp = strchr (mp->text,'&'); +#ifdef UTF8 -+ if (SLsmg_Is_Unicode) { -+ len = mbstrlen(mp->text) + 1; -+ wlen += len; -+ menu->max_entry_len = max (len - 1, menu->max_entry_len); -+ } else ++ if (SLsmg_Is_Unicode) { ++ len = mbstrlen(mp->text) + 1; ++ wlen += len; ++ menu->max_entry_len = max (len - 1, menu->max_entry_len); ++ } else +#endif -+ len = strlen (mp->text); ++ len = strlen (mp->text); + if (cp != NULL && *(cp+1) != '\0') { - mp->hot_key = tolower ((unsigned char) *(cp+1)); + mp->hot_key = tolower (*(cp+1)); - menu->max_entry_len = max ((int) (strlen (mp->text) - 1), - menu->max_entry_len); -+ menu->max_entry_len = max (len - 1, menu->max_entry_len); ++ menu->max_entry_len = max (len - 1, menu->max_entry_len); } else { - menu->max_entry_len = max ((int) strlen (mp->text), - menu->max_entry_len); -+ menu->max_entry_len = max (len, menu->max_entry_len); ++ menu->max_entry_len = max (len, menu->max_entry_len); } } } @@ -4743,8 +4748,8 @@ menu->name = g_strdup (name); menu_scan_hotkey(menu); menu->start_x = 0; -@@ -112,8 +176,26 @@ static void menubar_paint_idx (WMenu *me - const char *text; +@@ -109,8 +174,26 @@ static void menubar_paint_idx (WMenu *me + const unsigned char *text; addch((unsigned char)menu->entries [idx].first_letter); - for (text = menu->entries [idx].text; *text; text++) @@ -4772,7 +4777,7 @@ if (*text != '&') addch(*text); else { -@@ -122,7 +204,7 @@ static void menubar_paint_idx (WMenu *me +@@ -119,7 +202,7 @@ static void menubar_paint_idx (WMenu *me addch(*(++text)); attrset(color); } @@ -4781,7 +4786,7 @@ } widget_move (&menubar->widget, y, x + 1); } -@@ -170,7 +252,13 @@ static void menubar_draw (WMenu *menubar +@@ -167,7 +250,13 @@ static void menubar_draw (WMenu *menubar if (menubar->active) attrset(i == menubar->selected?MENU_SELECTED_COLOR:SELECTED_COLOR); widget_move (&menubar->widget, 0, menubar->menu [i]->start_x); @@ -4796,7 +4801,7 @@ } if (menubar->dropped) -@@ -495,7 +583,13 @@ menubar_arrange(WMenu* menubar) +@@ -489,7 +578,13 @@ menubar_arrange(WMenu* menubar) for (i = 0; i < items; i++) { @@ -4811,7 +4816,7 @@ menubar->menu[i]->start_x = start_x; start_x += len + gap; } -@@ -508,7 +602,13 @@ menubar_arrange(WMenu* menubar) +@@ -502,7 +597,13 @@ menubar_arrange(WMenu* menubar) for (i = 0; i < items; i++) { /* preserve length here, to be used below */ @@ -4826,7 +4831,7 @@ } gap /= (items - 1); -@@ -532,6 +632,9 @@ menubar_arrange(WMenu* menubar) +@@ -526,6 +627,9 @@ menubar_arrange(WMenu* menubar) void destroy_menu (Menu *menu) { @@ -4836,9 +4841,9 @@ g_free (menu->name); g_free (menu->help_node); g_free (menu); ---- mc-4.6.1a/src/option.c.utf8 2005-05-27 05:35:15.000000000 +0200 -+++ mc-4.6.1a/src/option.c 2005-06-06 14:46:19.195248200 +0200 -@@ -123,12 +123,12 @@ init_configure (void) +--- mc-4.6.1-pre5/src/option.c.utf8 2005-05-27 16:19:18.000000000 +0200 ++++ mc-4.6.1-pre5/src/option.c 2005-07-08 11:22:41.927083296 +0200 +@@ -124,12 +124,12 @@ init_configure (void) title2 = _(" Pause after run... "); title3 = _(" Other options "); @@ -4854,7 +4859,7 @@ if (i >= OTHER_OPTIONS) { if (l1 > first_width) first_width = l1; -@@ -141,23 +141,23 @@ init_configure (void) +@@ -142,23 +142,23 @@ init_configure (void) i = PAUSE_OPTIONS; while (i--) { pause_options[i] = _(pause_options[i]); @@ -4885,9 +4890,9 @@ i18n_config_flag = 1; } ---- mc-4.6.1a/src/filegui.c.utf8 2005-05-27 05:35:15.000000000 +0200 -+++ mc-4.6.1a/src/filegui.c 2005-06-06 14:46:19.196248048 +0200 -@@ -65,6 +65,7 @@ +--- mc-4.6.1-pre5/src/filegui.c.utf8 2005-05-27 16:19:18.000000000 +0200 ++++ mc-4.6.1-pre5/src/filegui.c 2005-07-08 11:22:41.928083144 +0200 +@@ -69,6 +69,7 @@ #include "filegui.h" #include "key.h" /* get_event */ #include "util.h" /* strip_password() */ @@ -4895,7 +4900,7 @@ /* }}} */ -@@ -563,8 +564,8 @@ init_replace (FileOpContext *ctx, enum O +@@ -564,8 +565,8 @@ init_replace (FileOpContext *ctx, enum O * longest of "Overwrite..." labels * (assume "Target date..." are short enough) */ @@ -4906,7 +4911,7 @@ /* longest of button rows */ i = sizeof (rd_widgets) / sizeof (rd_widgets[0]); -@@ -575,7 +576,7 @@ init_replace (FileOpContext *ctx, enum O +@@ -576,7 +577,7 @@ init_replace (FileOpContext *ctx, enum O l2 = max (l2, l); l = 0; } @@ -4915,7 +4920,7 @@ } } l2 = max (l2, l); /* last row */ -@@ -593,12 +594,12 @@ init_replace (FileOpContext *ctx, enum O +@@ -594,12 +595,12 @@ init_replace (FileOpContext *ctx, enum O l = l1; } rd_widgets[i].xpos = l; @@ -4930,7 +4935,7 @@ } #endif /* ENABLE_NLS */ -@@ -617,7 +618,7 @@ init_replace (FileOpContext *ctx, enum O +@@ -618,7 +619,7 @@ init_replace (FileOpContext *ctx, enum O ADD_RD_LABEL (ui, 0, name_trunc (ui->replace_filename, @@ -4939,7 +4944,7 @@ ADD_RD_BUTTON (1); ADD_RD_BUTTON (2); -@@ -804,36 +805,36 @@ fmd_init_i18n (int force) +@@ -805,36 +806,36 @@ fmd_init_i18n (int force) if (fmd_widgets[i].text[0] != '\0') fmd_widgets[i].text = _(fmd_widgets[i].text); @@ -4986,7 +4991,7 @@ chkbox_xpos (FMCB0); chkbox_xpos (FMCB21); -@@ -855,7 +856,7 @@ fmd_init_i18n (int force) +@@ -856,7 +857,7 @@ fmd_init_i18n (int force) char * file_mask_dialog (FileOpContext *ctx, FileOperation operation, const char *text, @@ -4995,7 +5000,7 @@ { int source_easy_patterns = easy_patterns; char *source_mask, *orig_mask, *dest_dir, *tmpdest; -@@ -864,12 +865,20 @@ file_mask_dialog (FileOpContext *ctx, Fi +@@ -865,12 +866,20 @@ file_mask_dialog (FileOpContext *ctx, Fi struct stat buf; int val; QuickDialog Quick_input; @@ -5017,7 +5022,7 @@ fmd_init_i18n (FALSE); /* Set up the result pointers */ -@@ -928,6 +937,7 @@ file_mask_dialog (FileOpContext *ctx, Fi +@@ -929,6 +938,7 @@ file_mask_dialog (FileOpContext *ctx, Fi orig_mask = source_mask; if (!dest_dir || !*dest_dir) { g_free (source_mask); @@ -5025,15 +5030,15 @@ return dest_dir; } if (source_easy_patterns) { -@@ -981,5 +991,6 @@ file_mask_dialog (FileOpContext *ctx, Fi +@@ -982,5 +992,6 @@ file_mask_dialog (FileOpContext *ctx, Fi } if (val == B_USER) *do_background = 1; + g_free(def_text); return dest_dir; } ---- mc-4.6.1a/acinclude.m4.utf8 2005-05-11 23:56:57.000000000 +0200 -+++ mc-4.6.1a/acinclude.m4 2005-06-06 14:46:19.197247896 +0200 +--- mc-4.6.1-pre5/acinclude.m4.utf8 2005-05-11 20:53:22.000000000 +0200 ++++ mc-4.6.1-pre5/acinclude.m4 2005-07-08 11:22:41.929082992 +0200 @@ -769,14 +769,14 @@ AC_DEFUN([MC_WITH_SLANG], [ fi diff --git a/mc.spec b/mc.spec index 69c59a7..2db1c9c 100644 --- a/mc.spec +++ b/mc.spec @@ -1,13 +1,11 @@ Summary: User-friendly text console file manager and visual shell. Name: mc Version: 4.6.1a -Release: 0.10 +Release: 0.11 Epoch: 1 License: GPL Group: System Environment/Shells -#Source0: http://www.ibiblio.org/pub/Linux/utils/file/managers/mc/mc-%{version}.tar.gz -%define date 20050606 -Source0: mc-%{version}-%{date}.tar.bz2 +Source0: http://www.ibiblio.org/pub/Linux/utils/file/managers/mc/mc-4.6.1-pre5.tar.bz2 URL: http://www.ibiblio.org/mc/ BuildRoot: %{_tmppath}/%{name}-%{version}-root BuildRequires: gpm-devel, slang-devel, glib2-devel @@ -21,7 +19,6 @@ Patch3: mc-uglydir.patch Patch4: mc-fish-upload.patch Patch5: mc-userhost.patch Patch6: mc-64bit.patch -Patch7: mc-fixes.patch %description Midnight Commander is a visual shell much like a file manager, only @@ -31,7 +28,7 @@ best features are its ability to FTP, view tar and zip files, and to poke into RPMs for specific files. %prep -%setup -q -n mc-%{version} +%setup -q -n %{name}-4.6.1-pre5 %patch0 -p1 -b .utf8 %patch1 -p1 -b .extensions @@ -40,7 +37,6 @@ poke into RPMs for specific files. %patch4 -p1 -b .fish-upload %patch5 -p1 -b .userhost %patch6 -p1 -b .64bit -%patch7 -p1 -b .fixes # convert files in /lib to UTF-8 pushd lib @@ -175,6 +171,11 @@ rm -rf $RPM_BUILD_ROOT %dir %{_datadir}/mc %changelog +* Fri Jul 08 2005 Jindrich Novy 4.6.1a-0.11 +- update to mc-4.6.1-pre5 +- sync .utf8, .userhost patch +- drop upstreamed .fixes patch + * Wed Jun 06 2005 Jindrich Novy 4.6.1a-0.10 - update from CVS - sync with .utf8 patch and some minor gcc4 fixups diff --git a/sources b/sources index ada2725..4eed126 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -4d84248d7aa985aee2ecaf89e1b779cc mc-4.6.1a-20050606.tar.bz2 +68f51b904790111faf784a845e4fca59 mc-4.6.1-pre5.tar.bz2