diff --git a/mc-64bit.patch b/mc-64bit.patch index 3d1d942..12356e9 100644 --- a/mc-64bit.patch +++ b/mc-64bit.patch @@ -52,14 +52,3 @@ } #if defined(_AIX) && defined(_I386) ---- mc-4.6.1a/acinclude.m4.64bit 2005-05-10 17:09:24.084859280 +0200 -+++ mc-4.6.1a/acinclude.m4 2005-05-10 17:09:24.124853200 +0200 -@@ -501,7 +501,7 @@ dnl job is to detect a method to get fil - if test $ac_cv_func_statvfs = yes; then - space=yes - AC_DEFINE(STAT_STATVFS, 1, -- [Define if function `statfs' can be used]) -+ [Define if function `statvfs' can be used]) - fi - fi - diff --git a/mc-userhost.patch b/mc-userhost.patch index 4b7bb69..e540652 100644 --- a/mc-userhost.patch +++ b/mc-userhost.patch @@ -1,33 +1,128 @@ ---- 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 - +--- mc-4.6.1a/src/main.c.userhost 2005-10-16 18:11:07.000000000 +0200 ++++ mc-4.6.1a/src/main.c 2005-10-16 18:14:26.000000000 +0200 +@@ -28,6 +28,7 @@ + #include + #include + #include +#include - #include - #include - #include -@@ -1607,9 +1608,22 @@ void + + #include + #include +@@ -1608,9 +1609,22 @@ void update_xterm_title_path (void) { - unsigned char *p, *s; + char *p, *s; + char h[64]; + struct passwd *pw; if (xterm_flag && xterm_title) { p = s = g_strdup (strip_home_and_password (current_panel->cwd)); -+ if ( !gethostname (h, 64) ) { -+ h[63] = '\0'; /* Be sure the hostname is NUL terminated */ -+ s = g_strdup_printf ("%s:%s", h, s); -+ g_free (p); -+ p = s; -+ } -+ if ( (pw = getpwuid(getuid())) ) { -+ s = g_strdup_printf ("%s@%s", pw->pw_name, s); -+ g_free (p); -+ p = s; -+ } ++ if ( !gethostname (h, 64) ) { ++ h[63] = '\0'; /* Be sure the hostname is NUL terminated */ ++ s = g_strdup_printf ("%s:%s", h, s); ++ g_free (p); ++ p = s; ++ } ++ if ( (pw = getpwuid(getuid())) ) { ++ s = g_strdup_printf ("%s@%s", pw->pw_name, s); ++ g_free (p); ++ p = s; ++ } do { #ifndef UTF8 - if (!is_printable (*s)) + if (!is_printable ((unsigned char) *s)) +--- mc-4.6.1a/src/main.h.viewfile 2005-09-05 04:10:48.000000000 +0200 ++++ mc-4.6.1a/src/main.h 2005-10-17 14:41:46.000000000 +0200 +@@ -67,6 +67,7 @@ extern int alternate_plus_minus; + extern int only_leading_plus_minus; + extern int output_starts_shell; + extern int midnight_shutdown; ++extern char *xterm_title_str; + extern char cmd_buf [512]; + extern const char *shell; + +--- mc-4.6.1a/src/view.c.viewfile 2005-10-17 14:41:46.000000000 +0200 ++++ mc-4.6.1a/src/view.c 2005-10-17 15:11:54.000000000 +0200 +@@ -3344,6 +3344,11 @@ mc_internal_viewer (const char *command, + WButtonBar *bar; + Dlg_head *view_dlg; + ++ if (xterm_flag && xterm_title && xterm_title_str) { ++ fprintf (stdout, "\33]0;mc - %s/%s\7", xterm_title_str, file); ++ fflush(stdout); ++ } ++ + /* Create dialog and widgets, put them on the dialog */ + view_dlg = + create_dlg (0, 0, LINES, COLS, NULL, view_dialog_callback, +@@ -3367,6 +3372,8 @@ mc_internal_viewer (const char *command, + } + destroy_dlg (view_dlg); + ++ update_xterm_title_path(); ++ + return succeeded; + } + +--- mc-4.6.1a/src/main.c.viewfile 2005-10-17 14:41:46.000000000 +0200 ++++ mc-4.6.1a/src/main.c 2005-10-17 14:41:46.000000000 +0200 +@@ -270,6 +270,9 @@ int midnight_shutdown = 0; + /* The user's shell */ + const char *shell = NULL; + ++/* The xterm title */ ++char *xterm_title_str = NULL; ++ + /* mc_home: The home of MC */ + char *mc_home = NULL; + +@@ -1617,6 +1620,7 @@ update_xterm_title_path (void) + struct passwd *pw; + + if (xterm_flag && xterm_title) { ++ if ( xterm_title_str ) g_free (xterm_title_str); + p = s = g_strdup (strip_home_and_password (current_panel->cwd)); + if ( !gethostname (h, 64) ) { + h[63] = '\0'; /* Be sure the hostname is NUL terminated */ +@@ -1639,7 +1643,7 @@ update_xterm_title_path (void) + } while (*++s); + fprintf (stdout, "\33]0;mc - %s\7", p); + fflush (stdout); +- g_free (p); ++ xterm_title_str = p; + } + } + +--- mc-4.6.1a/edit/editwidget.c.viewfile 2005-10-17 14:41:46.000000000 +0200 ++++ mc-4.6.1a/edit/editwidget.c 2005-10-17 14:41:46.000000000 +0200 +@@ -44,6 +44,9 @@ + #include "../src/widget.h" /* buttonbar_redraw() */ + #include "../src/menu.h" /* menubar_new() */ + #include "../src/key.h" /* is_idle() */ ++#include "../src/main.h" /* xterm_title_str */ ++#include "../src/win.h" /* xterm_flag */ ++#include "../src/layout.h" /* xterm_title */ + + WEdit *wedit; + struct WMenu *edit_menubar; +@@ -184,6 +187,11 @@ edit_file (const char *_file, int line) + static int made_directory = 0; + Dlg_head *edit_dlg; + WButtonBar *edit_bar; ++ ++ if (xterm_flag && xterm_title && xterm_title_str) { ++ fprintf (stdout, "\33]0;mc - %s/%s\7", xterm_title_str, _file); ++ fflush(stdout); ++ } + + if (!made_directory) { + char *dir = concat_dir_and_file (home_dir, EDIT_DIR); +@@ -219,6 +227,8 @@ edit_file (const char *_file, int line) + edit_done_menu (edit_menubar); /* editmenu.c */ + + destroy_dlg (edit_dlg); ++ ++ update_xterm_title_path(); + + return 1; + } diff --git a/mc-utf8.patch b/mc-utf8.patch index cb5b6fe..824385b 100644 --- a/mc-utf8.patch +++ b/mc-utf8.patch @@ -1,6 +1,6 @@ ---- mc-4.6.1/acinclude.m4.utf8 2005-05-11 20:53:22.000000000 +0200 -+++ mc-4.6.1/acinclude.m4 2005-09-29 19:13:29.000000000 +0200 -@@ -769,14 +769,14 @@ AC_DEFUN([MC_WITH_SLANG], [ +--- mc-4.6.1a/acinclude.m4.utf8 2005-09-28 23:49:06.000000000 +0200 ++++ mc-4.6.1a/acinclude.m4 2005-10-17 14:34:41.000000000 +0200 +@@ -768,14 +768,14 @@ AC_DEFUN([MC_WITH_SLANG], [ fi dnl Unless external S-Lang was requested, reject S-Lang with UTF-8 hacks @@ -23,9 +23,9 @@ if test x$with_screen = xslang; then AC_DEFINE(HAVE_SYSTEM_SLANG, 1, ---- mc-4.6.1/src/layout.c.utf8 2005-05-27 16:19:18.000000000 +0200 -+++ mc-4.6.1/src/layout.c 2005-09-29 19:13:29.000000000 +0200 -@@ -362,36 +362,36 @@ init_layout (void) +--- mc-4.6.1a/src/layout.c.utf8 2005-09-05 03:40:45.000000000 +0200 ++++ mc-4.6.1a/src/layout.c 2005-10-17 14:34:41.000000000 +0200 +@@ -369,36 +369,36 @@ init_layout (void) while (i--) { s_split_direction[i] = _(s_split_direction[i]); @@ -69,7 +69,7 @@ if (l1 > second_width) second_width = l1; } -@@ -405,14 +405,14 @@ init_layout (void) +@@ -412,14 +412,14 @@ init_layout (void) * * Now the last thing to do - properly space buttons... */ @@ -89,7 +89,7 @@ i18n_layt_flag = 1; } -@@ -684,7 +684,7 @@ setup_panels (void) +@@ -687,7 +687,7 @@ setup_panels (void) panel_do_cols (0); panel_do_cols (1); @@ -98,9 +98,28 @@ widget_set_size (&the_menubar->widget, 0, 0, 1, COLS); ---- mc-4.6.1/src/option.c.utf8 2005-05-27 16:19:18.000000000 +0200 -+++ mc-4.6.1/src/option.c 2005-09-29 19:13:29.000000000 +0200 -@@ -124,12 +124,12 @@ init_configure (void) +--- mc-4.6.1a/src/tty.c.utf8 2005-09-05 05:05:39.000000000 +0200 ++++ mc-4.6.1a/src/tty.c 2005-10-17 14:34:41.000000000 +0200 +@@ -123,10 +123,12 @@ tty_print_char(int c) + * defined or not. Congratulations! At least, they left the API call + * for SLsmg_write_nchars as it has always been. + */ +- char ch; +- +- ch = c; +- SLsmg_write_nchars(&ch, 1); ++ ++ /* The above comment is a nonsense, SLsmg_write_char(c) works pretty ++ * good for me. So please don't mess with Red Hat people. ++ * Jindrich Novy (jnovy@redhat.com) ++ */ ++ SLsmg_write_char(c); + #else + addch(c); + #endif +--- mc-4.6.1a/src/option.c.utf8 2005-05-27 05:35:15.000000000 +0200 ++++ mc-4.6.1a/src/option.c 2005-10-17 14:34:41.000000000 +0200 +@@ -123,12 +123,12 @@ init_configure (void) title2 = _(" Pause after run... "); title3 = _(" Other options "); @@ -116,7 +135,7 @@ if (i >= OTHER_OPTIONS) { if (l1 > first_width) first_width = l1; -@@ -142,23 +142,23 @@ init_configure (void) +@@ -141,23 +141,23 @@ init_configure (void) i = PAUSE_OPTIONS; while (i--) { pause_options[i] = _(pause_options[i]); @@ -147,8 +166,8 @@ i18n_config_flag = 1; } ---- mc-4.6.1/src/menu.h.utf8 2004-09-18 16:30:59.000000000 +0200 -+++ mc-4.6.1/src/menu.h 2005-09-29 19:13:29.000000000 +0200 +--- mc-4.6.1a/src/menu.h.utf8 2004-12-03 20:17:47.000000000 +0100 ++++ mc-4.6.1a/src/menu.h 2005-10-17 14:34:41.000000000 +0200 @@ -21,6 +21,8 @@ typedef struct Menu { menu_entry *entries; int start_x; /* position relative to menubar start */ @@ -158,18 +177,17 @@ } Menu; extern int menubar_visible; ---- mc-4.6.1/src/menu.c.utf8 2005-05-27 16:19:18.000000000 +0200 -+++ mc-4.6.1/src/menu.c 2005-09-29 19:32:14.000000000 +0200 -@@ -20,6 +20,8 @@ - #include +--- mc-4.6.1a/src/menu.c.utf8 2005-09-05 04:12:09.000000000 +0200 ++++ mc-4.6.1a/src/menu.c 2005-10-17 14:34:41.000000000 +0200 +@@ -22,6 +22,7 @@ + #include + #include - #include +#include -+ + #include "global.h" #include "tty.h" - #include "menu.h" -@@ -50,34 +52,96 @@ create_menu (const char *name, menu_entr +@@ -53,33 +54,95 @@ create_menu (const char *name, menu_entr { Menu *menu; const char *cp; @@ -186,15 +204,15 @@ + menu->wentries = NULL; + menu->wname = NULL; + if (SLsmg_Is_Unicode) { -+ const char *str = menu->name; -+ memset (&s, 0, sizeof (s)); -+ wlen = mbsrtowcs (NULL, &str, -1, &s); -+ if (wlen > 0) -+ ++wlen; -+ else { -+ wlen = 0; -+ memset (&s, 0, sizeof (s)); -+ } ++ const char *str = menu->name; ++ memset (&s, 0, sizeof (s)); ++ wlen = mbsrtowcs (NULL, &str, -1, &s); ++ if (wlen > 0) ++ ++wlen; ++ else { ++ wlen = 0; ++ memset (&s, 0, sizeof (s)); ++ } + } +#endif @@ -207,18 +225,17 @@ mp->text = _(mp->text); #endif /* ENABLE_NLS */ 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 ++ 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 (*(cp+1)); + mp->hot_key = tolower ((unsigned char) *(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); @@ -231,48 +248,47 @@ } } -- menu->name = g_strdup (name); +#ifdef UTF8 + if (wlen) { -+ wchar_t *wp; -+ const char *str; -+ int len; ++ wchar_t *wp; ++ const char *str; ++ int len; + -+ menu->wentries = (wchar_t **) -+ g_malloc (sizeof (wchar_t *) * menu->count -+ + wlen * sizeof (wchar_t)); -+ wp = (wchar_t *) (menu->wentries + menu->count); -+ str = menu->name; -+ len = mbsrtowcs (wp, &str, wlen, &s); -+ if (len > 0) { -+ menu->wname = wp; -+ wlen -= len + 1; -+ wp += len + 1; -+ } else -+ memset (&s, 0, sizeof (s)); -+ if (menu->entries != NULL) -+ for (count = 0; count < menu->count; ++count) -+ if (menu->entries[count].text[0] != '\0') { -+ str = menu->entries[count].text; -+ menu->wentries[count] = wp; -+ len = mbsrtowcs (wp, &str, wlen, &s); -+ if (len > 0) { -+ wlen -= len + 1; -+ wp += len + 1; -+ } else { -+ memset (&s, 0, sizeof (s)); -+ *wp++ = L'\0'; -+ --wlen; -+ } -+ } ++ menu->wentries = (wchar_t **) ++ g_malloc (sizeof (wchar_t *) * menu->count ++ + wlen * sizeof (wchar_t)); ++ wp = (wchar_t *) (menu->wentries + menu->count); ++ str = menu->name; ++ len = mbsrtowcs (wp, &str, wlen, &s); ++ if (len > 0) { ++ menu->wname = wp; ++ wlen -= len + 1; ++ wp += len + 1; ++ } else ++ memset (&s, 0, sizeof (s)); ++ if (menu->entries != NULL) ++ for (count = 0; count < menu->count; ++count) ++ if (menu->entries[count].text[0] != '\0') { ++ str = menu->entries[count].text; ++ menu->wentries[count] = wp; ++ len = mbsrtowcs (wp, &str, wlen, &s); ++ if (len > 0) { ++ wlen -= len + 1; ++ wp += len + 1; ++ } else { ++ memset (&s, 0, sizeof (s)); ++ *wp++ = L'\0'; ++ --wlen; ++ } ++ } + } +#endif + + menu->name = g_strdup (name); menu_scan_hotkey(menu); menu->start_x = 0; - menu->help_node = g_strdup (help_node); -@@ -109,8 +173,26 @@ static void menubar_paint_idx (WMenu *me - const unsigned char *text; +@@ -112,8 +175,26 @@ static void menubar_paint_idx (WMenu *me + const char *text; addch((unsigned char)menu->entries [idx].first_letter); - for (text = menu->entries [idx].text; *text; text++) @@ -300,7 +316,7 @@ if (*text != '&') addch(*text); else { -@@ -119,7 +201,7 @@ static void menubar_paint_idx (WMenu *me +@@ -122,7 +203,7 @@ static void menubar_paint_idx (WMenu *me addch(*(++text)); attrset(color); } @@ -309,22 +325,20 @@ } widget_move (&menubar->widget, y, x + 1); } -@@ -167,7 +249,13 @@ static void menubar_draw (WMenu *menubar +@@ -168,6 +249,12 @@ 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); -- printw ("%s", menubar->menu [i]->name); +#ifdef UTF8 + if (menubar->menu [i]->wname) + SLsmg_write_nwchars (menubar->menu [i]->wname, + wcslen (menubar->menu [i]->wname)); + else +#endif -+ printw ("%s", menubar->menu [i]->name); + tty_printf ("%s", menubar->menu [i]->name); } - if (menubar->dropped) -@@ -489,7 +577,13 @@ menubar_arrange(WMenu* menubar) +@@ -493,7 +580,13 @@ menubar_arrange(WMenu* menubar) for (i = 0; i < items; i++) { @@ -339,7 +353,7 @@ menubar->menu[i]->start_x = start_x; start_x += len + gap; } -@@ -502,7 +596,13 @@ menubar_arrange(WMenu* menubar) +@@ -506,7 +599,13 @@ menubar_arrange(WMenu* menubar) for (i = 0; i < items; i++) { /* preserve length here, to be used below */ @@ -354,7 +368,7 @@ } gap /= (items - 1); -@@ -526,6 +626,9 @@ menubar_arrange(WMenu* menubar) +@@ -530,6 +629,9 @@ menubar_arrange(WMenu* menubar) void destroy_menu (Menu *menu) { @@ -364,9 +378,9 @@ g_free (menu->name); g_free (menu->help_node); g_free (menu); ---- mc-4.6.1/src/filegui.c.utf8 2005-05-27 16:19:18.000000000 +0200 -+++ mc-4.6.1/src/filegui.c 2005-09-29 19:13:29.000000000 +0200 -@@ -69,6 +69,7 @@ +--- mc-4.6.1a/src/filegui.c.utf8 2005-05-27 05:35:15.000000000 +0200 ++++ mc-4.6.1a/src/filegui.c 2005-10-17 14:34:41.000000000 +0200 +@@ -65,6 +65,7 @@ #include "filegui.h" #include "key.h" /* get_event */ #include "util.h" /* strip_password() */ @@ -374,7 +388,7 @@ /* }}} */ -@@ -564,8 +565,8 @@ init_replace (FileOpContext *ctx, enum O +@@ -563,8 +564,8 @@ init_replace (FileOpContext *ctx, enum O * longest of "Overwrite..." labels * (assume "Target date..." are short enough) */ @@ -385,7 +399,7 @@ /* longest of button rows */ i = sizeof (rd_widgets) / sizeof (rd_widgets[0]); -@@ -576,7 +577,7 @@ init_replace (FileOpContext *ctx, enum O +@@ -575,7 +576,7 @@ init_replace (FileOpContext *ctx, enum O l2 = max (l2, l); l = 0; } @@ -394,7 +408,7 @@ } } l2 = max (l2, l); /* last row */ -@@ -594,12 +595,12 @@ init_replace (FileOpContext *ctx, enum O +@@ -593,12 +594,12 @@ init_replace (FileOpContext *ctx, enum O l = l1; } rd_widgets[i].xpos = l; @@ -409,7 +423,7 @@ } #endif /* ENABLE_NLS */ -@@ -618,7 +619,7 @@ init_replace (FileOpContext *ctx, enum O +@@ -617,7 +618,7 @@ init_replace (FileOpContext *ctx, enum O ADD_RD_LABEL (ui, 0, name_trunc (ui->replace_filename, @@ -418,7 +432,7 @@ ADD_RD_BUTTON (1); ADD_RD_BUTTON (2); -@@ -805,36 +806,36 @@ fmd_init_i18n (int force) +@@ -804,36 +805,36 @@ fmd_init_i18n (int force) if (fmd_widgets[i].text[0] != '\0') fmd_widgets[i].text = _(fmd_widgets[i].text); @@ -465,7 +479,7 @@ chkbox_xpos (FMCB0); chkbox_xpos (FMCB21); -@@ -856,7 +857,7 @@ fmd_init_i18n (int force) +@@ -855,7 +856,7 @@ fmd_init_i18n (int force) char * file_mask_dialog (FileOpContext *ctx, FileOperation operation, const char *text, @@ -474,7 +488,7 @@ { int source_easy_patterns = easy_patterns; char *source_mask, *orig_mask, *dest_dir, *tmpdest; -@@ -865,12 +866,20 @@ file_mask_dialog (FileOpContext *ctx, Fi +@@ -864,12 +865,20 @@ file_mask_dialog (FileOpContext *ctx, Fi struct stat buf; int val; QuickDialog Quick_input; @@ -496,7 +510,7 @@ fmd_init_i18n (FALSE); /* Set up the result pointers */ -@@ -929,6 +938,7 @@ file_mask_dialog (FileOpContext *ctx, Fi +@@ -928,6 +937,7 @@ file_mask_dialog (FileOpContext *ctx, Fi orig_mask = source_mask; if (!dest_dir || !*dest_dir) { g_free (source_mask); @@ -504,15 +518,15 @@ return dest_dir; } if (source_easy_patterns) { -@@ -982,5 +992,6 @@ file_mask_dialog (FileOpContext *ctx, Fi +@@ -981,5 +991,6 @@ file_mask_dialog (FileOpContext *ctx, Fi } if (val == B_USER) *do_background = 1; + g_free(def_text); return dest_dir; } ---- mc-4.6.1/src/panelize.c.utf8 2005-05-27 16:19:18.000000000 +0200 -+++ mc-4.6.1/src/panelize.c 2005-09-29 19:13:29.000000000 +0200 +--- mc-4.6.1a/src/panelize.c.utf8 2005-05-27 05:35:15.000000000 +0200 ++++ mc-4.6.1a/src/panelize.c 2005-10-17 14:34:41.000000000 +0200 @@ -127,7 +127,7 @@ init_panelize (void) i = sizeof (panelize_but) / sizeof (panelize_but[0]); while (i--) { @@ -537,25 +551,34 @@ #endif /* ENABLE_NLS */ ---- mc-4.6.1/src/main.c.utf8 2005-07-23 18:52:02.000000000 +0200 -+++ mc-4.6.1/src/main.c 2005-09-29 19:13:29.000000000 +0200 -@@ -1609,7 +1609,11 @@ update_xterm_title_path (void) +--- mc-4.6.1a/src/main.c.utf8 2005-09-06 13:38:45.000000000 +0200 ++++ mc-4.6.1a/src/main.c 2005-10-17 14:34:41.000000000 +0200 +@@ -697,7 +697,7 @@ load_prompt (int fd, void *unused) + int prompt_len; + + tmp_prompt = strip_ctrl_codes (subshell_prompt); +- prompt_len = strlen (tmp_prompt); ++ prompt_len = mbstrlen (tmp_prompt); + + /* Check for prompts too big */ + if (COLS > 8 && prompt_len > COLS - 8) { +@@ -1610,7 +1610,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 (*s)) + if (!is_printable ((unsigned char) *s)) +#else /* UTF8 */ -+ if (*s < ' ') ++ if (*s < ' ') +#endif /* UTF8 */ *s = '?'; } while (*++s); fprintf (stdout, "\33]0;mc - %s\7", p); ---- mc-4.6.1/src/view.c.utf8 2005-05-27 16:19:18.000000000 +0200 -+++ mc-4.6.1/src/view.c 2005-09-29 19:13:29.000000000 +0200 -@@ -36,6 +36,10 @@ - #include - #include +--- mc-4.6.1a/src/view.c.utf8 2005-10-04 23:07:20.000000000 +0200 ++++ mc-4.6.1a/src/view.c 2005-10-17 14:34:41.000000000 +0200 +@@ -43,6 +43,10 @@ + #include + #include +#ifdef UTF8 +#include @@ -564,134 +587,137 @@ #include "global.h" #include "tty.h" #include "cmd.h" /* For view_other_cmd */ -@@ -793,7 +797,7 @@ view_status (WView *view, gboolean updat +@@ -1631,7 +1635,7 @@ view_display_status (WView *view) + hline (' ', width); - if (!i18n_adjust) { - file_label = _("File: %s"); -- i18n_adjust = strlen (file_label) - 2; -+ i18n_adjust = mbstrlen (file_label) - 2; - } - - if (w < i18n_adjust + 6) -@@ -849,7 +853,11 @@ view_display_clean (WView *view, int hei - widget_erase ((Widget *) view); - } - -+#ifndef UTF8 - #define view_add_character(view,c) addch (c) -+#else /* UTF8 */ -+#define view_add_character(view,c) SLsmg_write_char(c) -+#endif /* UTF8 */ - #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) -@@ -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++) { + file_label = _("File: %s"); +- file_label_width = strlen (file_label) - 2; ++ file_label_width = mbstrlen (file_label) - 2; + file_name = view->filename ? view->filename + : view->command ? view->command + : ""; +@@ -1755,6 +1759,9 @@ view_display_hex (WView *view) + int c; + mark_t boldflag = MARK_NORMAL; + struct hexedit_change_node *curr = view->change_list; +#ifdef UTF8 -+ mbstate_t mbs; -+ char mbbuf[MB_LEN_MAX]; -+ int mblen; -+ wchar_t wc; ++ 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->viewer_nroff_flag && c == '\b') { -+#else /* UTF8 */ -+ mblen = 1; -+ mbbuf[0] = convert_to_display_c (c); -+ -+ while (mblen < MB_LEN_MAX) { -+ int res; -+ memset (&mbs, 0, sizeof (mbs)); -+ res = mbrtowc (&wc, mbbuf, mblen, &mbs); -+ if (res <= 0 && res != -2) { -+ wc = '.'; -+ mblen = 1; -+ break; -+ } -+ if (res == mblen) -+ break; -+ -+ mbbuf[mblen] = convert_to_display_c (get_byte (view, from + mblen)); -+ mblen++; -+ } -+ -+ if (mblen == MB_LEN_MAX) { -+ wc = '.'; -+ mblen = 1; -+ } -+ -+ from += mblen - 1; -+ -+ if (view->viewer_nroff_flag && wc == '\b') { -+#endif /* UTF8 */ - int c_prev; - int c_next; -@@ -1122,12 +1166,23 @@ display (WView *view) - && col < width - view->start_col) { - view_gotoyx (view, row, col + view->start_col); + char hex_buff[10]; /* A temporary buffer for sprintf and mvwaddstr */ + int bytes; /* Number of bytes already printed on the line */ +@@ -1850,13 +1857,28 @@ view_display_hex (WView *view) + view->hexview_in_text ? VIEW_UNDERLINED_COLOR : + MARKED_SELECTED_COLOR); +#ifndef UTF8 - c = convert_to_display_c (c); -- - if (!is_printable (c)) - c = '.'; -- - view_add_character (view, c); + c = convert_to_display_c (c); + if (!is_printable (c)) + c = '.'; +#else /* UTF8 */ -+ if (!iswprint (wc)) ++ if (!iswprint (wc)) ++ wc = '.'; ++ ++ { ++ int cw = wcwidth(wc); ++ if (cw > 1) ++ col += cw - 1; ++ } ++#endif /* UTF8 */ + + /* Print corresponding character on the text side */ + widget_move (view, top + row, left + text_start + bytes); ++#ifndef UTF8 + tty_print_char (c); ++#else /* UTF8 */ ++ tty_print_char (wc); ++#endif /* UTF8 */ + + /* Save the cursor position for view_place_cursor() */ + if (from == view->hex_cursor && view->hexview_in_text) { +@@ -1884,6 +1906,12 @@ view_display_text (WView * view) + offset_type from; + int c; + struct hexedit_change_node *curr = view->change_list; ++#ifdef UTF8 ++ mbstate_t mbs; ++ char mbbuf[MB_LEN_MAX]; ++ int mblen; ++ wchar_t wc; ++#endif /* UTF8 */ + + view_display_clean (view); + view_display_ruler (view); +@@ -1896,8 +1924,37 @@ view_display_text (WView * view) + + attrset (NORMAL_COLOR); + for (row = 0, col = 0; row < height && (c = get_byte (view, from)) != -1; from++) { +- ++#ifndef UTF8 + if (view->text_nroff_mode && c == '\b') { ++#else /* UTF8 */ ++ mblen = 1; ++ mbbuf[0] = convert_to_display_c (c); ++ ++ while (mblen < MB_LEN_MAX) { ++ int res; ++ memset (&mbs, 0, sizeof (mbs)); ++ res = mbrtowc (&wc, mbbuf, mblen, &mbs); ++ if (res <= 0 && res != -2) { + wc = '.'; -+ view_add_character (view, wc); -+ -+ { -+ int cw = wcwidth(wc); -+ if (cw > 1) -+ col+= cw - 1; ++ mblen = 1; ++ break; + } -+#endif /* UTF8 */ ++ if (res == mblen) ++ break; + - } - col++; - if (boldflag != MARK_NORMAL) { ---- mc-4.6.1/src/screen.c.utf8 2005-05-27 16:19:18.000000000 +0200 -+++ mc-4.6.1/src/screen.c 2005-09-29 19:13:29.000000000 +0200 -@@ -169,22 +169,59 @@ add_permission_string (char *dest, int w ++ mbbuf[mblen] = convert_to_display_c (get_byte (view, from + mblen)); ++ mblen++; ++ } ++ ++ if (mblen == MB_LEN_MAX) { ++ wc = '.'; ++ mblen = 1; ++ } ++ ++ from += mblen - 1; ++ ++ if (view->text_nroff_mode && wc == '\b') { ++#endif /* UTF8 */ + int c_prev; + int c_next; + +--- mc-4.6.1a/src/screen.c.utf8 2005-10-04 01:37:51.000000000 +0200 ++++ mc-4.6.1a/src/screen.c 2005-10-17 14:34:41.000000000 +0200 +@@ -171,21 +171,56 @@ add_permission_string (char *dest, int w static const char * string_file_name (file_entry *fe, int len) { -- static char buffer [BUF_SMALL]; +- static char buffer [MC_MAXPATHLEN + 1]; size_t i; + +- for (i = 0; i < sizeof(buffer) - 1; i++) { +- char c; +#ifdef UTF8 + static char buffer [BUF_SMALL * 4]; + mbstate_t s; + int mbmax = MB_CUR_MAX; + const char *str = fe->fname; -- for (i = 0; i < sizeof(buffer) - 1; i++) { -- char c; +- c = fe->fname[i]; + memset (&s, 0, sizeof (s)); +#else + static char buffer [BUF_SMALL]; +#endif -- c = fe->fname[i]; +- if (!c) +- break; +#ifdef UTF8 + if (SLsmg_Is_Unicode) + for (i = 0; i < sizeof (buffer) - 1; i++) { + wchar_t wc; + int len; - -- if (!c) -- break; ++ + len = mbrtowc (&wc, str, mbmax, &s); + if (!len) + break; @@ -711,30 +737,25 @@ + memcpy (buffer + i, str, len); + i += len - 1; + str += len; -+ } -+ else ++ } else +#endif -+ for (i = 0; i < sizeof(buffer) - 1; i++) { -+ char c; ++ for (i = 0; i < sizeof(buffer) - 1; i++) { ++ char c; ++ ++ c = fe->fname[i]; - if (!is_printable(c)) - c = '?'; -+ c = fe->fname[i]; ++ if (!c) break; - buffer[i] = c; -- } -+ if (!c) -+ break; ++ if (!is_printable(c)) c = '?'; + -+ if (!is_printable(c)) -+ c = '?'; -+ -+ buffer[i] = c; -+ } ++ buffer[i] = c; + } buffer[i] = 0; - return buffer; -@@ -425,42 +462,6 @@ static struct { +@@ -450,42 +485,6 @@ static struct { { "dot", 1, 0, J_RIGHT, " ", 0, string_dot, NULL }, }; @@ -777,7 +798,7 @@ static int file_compute_color (int attr, file_entry *fe) { -@@ -514,14 +515,18 @@ file_compute_color (int attr, file_entry +@@ -539,14 +538,18 @@ file_compute_color (int attr, file_entry /* Formats the file number file_index of panel in the buffer dest */ static void @@ -799,7 +820,7 @@ length = 0; empty_line = (file_index >= panel->count); -@@ -539,34 +544,137 @@ format_file (char *dest, int limit, WPan +@@ -564,34 +567,137 @@ format_file (char *dest, int limit, WPan break; if (format->string_fn){ @@ -833,7 +854,13 @@ + else if (!strcmp(format->id, "mode")) + perm = 2; + } -+ + +- if (permission_mode && !strcmp(format->id, "perm")) +- add_permission_string (old_pos, format->field_len, fe, attr, color, 0); +- else if (permission_mode && !strcmp(format->id, "mode")) +- add_permission_string (old_pos, format->field_len, fe, attr, color, 1); +- else +- addstr (old_pos); + wide = 0; +#ifdef UTF8 + if (SLsmg_Is_Unicode && !empty_line && !perm) { @@ -853,19 +880,13 @@ + } else +#endif + { -+ txtlen = strlen (txt); ++ txtlen = mbstrlen (txt); + txtwidth = txtlen; + } + + over = txtwidth > len; + still = over ? txtlen - len : len - txtlen; - -- if (permission_mode && !strcmp(format->id, "perm")) -- add_permission_string (old_pos, format->field_len, fe, attr, color, 0); -- else if (permission_mode && !strcmp(format->id, "mode")) -- add_permission_string (old_pos, format->field_len, fe, attr, color, 1); -- else -- addstr (old_pos); ++ + switch (HIDE_FIT(format->just_mode)) { + case J_LEFT: + still = 0; @@ -877,7 +898,7 @@ + default: + break; + } -+ + + attrset (color); + + if (wide) { @@ -939,7 +960,7 @@ + len - txtlen - still); + } + buffer[len] = '\0'; - ++ + if (perm) + add_permission_string (buffer, format->field_len, fe, + attr, color, perm - 1); @@ -951,7 +972,7 @@ } else { if (attr == SELECTED || attr == MARKED_SELECTED) attrset (SELECTED_COLOR); -@@ -589,7 +697,6 @@ repaint_file (WPanel *panel, int file_in +@@ -614,7 +720,6 @@ repaint_file (WPanel *panel, int file_in { int second_column = 0; int width, offset; @@ -959,7 +980,7 @@ offset = 0; if (!isstatus && panel->split){ -@@ -618,7 +725,7 @@ repaint_file (WPanel *panel, int file_in +@@ -643,7 +748,7 @@ repaint_file (WPanel *panel, int file_in widget_move (&panel->widget, file_index - panel->top_file + 2, 1); } @@ -968,7 +989,16 @@ if (!isstatus && panel->split){ if (second_column) -@@ -1068,6 +1175,12 @@ paint_frame (WPanel *panel) +@@ -691,7 +796,7 @@ display_mini_info (WPanel *panel) + ngettext("%s in %d file", "%s in %d files", panel->marked), + b_bytes, panel->marked); + +- if ((int) strlen (buffer) > cols-2){ ++ if ((int) mbstrlen (buffer) > cols-2){ + buffer [cols] = 0; + p += 2; + } else +@@ -1100,6 +1205,12 @@ paint_frame (WPanel *panel) int side, width; const char *txt; @@ -981,10 +1011,11 @@ if (!panel->split) adjust_top_file (panel); -@@ -1092,16 +1205,37 @@ paint_frame (WPanel *panel) +@@ -1124,16 +1235,38 @@ paint_frame (WPanel *panel) if (format->string_fn){ txt = format->title; +- header_len = strlen (txt); + attrset (MARKED_COLOR); + width -= format->field_len; +#ifdef UTF8 @@ -1008,22 +1039,23 @@ + continue; + } +#endif - header_len = strlen (txt); ++ ++ header_len = mbstrlen (txt); if (header_len > format->field_len) header_len = format->field_len; - attrset (MARKED_COLOR); spaces = (format->field_len - header_len) / 2; extra = (format->field_len - header_len) % 2; - printw ("%*s%.*s%*s", spaces, "", + tty_printf ("%*s%.*s%*s", spaces, "", header_len, txt, spaces+extra, ""); - width -= 2 * spaces + extra + header_len; } else { attrset (NORMAL_COLOR); one_vline (); ---- mc-4.6.1/src/widget.h.utf8 2004-08-29 20:46:16.000000000 +0200 -+++ mc-4.6.1/src/widget.h 2005-09-29 19:13:29.000000000 +0200 -@@ -25,6 +25,7 @@ typedef struct WButton { +--- mc-4.6.1a/src/widget.h.utf8 2005-06-14 15:02:31.000000000 +0200 ++++ mc-4.6.1a/src/widget.h 2005-10-17 14:34:41.000000000 +0200 +@@ -22,6 +22,7 @@ typedef struct WButton { char *text; /* text of button */ int hotkey; /* hot KEY */ int hotpos; /* offset hot KEY char in text */ @@ -1033,7 +1065,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; @@ -1057,7 +1089,7 @@ int first; /* Is first keystroke? */ int disable_update; /* Do we want to skip updates? */ int is_password; /* Is this a password input line? */ - unsigned char *buffer; /* pointer to editing buffer */ + char *buffer; /* pointer to editing buffer */ +#ifdef UTF8 + char charbuf[MB_LEN_MAX]; +#endif /* UTF8 */ @@ -1065,8 +1097,19 @@ GList *history; /* The history */ int need_push; /* need to push the current Input on hist? */ char **completions; /* Possible completions array */ ---- mc-4.6.1/src/hotlist.c.utf8 2005-05-27 16:19:18.000000000 +0200 -+++ mc-4.6.1/src/hotlist.c 2005-09-29 19:13:29.000000000 +0200 +--- mc-4.6.1a/src/tty.h.utf8 2005-09-05 04:14:29.000000000 +0200 ++++ mc-4.6.1a/src/tty.h 2005-10-17 14:34:41.000000000 +0200 +@@ -8,6 +8,8 @@ + of ifdefs in the other files small. + */ + ++#include /* gboolean is used here */ ++ + #ifdef HAVE_SLANG + # include "myslang.h" + #endif +--- mc-4.6.1a/src/hotlist.c.utf8 2005-05-27 05:35:15.000000000 +0200 ++++ mc-4.6.1a/src/hotlist.c 2005-10-17 14:34:41.000000000 +0200 @@ -555,7 +555,7 @@ init_i18n_stuff(int list_type, int cols) row = hotlist_but [i].y; @@ -1100,25 +1143,25 @@ } space = (len - 4 - l[0] - l[1] - l[2]) / 4; -@@ -860,7 +860,7 @@ add_new_entry_input (const char *header, - static int i18n_flag = 0; - #endif /* ENABLE_NLS */ +@@ -863,7 +863,7 @@ add_new_entry_input (const char *header, -- 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; + 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); -@@ -955,7 +955,7 @@ add_new_group_input (const char *header, - static int i18n_flag = 0; +@@ -959,7 +959,7 @@ add_new_group_input (const char *header, #endif /* ENABLE_NLS */ - -- len = max (strlen (header), (size_t) msglen (label, &lines)) + 4; -+ len = max ((int) mbstrlen (header), (size_t) msglen (label, &lines)) + 4; + + msglen (label, &lines, &cols); +- len = max ((int) strlen (header), cols) + 4; ++ len = max ((int) mbstrlen (header), cols) + 4; len = max (len, 64); #ifdef ENABLE_NLS -@@ -1011,7 +1011,7 @@ void add2hotlist_cmd (void) +@@ -1015,7 +1015,7 @@ void add2hotlist_cmd (void) { char *prompt, *label; const char *cp = _("Label for \"%s\":"); @@ -1127,9 +1170,9 @@ char *label_string = g_strdup (current_panel->cwd); strip_password (label_string, 1); ---- mc-4.6.1/src/help.c.utf8 2005-05-27 16:19:18.000000000 +0200 -+++ mc-4.6.1/src/help.c 2005-09-29 19:13:29.000000000 +0200 -@@ -445,10 +445,28 @@ static void help_show (Dlg_head *h, cons +--- mc-4.6.1a/src/help.c.utf8 2005-07-22 11:29:50.000000000 +0200 ++++ mc-4.6.1a/src/help.c 2005-10-17 14:34:41.000000000 +0200 +@@ -449,10 +449,28 @@ static void help_show (Dlg_head *h, cons #ifndef HAVE_SLANG addch (acs_map [c]); #else @@ -1158,7 +1201,7 @@ col++; break; } -@@ -771,6 +789,12 @@ interactive_display (const char *filenam +@@ -805,6 +823,12 @@ interactive_display (const char *filenam message (1, MSG_ERROR, _(" Cannot open file %s \n %s "), filename ? filename : hlpfile, unix_error_string (errno)); } @@ -1171,9 +1214,9 @@ if (!filename) g_free (hlpfile); ---- mc-4.6.1/src/wtools.c.utf8 2005-05-27 16:19:19.000000000 +0200 -+++ mc-4.6.1/src/wtools.c 2005-09-29 19:13:29.000000000 +0200 -@@ -48,11 +48,11 @@ create_listbox_window (int cols, int lin +--- mc-4.6.1a/src/wtools.c.utf8 2005-09-05 05:21:32.000000000 +0200 ++++ mc-4.6.1a/src/wtools.c 2005-10-17 14:34:41.000000000 +0200 +@@ -49,11 +49,11 @@ create_listbox_window (int cols, int lin /* Adjust sizes */ lines = (lines > LINES - 6) ? LINES - 6 : lines; @@ -1187,7 +1230,7 @@ cols = len; cols = cols > COLS - 6 ? COLS - 6 : cols; -@@ -123,7 +123,7 @@ query_dialog (const char *header, const +@@ -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 *); @@ -1196,16 +1239,16 @@ if (strchr (cp, '&') != NULL) win_len--; } -@@ -131,7 +131,7 @@ query_dialog (const char *header, const - } +@@ -133,7 +133,7 @@ query_dialog (const char *header, const /* count coordinates */ -- cols = 6 + max (win_len, max ((int) strlen (header), msglen (text, &lines))); -+ cols = 6 + max (win_len, max ((int) mbstrlen (header), msglen (text, &lines))); + 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; -@@ -146,7 +146,7 @@ query_dialog (const char *header, const +@@ -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 *); @@ -1214,16 +1257,16 @@ if (strchr (cur_name, '&') != NULL) xpos--; -@@ -457,7 +457,7 @@ fg_input_dialog_help (const char *header - g_strlcpy (histname + 3, header, 61); +@@ -461,7 +461,7 @@ fg_input_dialog_help (const char *header quick_widgets[2].histname = histname; -- len = max ((int) strlen (header), msglen (text, &lines)) + 4; -+ len = max ((int) mbstrlen (header), msglen (text, &lines)) + 4; + 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 -@@ -477,7 +477,7 @@ fg_input_dialog_help (const char *header +@@ -481,7 +481,7 @@ fg_input_dialog_help (const char *header */ quick_widgets[0].relative_x = len / 2 + 4; quick_widgets[1].relative_x = @@ -1232,9 +1275,9 @@ quick_widgets[0].x_divisions = quick_widgets[1].x_divisions = len; #endif /* ENABLE_NLS */ ---- mc-4.6.1/src/util.h.utf8 2005-01-13 20:20:47.000000000 +0100 -+++ mc-4.6.1/src/util.h 2005-09-29 19:13:29.000000000 +0200 -@@ -93,6 +93,13 @@ void init_uid_gid_cache (void); +--- mc-4.6.1a/src/util.h.utf8 2005-10-04 17:20:10.000000000 +0200 ++++ mc-4.6.1a/src/util.h 2005-10-17 14:34:41.000000000 +0200 +@@ -111,6 +111,13 @@ void init_uid_gid_cache (void); char *get_group (int); char *get_owner (int); @@ -1248,10 +1291,10 @@ #define MAX_I18NTIMELENGTH 14 #define MIN_I18NTIMELENGTH 10 #define STD_I18NTIMELENGTH 12 ---- mc-4.6.1/src/widget.c.utf8 2005-05-27 16:19:19.000000000 +0200 -+++ mc-4.6.1/src/widget.c 2005-09-29 19:13:29.000000000 +0200 -@@ -33,6 +33,9 @@ - #include +--- mc-4.6.1a/src/widget.c.utf8 2005-10-08 06:52:42.000000000 +0200 ++++ mc-4.6.1a/src/widget.c 2005-10-17 14:34:41.000000000 +0200 +@@ -35,6 +35,9 @@ + #include "global.h" #include "tty.h" +#ifdef UTF8 @@ -1260,19 +1303,19 @@ #include "color.h" #include "mouse.h" #include "dialog.h" -@@ -148,6 +151,11 @@ button_callback (WButton *b, widget_msg_ +@@ -181,6 +184,11 @@ button_callback (Widget *w, widget_msg_t if (b->hotpos >= 0) { - attrset ((b->selected) ? HOT_FOCUSC : HOT_NORMALC); - widget_move (&b->widget, 0, b->hotpos + off); + widget_selectcolor (w, b->selected, TRUE); + widget_move (w, 0, b->hotpos + off); +#ifdef UTF8 -+ if (SLsmg_Is_Unicode) ++ if (SLsmg_Is_Unicode) + SLsmg_write_nwchars (&b->hotwc, 1); + else +#endif addch ((unsigned char) b->text[b->hotpos]); } return MSG_HANDLED; -@@ -179,7 +187,7 @@ button_event (Gpm_Event *event, WButton +@@ -214,7 +222,7 @@ button_event (Gpm_Event *event, void *da static int button_len (const char *text, unsigned int flags) { @@ -1281,7 +1324,7 @@ switch (flags){ case DEFPUSH_BUTTON: ret += 6; -@@ -202,14 +210,36 @@ button_len (const char *text, unsigned i +@@ -237,14 +245,36 @@ button_len (const char *text, unsigned i * the button text is g_malloc()ed, we can safely change and shorten it. */ static void @@ -1293,37 +1336,37 @@ if (cp != NULL && cp[1] != '\0') { - g_strlcpy (cp, cp + 1, strlen (cp)); -- b->hotkey = tolower (*cp); +- b->hotkey = tolower ((unsigned char) *cp); - b->hotpos = cp - b->text; +#ifdef UTF8 -+ if (SLsmg_Is_Unicode) { -+ mbstate_t s; -+ int len; ++ if (SLsmg_Is_Unicode) { ++ mbstate_t s; ++ int len; + -+ *cp = '\0'; -+ memset (&s, 0, sizeof (s)); -+ len = mbrtowc (hotwcp, cp + 1, MB_CUR_MAX, &s); -+ if (len > 0) { -+ *hotposp = mbstrlen (text); -+ if (*hotposp < 0) { -+ *hotposp = -1; -+ } else { -+ /* FIXME */ -+ *hotkeyp = tolower (*hotwcp); -+ } -+ } -+ } else ++ *cp = '\0'; ++ memset (&s, 0, sizeof (s)); ++ len = mbrtowc (hotwcp, cp + 1, MB_CUR_MAX, &s); ++ if (len > 0) { ++ *hotposp = mbstrlen (text); ++ if (*hotposp < 0) { ++ *hotposp = -1; ++ } else { ++ /* FIXME */ ++ *hotkeyp = tolower (*hotwcp); ++ } ++ } ++ } else +#endif -+ { -+ *hotkeyp = tolower (cp[1]); -+ *hotposp = cp - text; -+ } ++ { ++ *hotkeyp = tolower (cp[1]); ++ *hotposp = cp - text; ++ } + -+ memmove (cp, cp + 1, strlen (cp + 1) + 1); ++ memmove (cp, cp + 1, strlen (cp + 1) + 1); } } -@@ -231,22 +261,23 @@ button_new (int y, int x, int action, in +@@ -265,8 +295,9 @@ button_new (int y, int x, int action, in widget_want_hotkey (b->widget, 1); b->hotkey = 0; b->hotpos = -1; @@ -1334,6 +1377,7 @@ return b; } +@@ -279,14 +310,13 @@ button_get_text (WButton *b) void button_set_text (WButton *b, const char *text) { @@ -1347,21 +1391,16 @@ } - -+ /* Radio button widget */ - static int radio_event (Gpm_Event *event, WRadio *r); + static int radio_event (Gpm_Event *event, void *); -@@ -320,16 +351,37 @@ radio_callback (WRadio *r, int msg, int +@@ -361,14 +391,35 @@ radio_callback (Widget *w, widget_msg_t widget_move (&r->widget, i, 0); - printw ("(%c) ", (r->sel == i) ? '*' : ' '); + tty_printf ("(%c) ", (r->sel == i) ? '*' : ' '); - for (cp = r->texts[i]; *cp; cp++) { - if (*cp == '&') { -- attrset ((i == r->pos && msg == WIDGET_FOCUS) -- ? HOT_FOCUSC : HOT_NORMALC); -- addch (*++cp); -- attrset ((i == r->pos -- && msg == WIDGET_FOCUS) ? FOCUSC : NORMALC); +- widget_selectcolor (w, focused, TRUE); + cp = strchr (r->texts[i], '&'); + if (cp != NULL) { +#ifdef UTF8 @@ -1369,36 +1408,36 @@ + wchar_t wc; + int len; +#endif -+ printw ("%.*s", (int) ((char *) cp - r->texts[i]), ++ tty_printf ("%.*s", (int) ((char *) cp - r->texts[i]), + r->texts[i]); -+ attrset ((i == r->pos && msg == WIDGET_FOCUS) -+ ? HOT_FOCUSC : HOT_NORMALC); ++ widget_selectcolor (w, focused, TRUE); +#ifdef UTF8 + if (SLsmg_Is_Unicode) { + memset (&s, 0, sizeof (s)); + len = mbrtowc (&wc, cp + 1, MB_CUR_MAX, &s); + ++cp; + if (len > 0) { -+ printw ("%.*s", len, cp); ++ tty_printf ("%.*s", len, cp); + cp += len; + } - } else -- addch (*cp); -- } ++ } else +#endif + { -+ addch (*++cp); + addch (*++cp); +- widget_selectcolor (w, focused, FALSE); +- } else +- addch (*cp); +- } + ++cp; + } -+ attrset ((i == r->pos && msg == WIDGET_FOCUS) -+ ? FOCUSC : NORMALC); ++ widget_selectcolor (w, focused, FALSE); + } else + cp = r->texts[i]; -+ addstr ((char *) cp); ++ addstr ((char *) cp); } return MSG_HANDLED; -@@ -365,7 +417,7 @@ radio_new (int y, int x, int count, cons +@@ -407,7 +458,7 @@ radio_new (int y, int x, int count, cons /* Compute the longest string */ max = 0; for (i = 0; i < count; i++){ @@ -1407,9 +1446,9 @@ if (m > max) max = m; } -@@ -426,6 +478,11 @@ check_callback (WCheck *c, widget_msg_t +@@ -468,6 +519,11 @@ check_callback (Widget *w, widget_msg_t if (c->hotpos >= 0) { - attrset ((msg == WIDGET_FOCUS) ? HOT_FOCUSC : HOT_NORMALC); + widget_selectcolor (w, msg == WIDGET_FOCUS, TRUE); widget_move (&c->widget, 0, +c->hotpos + 4); +#ifdef UTF8 + if (SLsmg_Is_Unicode) @@ -1419,17 +1458,17 @@ addch ((unsigned char) c->text[c->hotpos]); } return MSG_HANDLED; -@@ -460,32 +517,18 @@ WCheck * +@@ -505,35 +561,20 @@ 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), - (callback_fn)check_callback, - (mouse_h) check_event); + check_callback, check_event); c->state = state ? C_BOOL : 0; c->text = g_strdup (text); c->hotkey = 0; @@ -1445,7 +1484,7 @@ - } - s++; - if (*s){ -- c->hotkey = tolower (*s); +- c->hotkey = tolower ((unsigned char) *s); - c->hotpos = t - c->text; - } - *t = *s; @@ -1455,16 +1494,20 @@ return c; } -@@ -527,7 +570,7 @@ label_callback (WLabel *l, int msg, int +- + /* Label widget */ + + static cb_ret_t +@@ -572,7 +613,7 @@ label_callback (Widget *w, widget_msg_t } widget_move (&l->widget, y, 0); - printw ("%s", p); + tty_printf ("%s", p); - xlen = l->widget.cols - strlen (p); + xlen = l->widget.cols - mbstrlen (p); if (xlen > 0) - printw ("%*s", xlen, " "); + tty_printf ("%*s", xlen, " "); if (!q) -@@ -561,7 +604,7 @@ label_set_text (WLabel *label, const cha +@@ -606,7 +647,7 @@ label_set_text (WLabel *label, const cha if (text){ label->text = g_strdup (text); if (label->auto_adjust_cols) { @@ -1473,7 +1516,7 @@ if (newcols > label->widget.cols) label->widget.cols = newcols; } -@@ -585,7 +628,7 @@ label_new (int y, int x, const char *tex +@@ -630,7 +671,7 @@ label_new (int y, int x, const char *tex if (!text || strchr(text, '\n')) width = 1; else @@ -1481,8 +1524,8 @@ + width = mbstrlen (text); l = g_new (WLabel, 1); - init_widget (&l->widget, y, x, 1, width, -@@ -734,13 +777,69 @@ static void draw_history_button (WInput + init_widget (&l->widget, y, x, 1, width, label_callback, NULL); +@@ -778,13 +819,69 @@ static void draw_history_button (WInput /* Pointer to killed data */ static char *kill_buffer = 0; @@ -1554,7 +1597,7 @@ if (should_show_history_button (in)) has_history = HISTORY_BUTTON_WIDTH; -@@ -750,7 +849,7 @@ update_input (WInput *in, int clear_firs +@@ -794,7 +891,7 @@ update_input (WInput *in, int clear_firs /* Make the point visible */ if ((in->point < in->first_shown) || @@ -1563,7 +1606,7 @@ in->first_shown = in->point - (in->field_len / 3); if (in->first_shown < 0) in->first_shown = 0; -@@ -770,14 +869,29 @@ update_input (WInput *in, int clear_firs +@@ -814,14 +911,29 @@ update_input (WInput *in, int clear_firs addch (' '); widget_move (&in->widget, 0, 0); @@ -1595,7 +1638,7 @@ if (clear_first) in->first = 0; -@@ -919,7 +1033,7 @@ char * +@@ -974,7 +1086,7 @@ char * show_hist (GList *history, int widget_x, int widget_y) { GList *hi, *z; @@ -1604,7 +1647,7 @@ int x, y, w, h; char *q, *r = 0; Dlg_head *query_dlg; -@@ -932,7 +1046,7 @@ show_hist (GList *history, int widget_x, +@@ -987,7 +1099,7 @@ show_hist (GList *history, int widget_x, z = g_list_first (history); hi = z; while (hi) { @@ -1613,7 +1656,7 @@ maxlen = i; count++; hi = g_list_next (hi); -@@ -1104,35 +1218,83 @@ new_input (WInput *in) +@@ -1159,35 +1271,83 @@ new_input (WInput *in) in->need_push = 1; in->buffer [0] = 0; in->point = 0; @@ -1700,7 +1743,7 @@ return MSG_HANDLED; } -@@ -1140,12 +1302,14 @@ static void +@@ -1195,12 +1355,14 @@ static void beginning_of_line (WInput *in) { in->point = 0; @@ -1716,7 +1759,7 @@ } static void -@@ -1153,18 +1317,21 @@ backward_char (WInput *in) +@@ -1208,18 +1370,21 @@ backward_char (WInput *in) { if (in->point) in->point--; @@ -1733,14 +1776,14 @@ } static void - forward_word (WInput *in) + forward_word (WInput * in) { +#ifndef UTF8 - unsigned char *p = in->buffer+in->point; + char *p = in->buffer + in->point; - while (*p && (isspace (*p) || ispunct (*p))) -@@ -1172,11 +1339,39 @@ forward_word (WInput *in) - while (*p && isalnum (*p)) + while (*p +@@ -1229,11 +1394,39 @@ forward_word (WInput * in) + while (*p && isalnum ((unsigned char) *p)) p++; in->point = p - in->buffer; +#else /* UTF8 */ @@ -1749,26 +1792,26 @@ + 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; ++ in->charpoint = 0; +#endif /* UTF8 */ } @@ -1776,11 +1819,11 @@ backward_word (WInput *in) { +#ifndef UTF8 - unsigned char *p = in->buffer+in->point; + char *p = in->buffer + in->point; - 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))) + while (p - 1 > in->buffer - 1 && (isspace ((unsigned char) *(p - 1)) +@@ -1243,6 +1436,32 @@ backward_word (WInput *in) + while (p - 1 > in->buffer - 1 && isalnum ((unsigned char) *(p - 1))) p--; in->point = p - in->buffer; +#else /* UTF8 */ @@ -1812,7 +1855,7 @@ } static void -@@ -1216,8 +1437,9 @@ backward_delete (WInput *in) +@@ -1275,8 +1494,9 @@ backward_delete (WInput *in) if (!in->point) return; @@ -1824,7 +1867,7 @@ in->need_push = 1; in->point--; } -@@ -1225,10 +1447,8 @@ backward_delete (WInput *in) +@@ -1284,10 +1504,8 @@ backward_delete (WInput *in) static void delete_char (WInput *in) { @@ -1837,7 +1880,7 @@ in->need_push = 1; } -@@ -1243,6 +1463,9 @@ copy_region (WInput *in, int x_first, in +@@ -1302,6 +1520,9 @@ copy_region (WInput *in, int x_first, in g_free (kill_buffer); @@ -1847,7 +1890,7 @@ kill_buffer = g_strndup(in->buffer+first,last-first); } -@@ -1251,11 +1474,13 @@ delete_region (WInput *in, int x_first, +@@ -1310,11 +1531,13 @@ delete_region (WInput *in, int x_first, { int first = min (x_first, x_last); int last = max (x_first, x_last); @@ -1863,7 +1906,7 @@ in->need_push = 1; } -@@ -1272,6 +1497,8 @@ kill_word (WInput *in) +@@ -1331,6 +1554,8 @@ kill_word (WInput *in) copy_region (in, old_point, new_point); delete_region (in, old_point, new_point); in->need_push = 1; @@ -1872,7 +1915,7 @@ } static void -@@ -1315,16 +1542,20 @@ yank (WInput *in) +@@ -1374,16 +1599,20 @@ yank (WInput *in) if (!kill_buffer) return; @@ -1895,7 +1938,7 @@ } void -@@ -1334,9 +1565,10 @@ assign_text (WInput *in, const char *tex +@@ -1393,9 +1622,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; @@ -1907,7 +1950,7 @@ } static void -@@ -1461,6 +1693,7 @@ port_region_marked_for_delete (WInput *i +@@ -1522,6 +1752,7 @@ port_region_marked_for_delete (WInput *i *in->buffer = 0; in->point = 0; in->first = 0; @@ -1915,7 +1958,7 @@ } cb_ret_t -@@ -1489,7 +1722,11 @@ handle_char (WInput *in, int c_code) +@@ -1550,7 +1781,11 @@ handle_char (WInput *in, int c_code) } } if (!input_map [i].fn){ @@ -1927,7 +1970,7 @@ return MSG_NOT_HANDLED; if (in->first){ port_region_marked_for_delete (in); -@@ -1523,6 +1760,9 @@ input_set_point (WInput *in, int pos) +@@ -1584,6 +1819,9 @@ input_set_point (WInput *in, int pos) if (pos != in->point) free_completions (in); in->point = pos; @@ -1937,7 +1980,7 @@ update_input (in, 1); } -@@ -1562,7 +1802,7 @@ input_callback (WInput *in, widget_msg_t +@@ -1624,7 +1862,7 @@ input_callback (Widget *w, widget_msg_t return MSG_HANDLED; case WIDGET_CURSOR: @@ -1946,7 +1989,7 @@ return MSG_HANDLED; case WIDGET_DESTROY: -@@ -1584,7 +1824,7 @@ input_event (Gpm_Event * event, WInput * +@@ -1648,7 +1886,7 @@ input_event (Gpm_Event * event, void *da && should_show_history_button (in)) { do_show_hist (in); } else { @@ -1955,7 +1998,7 @@ if (event->x - in->first_shown - 1 < in->point) in->point = event->x - in->first_shown - 1; if (in->point < 0) -@@ -1642,7 +1882,8 @@ input_new (int y, int x, int color, int +@@ -1705,7 +1943,8 @@ input_new (int y, int x, int color, int in->is_password = 0; strcpy (in->buffer, def_text); @@ -1965,12 +2008,12 @@ return in; } ---- mc-4.6.1/src/util.c.utf8 2005-05-27 16:19:18.000000000 +0200 -+++ mc-4.6.1/src/util.c 2005-09-29 19:13:29.000000000 +0200 -@@ -32,7 +32,11 @@ - #include - #include - #include +--- mc-4.6.1a/src/util.c.utf8 2005-10-04 17:20:10.000000000 +0200 ++++ mc-4.6.1a/src/util.c 2005-10-17 14:34:41.000000000 +0200 +@@ -33,7 +33,11 @@ + #include + #include + #include +#include +#include +#include @@ -1979,7 +2022,7 @@ #include "global.h" #include "profile.h" #include "main.h" /* mc_home */ -@@ -44,6 +48,10 @@ +@@ -45,6 +49,10 @@ #include "charsets.h" #endif @@ -1990,7 +2033,7 @@ static const char app_text [] = "Midnight-Commander"; int easy_patterns = 1; -@@ -77,9 +85,106 @@ is_8bit_printable (unsigned char c) +@@ -78,9 +86,106 @@ is_8bit_printable (unsigned char c) return (c > 31 && c != 127 && c != 155); } @@ -2097,37 +2140,38 @@ c &= 0xff; #ifdef HAVE_CHARSET -@@ -97,7 +202,7 @@ is_printable (int c) +@@ -98,7 +203,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) +-/* Calculates the message dimensions (lines and columns) */ ++/* Calculates the message dimension in columns and lines. */ + void + msglen (const char *text, int *lines, int *columns) { - int max = 0; -@@ -108,8 +213,18 @@ int msglen (const char *text, int *lines - line_len = 0; - (*lines)++; +@@ -111,8 +216,21 @@ msglen (const char *text, int *lines, in + nlines++; + colindex = 0; } else { -- line_len++; -- if (line_len > max) -+#ifdef UTF8 -+ size_t len; -+ wchar_t c; ++#ifndef UTF8 + colindex++; + if (colindex > ncolumns) ++#else /* UTF8 */ ++ 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); -+ line_len += wcsize > 0 ? wcsize-1 : -1; -+ text += len-1; -+ } -+#endif -+ if (++line_len > max) - max = line_len; ++ 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; ++ } ++ if (++colindex > ncolumns) ++#endif /* UTF8 */ + ncolumns = colindex; } } -@@ -201,7 +316,24 @@ name_quote (const char *s, int quote_per +@@ -206,7 +324,24 @@ name_quote (const char *s, int quote_per *d++ = '\\'; break; } @@ -2152,7 +2196,7 @@ } *d = '\0'; return ret; -@@ -222,25 +354,90 @@ const char * +@@ -228,25 +363,90 @@ const char * name_trunc (const char *txt, int trunc_len) { static char x[MC_MAXPATHLEN + MC_MAXPATHLEN]; @@ -2257,7 +2301,7 @@ return x; } -@@ -650,11 +847,61 @@ char *load_file (const char *filename) +@@ -678,11 +878,61 @@ load_file (const char *filename) } char * @@ -2319,7 +2363,7 @@ hintfile_base = concat_dir_and_file (mc_home, filename); lang = guess_message_value (); -@@ -687,7 +934,10 @@ load_mc_home_file (const char *filename, +@@ -715,7 +965,10 @@ load_mc_home_file (const char *filename, else g_free (hintfile); @@ -2331,8 +2375,8 @@ } /* Check strftime() results. Some systems (i.e. Solaris) have different -@@ -695,12 +945,14 @@ short-month-name sizes for different loc - size_t i18n_checktimelength (void) +@@ -724,12 +977,14 @@ size_t + i18n_checktimelength (void) { size_t length, a, b; - char buf [MAX_I18NTIMELENGTH + 1]; @@ -2350,9 +2394,9 @@ length = max (a, b); /* Don't handle big differences. Use standard value (email bug, please) */ -@@ -712,15 +964,12 @@ size_t i18n_checktimelength (void) - - const char *file_date (time_t when) +@@ -742,15 +997,12 @@ i18n_checktimelength (void) + const char * + file_date (time_t when) { - static char timebuf [MAX_I18NTIMELENGTH + 1]; + static char timebuf [4 * MAX_I18NTIMELENGTH + 1]; @@ -2368,7 +2412,7 @@ /* strftime() format string for old dates */ fmtyear = _("%b %e %Y"); /* strftime() format string for recent dates */ -@@ -740,7 +989,7 @@ const char *file_date (time_t when) +@@ -770,7 +1022,7 @@ file_date (time_t when) else fmt = fmttime; @@ -2377,7 +2421,7 @@ return timebuf; } -@@ -863,10 +1112,27 @@ char *strip_ctrl_codes (char *s) +@@ -900,10 +1152,27 @@ strip_ctrl_codes (char *s) r++; continue; } @@ -2406,17 +2450,17 @@ } *w = 0; return s; ---- mc-4.6.1/src/file.c.utf8 2005-05-27 16:19:18.000000000 +0200 -+++ mc-4.6.1/src/file.c 2005-09-29 19:13:29.000000000 +0200 -@@ -165,15 +165,20 @@ static const unsigned char * - do_transform_source (FileOpContext *ctx, const unsigned char *source) +--- mc-4.6.1a/src/file.c.utf8 2005-09-17 13:45:13.000000000 +0200 ++++ mc-4.6.1a/src/file.c 2005-10-17 14:34:41.000000000 +0200 +@@ -164,15 +164,20 @@ static const char * + do_transform_source (FileOpContext *ctx, const char *source) { size_t j, k, l, len; -- unsigned const char *fnsource = x_basename (source); -+ unsigned const char *fnsource = g_strdup (x_basename (source)); +- const char *fnsource = x_basename (source); ++ const char *fnsource = g_strdup (x_basename (source)); int next_reg; enum CaseConvs case_conv = NO_CONV; - static unsigned char fntarget[MC_MAXPATHLEN]; + static char fntarget[MC_MAXPATHLEN]; +#ifdef UTF8 + fix_utf8(fnsource); @@ -2426,11 +2470,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++) { -@@ -217,6 +222,7 @@ do_transform_source (FileOpContext *ctx, +@@ -216,6 +221,7 @@ do_transform_source (FileOpContext *ctx, || ctx->regs.start[next_reg] < 0) { message (1, MSG_ERROR, _(" Invalid target mask ")); transform_error = FILE_ABORT; @@ -2438,7 +2482,7 @@ return NULL; } for (l = (size_t) ctx->regs.start[next_reg]; -@@ -231,6 +237,7 @@ do_transform_source (FileOpContext *ctx, +@@ -230,6 +236,7 @@ do_transform_source (FileOpContext *ctx, } } fntarget[k] = 0; @@ -2446,9 +2490,9 @@ return fntarget; } ---- mc-4.6.1/src/find.c.utf8 2005-05-27 16:19:18.000000000 +0200 -+++ mc-4.6.1/src/find.c 2005-09-29 19:13:29.000000000 +0200 -@@ -205,7 +205,7 @@ find_parameters (char **start_dir, char +--- mc-4.6.1a/src/find.c.utf8 2005-07-07 21:34:56.000000000 +0200 ++++ mc-4.6.1a/src/find.c 2005-10-17 14:34:41.000000000 +0200 +@@ -217,7 +217,7 @@ find_parameters (char **start_dir, char int l1, maxlen = 0; while (i--) { @@ -2457,7 +2501,7 @@ if (l1 > maxlen) maxlen = l1; } -@@ -214,7 +214,7 @@ find_parameters (char **start_dir, char +@@ -226,7 +226,7 @@ find_parameters (char **start_dir, char FIND_X = i; for (i = sizeof (buts) / sizeof (buts[0]), l1 = 0; i--;) { @@ -2466,7 +2510,7 @@ } l1 += 21; if (l1 > FIND_X) -@@ -223,8 +223,8 @@ find_parameters (char **start_dir, char +@@ -235,8 +235,8 @@ find_parameters (char **start_dir, char ilen = FIND_X - 7 - maxlen; /* for the case of very long buttons :) */ istart = FIND_X - 3 - ilen; @@ -2477,7 +2521,7 @@ i18n_flag = 1; case_label = _(case_label); -@@ -813,7 +813,7 @@ setup_gui (void) +@@ -857,7 +857,7 @@ setup_gui (void) if (!i18n_flag) { register int i = sizeof (fbuts) / sizeof (fbuts[0]); while (i--) @@ -2486,8 +2530,17 @@ fbuts[2].len += 2; /* DEFPUSH_BUTTON */ i18n_flag = 1; } ---- mc-4.6.1/src/myslang.h.utf8 2004-10-12 06:32:04.000000000 +0200 -+++ mc-4.6.1/src/myslang.h 2005-09-29 19:13:29.000000000 +0200 +@@ -1028,7 +1028,7 @@ find_file (char *start_dir, char *patter + + if (!next_free) /* first turn i.e clean old list */ + panel_clean_dir (current_panel); +- list->list[next_free].fnamelen = strlen (name); ++ list->list[next_free].fnamelen = mbstrlen (name); + list->list[next_free].fname = name; + list->list[next_free].f.marked = 0; + list->list[next_free].f.link_to_dir = link_to_dir; +--- mc-4.6.1a/src/myslang.h.utf8 2005-09-05 05:22:04.000000000 +0200 ++++ mc-4.6.1a/src/myslang.h 2005-10-17 14:34:41.000000000 +0200 @@ -11,6 +11,10 @@ #endif /* HAVE_SLANG_SLANG_H */ #endif @@ -2499,9 +2552,9 @@ enum { KEY_BACKSPACE = 400, KEY_END, KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT, ---- mc-4.6.1/src/achown.c.utf8 2005-07-23 18:52:02.000000000 +0200 -+++ mc-4.6.1/src/achown.c 2005-09-29 19:13:29.000000000 +0200 -@@ -583,6 +583,12 @@ init_chown_advanced (void) +--- mc-4.6.1a/src/achown.c.utf8 2005-09-05 03:36:58.000000000 +0200 ++++ mc-4.6.1a/src/achown.c 2005-10-17 14:34:41.000000000 +0200 +@@ -584,6 +584,12 @@ init_chown_advanced (void) b_att[2] = button_new (XTRACT (6)); b_user = button_new (XTRACT (5)); b_group = button_new (XTRACT (4)); @@ -2514,20 +2567,20 @@ add_widget (ch_dlg, b_group); add_widget (ch_dlg, b_user); ---- mc-4.6.1/src/dialog.c.utf8 2005-05-27 16:19:18.000000000 +0200 -+++ mc-4.6.1/src/dialog.c 2005-09-29 19:13:29.000000000 +0200 -@@ -162,7 +162,7 @@ common_dialog_repaint (struct Dlg_head * +--- mc-4.6.1a/src/dialog.c.utf8 2005-09-05 05:20:27.000000000 +0200 ++++ mc-4.6.1a/src/dialog.c 2005-10-17 14:34:41.000000000 +0200 +@@ -166,7 +166,7 @@ common_dialog_repaint (struct Dlg_head * if (h->title) { - attrset (HOT_NORMALC); + attrset (DLG_HOT_NORMALC (h)); - dlg_move (h, space, (h->cols - strlen (h->title)) / 2); + dlg_move (h, space, (h->cols - mbstrlen (h->title)) / 2); addstr (h->title); } } ---- mc-4.6.1/src/boxes.c.utf8 2005-05-27 16:19:18.000000000 +0200 -+++ mc-4.6.1/src/boxes.c 2005-09-29 19:13:29.000000000 +0200 -@@ -150,23 +150,23 @@ display_init (int radio_sel, char *init_ +--- mc-4.6.1a/src/boxes.c.utf8 2005-06-14 15:02:31.000000000 +0200 ++++ mc-4.6.1a/src/boxes.c 2005-10-17 14:34:41.000000000 +0200 +@@ -153,23 +153,23 @@ display_init (int radio_sel, char *init_ display_title = _(display_title); for (i = 0; i < LIST_TYPES; i++) { displays[i] = _(displays[i]); @@ -2556,7 +2609,7 @@ if (i > DISPLAY_X) DISPLAY_X = i; -@@ -285,20 +285,20 @@ sort_box (sortfn *sort_fn, int *reverse, +@@ -288,20 +288,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); @@ -2582,7 +2635,7 @@ if (i > l) l = i; -@@ -307,7 +307,7 @@ sort_box (sortfn *sort_fn, int *reverse, +@@ -310,7 +310,7 @@ sort_box (sortfn *sort_fn, int *reverse, if (i > SORT_X) SORT_X = i; @@ -2591,7 +2644,7 @@ if (i > SORT_X) SORT_X = i; -@@ -402,7 +402,7 @@ confirm_box (void) +@@ -405,7 +405,7 @@ confirm_box (void) while (i--) { conf_widgets [i].text = _(conf_widgets [i].text); @@ -2600,7 +2653,7 @@ if (l1 > maxlen) maxlen = l1; } -@@ -417,8 +417,8 @@ confirm_box (void) +@@ -420,8 +420,8 @@ confirm_box (void) * And this for the case when buttons with some space to the right * do not fit within 2/6 */ @@ -2611,7 +2664,7 @@ if (i > l1) l1 = i; -@@ -489,11 +489,11 @@ display_bits_box (void) +@@ -492,11 +492,11 @@ display_bits_box (void) { display_widgets [i].text = _(display_widgets[i].text); display_bits_str [i] = _(display_bits_str [i]); @@ -2625,7 +2678,7 @@ if (l1 > maxlen) maxlen = l1; -@@ -501,8 +501,8 @@ display_bits_box (void) +@@ -504,8 +504,8 @@ display_bits_box (void) display_bits.xlen = (maxlen + 5) * 6 / 4; /* See above confirm_box */ @@ -2636,7 +2689,7 @@ if (i > l1) l1 = i; -@@ -597,7 +597,7 @@ init_disp_bits_box (void) +@@ -600,7 +600,7 @@ init_disp_bits_box (void) cpname = _("&Select"); add_widget (dbits_dlg, @@ -2645,7 +2698,7 @@ NORMAL_BUTTON, cpname, sel_charset_button)); return dbits_dlg; -@@ -803,7 +803,7 @@ cd_dialog (void) +@@ -811,7 +811,7 @@ cd_dialog (void) quick_widgets [1].y_divisions = quick_widgets [0].y_divisions = Quick_input.ylen = 5; @@ -2654,7 +2707,7 @@ quick_widgets [0].relative_x = quick_widgets [1].relative_x + len + 1; -@@ -962,7 +962,7 @@ jobs_cmd (void) +@@ -970,7 +970,7 @@ jobs_cmd (void) { job_buttons [i].name = _(job_buttons [i].name); @@ -2663,7 +2716,7 @@ JOBS_X = max (JOBS_X, startx + len + 3); job_buttons [i].xpos = startx; -@@ -971,7 +971,7 @@ jobs_cmd (void) +@@ -979,7 +979,7 @@ jobs_cmd (void) /* Last button - Ok a.k.a. Cancel :) */ job_buttons [n_buttons - 1].xpos = @@ -2672,7 +2725,7 @@ i18n_flag = 1; } -@@ -1029,7 +1029,7 @@ vfs_smb_get_authinfo (const char *host, +@@ -1037,7 +1037,7 @@ vfs_smb_get_authinfo (const char *host, while (i--) { @@ -2681,7 +2734,7 @@ if (l1 > maxlen) maxlen = l1; } -@@ -1039,7 +1039,7 @@ vfs_smb_get_authinfo (const char *host, +@@ -1047,7 +1047,7 @@ vfs_smb_get_authinfo (const char *host, for (i = sizeof(buts)/sizeof(buts[0]), l1 = 0; i--; ) { @@ -2690,7 +2743,7 @@ } l1 += 15; if (l1 > dialog_x) -@@ -1048,7 +1048,7 @@ vfs_smb_get_authinfo (const char *host, +@@ -1056,7 +1056,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; @@ -2699,9 +2752,9 @@ i18n_flag = 1; } ---- mc-4.6.1/src/learn.c.utf8 2005-05-27 16:19:18.000000000 +0200 -+++ mc-4.6.1/src/learn.c 2005-09-29 19:13:29.000000000 +0200 -@@ -236,7 +236,7 @@ init_learn (void) +--- mc-4.6.1a/src/learn.c.utf8 2005-05-27 05:35:15.000000000 +0200 ++++ mc-4.6.1a/src/learn.c 2005-10-17 14:34:41.000000000 +0200 +@@ -237,7 +237,7 @@ init_learn (void) learn_but[0].x = 78 / 2 + 4; learn_but[1].text = _(learn_but[1].text); @@ -2710,11 +2763,11 @@ learn_title = _(learn_title); i18n_flag = 1; ---- mc-4.6.1/edit/edit-widget.h.utf8 2003-10-29 09:54:47.000000000 +0100 -+++ mc-4.6.1/edit/edit-widget.h 2005-09-29 19:13:29.000000000 +0200 -@@ -24,6 +24,11 @@ struct syntax_rule { - unsigned char border; - }; +--- mc-4.6.1a/edit/edit-widget.h.utf8 2005-08-15 22:34:26.000000000 +0200 ++++ mc-4.6.1a/edit/edit-widget.h 2005-10-17 14:34:41.000000000 +0200 +@@ -30,6 +30,11 @@ typedef struct edit_key_map_type { + long command; + } edit_key_map_type; +struct action { + mc_wchar_t ch; @@ -2724,7 +2777,7 @@ struct WEdit { Widget widget; -@@ -36,8 +41,17 @@ struct WEdit { +@@ -42,8 +47,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 */ @@ -2742,7 +2795,7 @@ /* search variables */ long search_start; /* First character to start searching from */ -@@ -81,7 +95,7 @@ struct WEdit { +@@ -87,7 +101,7 @@ struct WEdit { /* undo stack and pointers */ unsigned long stack_pointer; @@ -2751,9 +2804,9 @@ unsigned long stack_size; unsigned long stack_size_mask; unsigned long stack_bottom; ---- mc-4.6.1/edit/editkeys.c.utf8 2005-05-27 16:19:18.000000000 +0200 -+++ mc-4.6.1/edit/editkeys.c 2005-09-29 19:13:29.000000000 +0200 -@@ -162,10 +162,10 @@ static long const common_key_map[] = { +--- mc-4.6.1a/edit/editkeys.c.utf8 2005-08-10 18:47:44.000000000 +0200 ++++ mc-4.6.1a/edit/editkeys.c 2005-10-17 14:34:41.000000000 +0200 +@@ -181,10 +181,10 @@ static const edit_key_map_type common_ke * 'command' is one of the editor commands from editcmddef.h. */ int @@ -2764,11 +2817,11 @@ - int char_for_insertion = -1; + mc_wint_t char_for_insertion = -1; int i = 0; - static const long *key_map; - -@@ -242,9 +242,30 @@ edit_translate_key (WEdit *edit, long x_ + int extmod = 0; + const edit_key_map_type *key_map = NULL; +@@ -241,9 +241,30 @@ edit_translate_key (WEdit *edit, long x_ /* an ordinary insertable character */ - if (x_key < 256) { + if (x_key < 256 && !extmod) { int c = convert_from_input_c (x_key); - +#ifdef UTF8 @@ -2798,7 +2851,7 @@ goto fin; } } -@@ -285,7 +306,7 @@ edit_translate_key (WEdit *edit, long x_ +@@ -282,7 +303,7 @@ edit_translate_key (WEdit *edit, long x_ *cmd = command; *ch = char_for_insertion; @@ -2807,9 +2860,9 @@ /* unchanged, key has no function here */ return 0; } ---- mc-4.6.1/edit/editwidget.c.utf8 2005-05-27 16:19:18.000000000 +0200 -+++ mc-4.6.1/edit/editwidget.c 2005-09-29 19:13:29.000000000 +0200 -@@ -337,7 +337,8 @@ edit_callback (WEdit *e, widget_msg_t ms +--- mc-4.6.1a/edit/editwidget.c.utf8 2005-09-07 10:54:12.000000000 +0200 ++++ mc-4.6.1a/edit/editwidget.c 2005-10-17 14:34:41.000000000 +0200 +@@ -344,7 +344,8 @@ edit_callback (Widget *w, widget_msg_t m case WIDGET_KEY: { @@ -2817,11 +2870,11 @@ + int cmd; + mc_wint_t ch; - /* first check alt-f, alt-e, alt-s, etc for drop menus */ - if (edit_drop_hotkey_menu (e, parm)) ---- mc-4.6.1/edit/editcmd.c.utf8 2005-05-27 16:19:18.000000000 +0200 -+++ mc-4.6.1/edit/editcmd.c 2005-09-29 19:13:29.000000000 +0200 -@@ -46,7 +46,7 @@ + /* The user may override the access-keys for the menu bar. */ + if (edit_translate_key (e, parm, &cmd, &ch)) { +--- mc-4.6.1a/edit/editcmd.c.utf8 2005-10-04 23:15:06.000000000 +0200 ++++ mc-4.6.1a/edit/editcmd.c 2005-10-17 14:36:01.000000000 +0200 +@@ -61,7 +61,7 @@ #define edit_get_save_file(f,h) input_expand_dialog (h, _(" Enter file name: "), f) struct selection { @@ -2830,7 +2883,7 @@ int len; }; -@@ -69,12 +69,16 @@ int edit_confirm_save = 1; +@@ -84,12 +84,16 @@ int edit_confirm_save = 1; #define MAX_REPL_LEN 1024 static int edit_save_cmd (WEdit *edit); @@ -2848,8 +2901,8 @@ +#endif } - static const char *strcasechr (const unsigned char *s, int c) -@@ -108,11 +112,11 @@ static void *memmove (void *dest, const + static const char * +@@ -124,11 +128,11 @@ static void *memmove (void *dest, const #endif /* !HAVE_MEMMOVE */ /* #define itoa MY_itoa <---- this line is now in edit.h */ @@ -2864,7 +2917,7 @@ int j = i; *s-- = 0; do { -@@ -196,6 +200,48 @@ void edit_refresh_cmd (WEdit * edit) +@@ -213,6 +217,48 @@ void edit_refresh_cmd (WEdit * edit) doupdate(); } @@ -2913,7 +2966,7 @@ /* If 0 (quick save) then a) create/truncate file, b) save to ; if 1 (safe save) then a) save to , -@@ -303,32 +349,48 @@ edit_save_file (WEdit *edit, const char +@@ -320,32 +366,48 @@ edit_save_file (WEdit *edit, const char buf = 0; filelen = edit->last_byte; while (buf <= (edit->curs1 >> S_EDIT_BUF_SIZE) - 1) { @@ -2965,7 +3018,7 @@ EDIT_BUF_SIZE) != EDIT_BUF_SIZE) { filelen = -1; break; -@@ -643,13 +705,21 @@ edit_delete_macro (WEdit * edit, int k) +@@ -658,13 +720,21 @@ edit_delete_macro (WEdit * edit, int k) if (!n || n == EOF) break; n = 0; @@ -2987,7 +3040,7 @@ fprintf (g, ";\n"); } } -@@ -685,7 +755,11 @@ int edit_save_macro_cmd (WEdit * edit, s +@@ -697,7 +767,11 @@ int edit_save_macro_cmd (WEdit * edit, s if (f) { fprintf (f, ("key '%d 0': "), s); for (i = 0; i < n; i++) @@ -2999,7 +3052,7 @@ fprintf (f, ";\n"); fclose (f); if (saved_macros_loaded) { -@@ -734,10 +808,18 @@ int edit_load_macro_cmd (WEdit * edit, s +@@ -747,10 +821,18 @@ int edit_load_macro_cmd (WEdit * edit, s saved_macro[i++] = s; if (!found) { *n = 0; @@ -3018,7 +3071,7 @@ } fscanf (f, ";\n"); if (s == k) -@@ -886,7 +968,7 @@ int eval_marks (WEdit * edit, long *star +@@ -897,7 +979,7 @@ int eval_marks (WEdit * edit, long *star #define space_width 1 static void @@ -3027,7 +3080,7 @@ { long cursor; int i, col; -@@ -934,7 +1016,7 @@ edit_block_copy_cmd (WEdit *edit) +@@ -945,7 +1027,7 @@ edit_block_copy_cmd (WEdit *edit) { long start_mark, end_mark, current = edit->curs1; int size, x; @@ -3036,7 +3089,7 @@ edit_update_curs_col (edit); x = edit->curs_col; -@@ -979,7 +1061,7 @@ edit_block_move_cmd (WEdit *edit) +@@ -990,7 +1072,7 @@ edit_block_move_cmd (WEdit *edit) { long count; long current; @@ -3045,7 +3098,7 @@ long start_mark, end_mark; int deleted = 0; int x = 0; -@@ -1040,7 +1122,7 @@ edit_block_move_cmd (WEdit *edit) +@@ -1051,7 +1133,7 @@ edit_block_move_cmd (WEdit *edit) edit_push_action (edit, COLUMN_ON); column_highlighting = 0; } else { @@ -3054,19 +3107,19 @@ edit_cursor_move (edit, start_mark - edit->curs1); edit_scroll_screen_over_cursor (edit); count = start_mark; -@@ -1371,7 +1453,11 @@ static long sargs[NUM_REPL_ARGS][256 / s +@@ -1389,7 +1471,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 len, int match_type, + string_regexp_search (char *pattern, char *string, 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; -@@ -1380,6 +1466,11 @@ string_regexp_search (char *pattern, cha +@@ -1398,6 +1484,11 @@ string_regexp_search (char *pattern, cha regmatch_t *pmatch; static regmatch_t s[1]; @@ -3078,7 +3131,7 @@ pmatch = (regmatch_t *) d; if (!pmatch) pmatch = s; -@@ -1399,13 +1490,51 @@ string_regexp_search (char *pattern, cha +@@ -1417,13 +1508,51 @@ string_regexp_search (char *pattern, cha old_type = match_type; old_icase = icase; } @@ -3130,7 +3183,7 @@ *found_len = pmatch[0].rm_eo - pmatch[0].rm_so; return (pmatch[0].rm_so); } -@@ -1413,13 +1542,29 @@ string_regexp_search (char *pattern, cha +@@ -1431,13 +1560,29 @@ string_regexp_search (char *pattern, cha /* thanks to Liviu Daia for getting this (and the above) routines to work properly - paul */ @@ -3161,7 +3214,7 @@ int n = 0; for (p = 0; p < l; p++) /* count conversions... */ -@@ -1428,19 +1573,22 @@ edit_find_string (long start, unsigned c +@@ -1446,19 +1591,22 @@ edit_find_string (long start, unsigned c n++; if (replace_scanf || replace_regexp) { @@ -3191,7 +3244,7 @@ if (replace_case) { for (p = start; p < last_byte && p < start + MAX_REPL_LEN; p++) buf[p - start] = (*get_byte) (data, p); -@@ -1454,20 +1602,36 @@ edit_find_string (long start, unsigned c +@@ -1472,20 +1620,36 @@ edit_find_string (long start, unsigned c } buf[(q = p - start)] = 0; @@ -3229,7 +3282,7 @@ if (q + start < last_byte) { if (replace_case) { buf[q] = (*get_byte) (data, q + start); -@@ -1481,7 +1645,11 @@ edit_find_string (long start, unsigned c +@@ -1499,7 +1663,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... */ @@ -3241,25 +3294,25 @@ buf = mbuf; } q--; -@@ -1507,10 +1675,17 @@ edit_find_string (long start, unsigned c +@@ -1525,10 +1693,16 @@ edit_find_string (long start, unsigned c buf = mbuf; while (q) { +#ifndef UTF8 - found_start = string_regexp_search ((char *) exp, (char *) buf, q, match_normal, match_bol, !replace_case, len, d); + found_start = string_regexp_search ((char *) exp, (char *) buf, 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 */ -@@ -1521,15 +1696,27 @@ edit_find_string (long start, unsigned c +@@ -1539,15 +1713,27 @@ edit_find_string (long start, unsigned c match_bol = 0; continue; } @@ -3289,35 +3342,35 @@ memmove (mbuf, buf, q); p = start + q; move_win = 1; -@@ -1539,36 +1726,59 @@ edit_find_string (long start, unsigned c +@@ -1557,36 +1743,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; + } @@ -3328,15 +3381,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; + } @@ -3344,7 +3397,7 @@ - if (once_only) + if (once_only) { +#ifdef UTF8 -+ g_free (exp_backup); ++ g_free (exp_backup); +#endif /* UTF8 */ return -2; + } @@ -3357,7 +3410,7 @@ return -2; } -@@ -1582,9 +1792,14 @@ edit_find_forwards (long search_start, u +@@ -1600,9 +1809,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) { @@ -3372,7 +3425,7 @@ return p; if (once_only) return -2; -@@ -1616,6 +1831,7 @@ edit_find (long search_start, unsigned c +@@ -1634,6 +1848,7 @@ edit_find (long search_start, unsigned c #define is_digit(x) ((x) >= '0' && (x) <= '9') @@ -3380,7 +3433,7 @@ #define snprint(v) { \ *p1++ = *p++; \ *p1 = '\0'; \ -@@ -1623,33 +1839,48 @@ edit_find (long search_start, unsigned c +@@ -1641,33 +1856,48 @@ edit_find (long search_start, unsigned c if (n >= (size_t) (e - s)) goto nospc; \ s += n; \ } @@ -3437,7 +3490,7 @@ s += n; q = p; p1 = q1; -@@ -1677,45 +1908,78 @@ static int snprintf_p (char *str, size_t +@@ -1695,45 +1925,78 @@ static int snprintf_p (char *str, size_t *p1++ = *p++; if (*p == '*') { p++; @@ -3526,7 +3579,7 @@ snprint (*va_arg (ap, long *)); } else if (*p == 'p') { snprint (*va_arg (ap, void **)); -@@ -1724,10 +1988,17 @@ static int snprintf_p (char *str, size_t +@@ -1742,10 +2005,17 @@ static int snprintf_p (char *str, size_t q = p; } va_end (ap); @@ -3544,12 +3597,12 @@ return s + n - str; nospc: va_end (ap); -@@ -1902,8 +2173,11 @@ edit_replace_cmd (WEdit *edit, int again +@@ -1924,8 +2194,11 @@ edit_replace_cmd (WEdit *edit, int again } } if (replace_yes) { /* delete then insert new */ +#ifdef UTF8 -+ mc_wchar_t *winput2 = mbstr_to_wchar(exp2); ++ mc_wchar_t *winput2 = mbstr_to_wchar(input2); +#endif /* UTF8 */ if (replace_scanf || replace_regexp) { - char repl_str[MAX_REPL_LEN + 2]; @@ -3557,7 +3610,7 @@ int ret = 0; /* we need to fill in sargs just like with scanf */ -@@ -1912,17 +2186,25 @@ edit_replace_cmd (WEdit *edit, int again +@@ -1934,17 +2207,25 @@ edit_replace_cmd (WEdit *edit, int again for (k = 1; k < NUM_REPL_ARGS && pmatch[k].rm_eo >= 0; k++) { @@ -3584,15 +3637,16 @@ edit-> search_start - -@@ -1939,13 +2221,22 @@ edit_replace_cmd (WEdit *edit, int again - sargs[k - 1][0] = 0; +@@ -1962,14 +2243,23 @@ edit_replace_cmd (WEdit *edit, int again } if (!ret) + ret = +#ifndef UTF8 - ret = snprintf_p (repl_str, MAX_REPL_LEN + 2, exp2, PRINTF_ARGS); + snprintf_p (repl_str, MAX_REPL_LEN + 2, input2, +#else /* UTF8 */ -+ ret = snprintf_p (repl_str, MAX_REPL_LEN + 2, winput2, PRINTF_ARGS); ++ snprintf_p (repl_str, MAX_REPL_LEN + 2, winput2, +#endif /* UTF8 */ + PRINTF_ARGS); if (ret >= 0) { times_replaced++; while (i--) @@ -3601,32 +3655,32 @@ while (repl_str[++i]) edit_insert (edit, repl_str[i]); +#else /* UTF8 */ -+ while (winput2[++i]) -+ edit_insert (edit, winput2[i]); ++ 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 + ret == +@@ -1983,10 +2273,18 @@ edit_replace_cmd (WEdit *edit, int again times_replaced++; while (i--) edit_delete (edit); +#ifndef UTF8 - while (exp2[++i]) - edit_insert (edit, exp2[i]); + while (input2[++i]) + edit_insert (edit, input2[i]); +#else /* UTF8 */ -+ while (winput2[++i]) -+ edit_insert (edit, winput2[i]); -+#endif ++ while (winput2[++i]) ++ edit_insert (edit, winput2[i]); ++#endif /* UTF8 */ } 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) { -@@ -2132,16 +2431,17 @@ edit_ok_to_exit (WEdit *edit) +@@ -2161,16 +2459,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 */ @@ -3648,7 +3702,7 @@ x = edit_move_forward3 (edit, edit_bol (edit, start), 0, start); c = edit_get_byte (edit, start); -@@ -2174,11 +2474,15 @@ edit_save_block (WEdit * edit, const cha +@@ -2203,11 +2502,15 @@ edit_save_block (WEdit * edit, const cha return 0; if (column_highlighting) { @@ -3665,7 +3719,7 @@ if (r < 0) break; p += r; -@@ -2186,15 +2490,19 @@ edit_save_block (WEdit * edit, const cha +@@ -2215,15 +2518,19 @@ edit_save_block (WEdit * edit, const cha } g_free (block); } else { @@ -3687,7 +3741,7 @@ start = end; } g_free (buf); -@@ -2531,17 +2839,20 @@ edit_block_process_cmd (WEdit *edit, con +@@ -2561,17 +2868,20 @@ edit_block_process_cmd (WEdit *edit, con /* prints at the cursor */ /* returns the number of chars printed */ @@ -3710,14 +3764,14 @@ static void pipe_mail (WEdit *edit, char *to, char *subject, char *cc) { FILE *p = 0; -@@ -2635,15 +2946,20 @@ void edit_mail_dialog (WEdit * edit) +@@ -2665,15 +2975,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; @@ -3730,12 +3784,12 @@ +#else /* UTF8 */ + if (iswspace (c) || !(iswalnum (c) || c == '_')) +#endif /* UTF8 */ - return 0; + return 0; /* search start of word to be completed */ -@@ -2653,11 +2969,19 @@ static int edit_find_word_start (WEdit * +@@ -2683,11 +2998,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); @@ -3754,34 +3808,35 @@ return 0; *word_start = edit->curs1 - (i - 1); /* start found */ -@@ -2690,7 +3014,7 @@ edit_collect_completions (WEdit *edit, l +@@ -2720,7 +3043,7 @@ edit_collect_completions (WEdit *edit, l int *num) { int len, max_len = 0, i, skip; -- char *bufpos; +- unsigned char *bufpos; + mc_wchar_t *bufpos; /* collect max MAX_WORD_COMPLETIONS completions */ while (*num < MAX_WORD_COMPLETIONS) { -@@ -2711,9 +3035,16 @@ edit_collect_completions (WEdit *edit, l +@@ -2739,11 +3062,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 - (&compl[i].text[word_len], &bufpos[word_len], -- max (len, compl[i].len) - word_len) == 0) { -+ max (len, + ((char *) &compl[i].text[word_len], + (char *) &bufpos[word_len], max (len, +- compl[i].len) - +- word_len) == 0) { +#else /* UTF8 */ -+ if (wcsncmp -+ ((wchar_t *) &compl[i].text[word_len], -+ (wchar_t *) &bufpos[word_len], max (len, ++ if (wcsncmp ++ ((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; break; /* skip it, already added */ } -@@ -2721,7 +3052,7 @@ edit_collect_completions (WEdit *edit, l +@@ -2751,7 +3079,7 @@ edit_collect_completions (WEdit *edit, l if (skip) continue; @@ -3790,7 +3845,7 @@ compl[*num].len = len; for (i = 0; i < len; i++) compl[*num].text[i] = *(bufpos + i); -@@ -2735,6 +3066,18 @@ edit_collect_completions (WEdit *edit, l +@@ -2765,6 +3093,18 @@ edit_collect_completions (WEdit *edit, l return max_len; } @@ -3809,35 +3864,36 @@ /* let the user select its preferred completion */ static void -@@ -2747,6 +3090,10 @@ edit_completion_dialog (WEdit *edit, int +@@ -2777,6 +3117,9 @@ edit_completion_dialog (WEdit * edit, in 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; -@@ -2782,8 +3129,16 @@ edit_completion_dialog (WEdit *edit, int +@@ -2812,9 +3155,18 @@ edit_completion_dialog (WEdit * edit, in 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, compl[i].text, NULL); + listbox_add_item (compl_list, LISTBOX_APPEND_AT_END, 0, + (char *) compl[i].text, NULL); +#else /* UTF8 */ + for (i = 0; i < num_compl; i++) { -+ mbtext = wchar_to_mbstr(compl[i].text); -+ listbox_add_item (compl_list, 0, 0, mbtext, NULL); -+ g_free(mbtext); ++ mbtext = wchar_to_mbstr(compl[i].text); ++ listbox_add_item (compl_list, LISTBOX_APPEND_AT_END, 0, ++ mbtext, NULL); ++ g_free(mbtext); + } +#endif /* UTF8 */ /* pop up the dialog */ run_dlg (compl_dlg); -@@ -2791,9 +3146,17 @@ edit_completion_dialog (WEdit *edit, int +@@ -2822,9 +3174,17 @@ edit_completion_dialog (WEdit * edit, in /* apply the choosen completion */ if (compl_dlg->ret_value == B_ENTER) { listbox_get_current (compl_list, &curr, NULL); @@ -3856,11 +3912,11 @@ } /* destroy dialog before return */ -@@ -2810,8 +3173,9 @@ edit_complete_word_cmd (WEdit *edit) +@@ -2841,8 +3201,9 @@ edit_complete_word_cmd (WEdit *edit) { int word_len = 0, i, num_compl = 0, max_len; long word_start = 0; -- char *bufpos; +- unsigned char *bufpos; - char *match_expr; + mc_wchar_t *bufpos; + mc_wchar_t *match_expr; @@ -3868,7 +3924,7 @@ struct selection compl[MAX_WORD_COMPLETIONS]; /* completions */ /* don't want to disturb another search */ -@@ -2828,16 +3192,32 @@ edit_complete_word_cmd (WEdit *edit) +@@ -2859,16 +3220,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]; @@ -3901,9 +3957,9 @@ if (num_compl > 0) { /* insert completed word if there is only one match */ ---- mc-4.6.1/edit/wordproc.c.utf8 2005-05-27 16:19:18.000000000 +0200 -+++ mc-4.6.1/edit/wordproc.c 2005-09-29 19:13:29.000000000 +0200 -@@ -24,7 +24,12 @@ +--- mc-4.6.1a/edit/wordproc.c.utf8 2005-05-27 05:35:12.000000000 +0200 ++++ mc-4.6.1a/edit/wordproc.c 2005-10-17 14:34:41.000000000 +0200 +@@ -40,7 +40,12 @@ #define tab_width option_tab_spacing @@ -3916,7 +3972,7 @@ #define FONT_MEAN_WIDTH 1 static long -@@ -41,14 +46,21 @@ line_start (WEdit *edit, long line) +@@ -57,14 +62,21 @@ line_start (WEdit *edit, long line) p = edit_move_forward (edit, p, line - l, 0); p = edit_bol (edit, p); @@ -3939,7 +3995,7 @@ c = edit_get_byte (edit, p); if (c == '.') { /* `...' is acceptable */ if (edit_get_byte (edit, p + 1) == '.') -@@ -62,7 +74,13 @@ static int bad_line_start (WEdit * edit, +@@ -78,7 +90,13 @@ static int bad_line_start (WEdit * edit, return 0; /* `---' is acceptable */ return 1; } @@ -3953,7 +4009,7 @@ return 1; return 0; } -@@ -115,33 +133,37 @@ end_paragraph (WEdit *edit, int force) +@@ -131,33 +149,37 @@ end_paragraph (WEdit *edit, int force) i - edit->curs_line, 0)); } @@ -3999,7 +4055,7 @@ while (size--) { *p = *p == '\n' ? ' ' : *p; p++; -@@ -158,7 +180,7 @@ static inline int next_tab_pos (int x) +@@ -174,7 +196,7 @@ static inline int next_tab_pos (int x) { return x += tab_width - x % tab_width; } @@ -4008,25 +4064,25 @@ { int x = 0, c, xn = 0; for (;;) { -@@ -182,7 +204,7 @@ static int line_pixel_length (unsigned c +@@ -198,7 +220,7 @@ static int line_pixel_length (unsigned c } - /* 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) + static int +-next_word_start (unsigned char *t, int q) ++next_word_start (mc_wchar_t *t, int q) { int i; for (i = q;; i++) { -@@ -203,7 +225,7 @@ static int next_word_start (unsigned cha - } +@@ -220,7 +242,7 @@ next_word_start (unsigned char *t, int q /* find the start of a word */ --static int word_start (unsigned char *t, int q, int size) -+static int word_start (mc_wchar_t *t, int q, int size) + static int +-word_start (unsigned char *t, int q) ++word_start (mc_wchar_t *t, int q) { int i = q; if (t[q] == ' ' || t[q] == '\t') -@@ -222,7 +244,7 @@ static int word_start (unsigned char *t, +@@ -239,7 +261,7 @@ word_start (unsigned char *t, int q) } /* replaces ' ' with '\n' to properly format a paragraph */ @@ -4035,7 +4091,7 @@ { int q = 0, ww; strip_newlines (t, size); -@@ -250,7 +272,7 @@ static void format_this (unsigned char * +@@ -267,7 +289,7 @@ static void format_this (unsigned char * } } @@ -4044,12 +4100,12 @@ { edit_cursor_move (edit, q - edit->curs1); edit_delete (edit); -@@ -258,18 +280,27 @@ static void replace_at (WEdit * edit, lo - } +@@ -276,18 +298,27 @@ static void replace_at (WEdit * edit, lo /* replaces a block of text */ --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) + 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) { long cursor; - int i, c = 0; @@ -4060,7 +4116,7 @@ +#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++) { @@ -4069,12 +4125,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; -@@ -281,7 +312,11 @@ static void put_paragraph (WEdit * edit, +@@ -299,7 +330,11 @@ put_paragraph (WEdit * edit, unsigned ch p = edit->curs1; } else if (c == '\n') { edit_cursor_move (edit, p - edit->curs1); @@ -4086,7 +4142,7 @@ edit_delete (edit); if (cursor > edit->curs1) cursor--; -@@ -314,7 +349,7 @@ format_paragraph (WEdit *edit, int force +@@ -332,7 +367,7 @@ format_paragraph (WEdit *edit, int force { long p, q; int size; @@ -4095,7 +4151,7 @@ int indent = 0; if (option_word_wrap_line_length < 2) return; -@@ -324,17 +359,25 @@ format_paragraph (WEdit *edit, int force +@@ -342,17 +377,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); @@ -4122,11 +4178,11 @@ g_free (t); return; } ---- mc-4.6.1/edit/edit.h.utf8 2005-05-27 16:19:18.000000000 +0200 -+++ mc-4.6.1/edit/edit.h 2005-09-29 19:13:29.000000000 +0200 -@@ -39,6 +39,27 @@ +--- mc-4.6.1a/edit/edit.h.utf8 2005-09-07 10:54:12.000000000 +0200 ++++ mc-4.6.1a/edit/edit.h 2005-10-17 14:34:41.000000000 +0200 +@@ -25,6 +25,27 @@ - #include "../src/global.h" + #include +#include "src/tty.h" + @@ -4151,17 +4207,17 @@ + #define N_menus 5 - #define SEARCH_DIALOG_OPTION_NO_SCANF 1 -@@ -99,6 +120,8 @@ + #define SEARCH_DIALOG_OPTION_NO_SCANF (1 << 0) +@@ -86,6 +107,8 @@ #define START_STACK_SIZE 32 /* Some codes that may be pushed onto or returned from the undo stack */ -+#define CHAR_INSERT 65 ++#define CHAR_INSERT 65 +#define CHAR_INSERT_AHEAD 66 - #define CURS_LEFT 601 - #define CURS_RIGHT 602 - #define DELCHAR 603 -@@ -118,7 +141,7 @@ + #define CURS_LEFT 601 + #define CURS_RIGHT 602 + #define DELCHAR 603 +@@ -105,7 +128,7 @@ struct macro { short command; @@ -4170,36 +4226,21 @@ }; struct WEdit; -@@ -132,26 +155,8 @@ void edit_done_menu (void); +@@ -120,8 +143,12 @@ void edit_reload_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); ++#ifndef UTF8 + int edit_get_byte (WEdit * edit, long byte_index); ++#else /* UTF8 */ +mc_wchar_t edit_get_byte (WEdit * edit, long byte_index); ++#endif /* UTF8 */ 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); -@@ -176,11 +181,11 @@ int edit_block_delete_cmd (WEdit * edit) +@@ -146,11 +173,11 @@ int edit_block_delete_cmd (WEdit * edit) void edit_delete_line (WEdit * edit); int edit_delete (WEdit * edit); @@ -4213,7 +4254,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); -@@ -212,7 +217,7 @@ void edit_goto_cmd (WEdit * edit); +@@ -181,7 +208,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, @@ -4222,7 +4263,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); -@@ -256,7 +261,7 @@ void edit_mail_dialog (WEdit *edit); +@@ -231,7 +258,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 */ @@ -4231,9 +4272,9 @@ #define get_sys_error(s) (s) ---- mc-4.6.1/edit/editdraw.c.utf8 2005-05-27 16:19:18.000000000 +0200 -+++ mc-4.6.1/edit/editdraw.c 2005-09-29 19:13:29.000000000 +0200 -@@ -56,11 +56,16 @@ static void status_string (WEdit * edit, +--- mc-4.6.1a/edit/editdraw.c.utf8 2005-09-05 04:14:29.000000000 +0200 ++++ mc-4.6.1a/edit/editdraw.c 2005-10-17 14:34:41.000000000 +0200 +@@ -69,11 +69,16 @@ static void status_string (WEdit * edit, * as decimal and as hex. */ if (edit->curs1 < edit->last_byte) { @@ -4253,7 +4294,7 @@ } else { strcpy (byte_str, ""); } -@@ -183,11 +188,16 @@ void edit_scroll_screen_over_cursor (WEd +@@ -205,11 +210,16 @@ void edit_scroll_screen_over_cursor (WEd #define lowlevel_set_color(x) attrset(MY_COLOR_PAIR(color)) #endif @@ -4272,7 +4313,7 @@ int x = start_col_real + EDIT_TEXT_HORIZONTAL_OFFSET; int x1 = start_col + EDIT_TEXT_HORIZONTAL_OFFSET; -@@ -201,9 +211,9 @@ print_to_widget (WEdit *edit, long row, +@@ -223,9 +233,9 @@ print_to_widget (WEdit *edit, long row, edit_move (x1 + FONT_OFFSET_X, y + FONT_OFFSET_Y); p = line; @@ -4284,7 +4325,7 @@ int color; if (cols_to_skip) { -@@ -212,9 +222,9 @@ print_to_widget (WEdit *edit, long row, +@@ -234,9 +244,9 @@ print_to_widget (WEdit *edit, long row, continue; } @@ -4297,7 +4338,7 @@ if (style & MOD_ABNORMAL) { /* Non-printable - use black background */ -@@ -228,8 +238,11 @@ print_to_widget (WEdit *edit, long row, +@@ -250,8 +260,11 @@ print_to_widget (WEdit *edit, long row, } else { lowlevel_set_color (color); } @@ -4310,7 +4351,7 @@ p++; } } -@@ -239,11 +252,11 @@ static void +@@ -261,11 +274,11 @@ static void edit_draw_this_line (WEdit *edit, long b, long row, long start_col, long end_col) { @@ -4325,7 +4366,7 @@ int color; int i, book_mark = -1; -@@ -265,66 +278,96 @@ edit_draw_this_line (WEdit *edit, long b +@@ -287,66 +300,96 @@ edit_draw_this_line (WEdit *edit, long b if (row <= edit->total_lines - edit->start_line) { while (col <= end_col - edit->start_col) { @@ -4442,7 +4483,7 @@ } col++; break; -@@ -334,7 +377,7 @@ edit_draw_this_line (WEdit *edit, long b +@@ -356,7 +399,7 @@ edit_draw_this_line (WEdit *edit, long b } else { start_col_real = start_col = 0; } @@ -4451,18 +4492,18 @@ print_to_widget (edit, row, start_col, start_col_real, end_col, line); } ---- mc-4.6.1/edit/edit.c.utf8 2005-05-27 16:19:18.000000000 +0200 -+++ mc-4.6.1/edit/edit.c 2005-09-29 19:13:29.000000000 +0200 -@@ -93,7 +93,7 @@ static void user_menu (WEdit *edit); - - #ifndef NO_INLINE_GETBYTE +--- mc-4.6.1a/edit/edit.c.utf8 2005-09-07 10:54:11.000000000 +0200 ++++ mc-4.6.1a/edit/edit.c 2005-10-17 14:34:41.000000000 +0200 +@@ -103,7 +103,7 @@ char *option_backup_ext = NULL; + static void edit_move_to_prev_col (WEdit *edit, long p); + static void user_menu (WEdit *edit); -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) -@@ -125,7 +125,7 @@ edit_init_buffers (WEdit *edit) +@@ -132,7 +132,7 @@ edit_init_buffers (WEdit *edit) edit->curs1 = 0; edit->curs2 = 0; @@ -4471,7 +4512,7 @@ } /* -@@ -152,7 +152,7 @@ edit_load_file_fast (WEdit *edit, const +@@ -157,7 +157,7 @@ edit_load_file_fast (WEdit *edit, const } if (!edit->buffers2[buf2]) @@ -4480,7 +4521,7 @@ mc_read (file, (char *) edit->buffers2[buf2] + EDIT_BUF_SIZE - -@@ -162,7 +162,7 @@ edit_load_file_fast (WEdit *edit, const +@@ -167,7 +167,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]) @@ -4489,7 +4530,7 @@ mc_read (file, (char *) edit->buffers2[buf], EDIT_BUF_SIZE); } -@@ -242,9 +242,44 @@ edit_insert_stream (WEdit * edit, FILE * +@@ -240,9 +240,44 @@ edit_insert_stream (WEdit * edit, FILE * { int c; long i = 0; @@ -4535,7 +4576,7 @@ } return i; } -@@ -252,9 +287,32 @@ edit_insert_stream (WEdit * edit, FILE * +@@ -250,9 +285,32 @@ edit_insert_stream (WEdit * edit, FILE * long edit_write_stream (WEdit * edit, FILE * f) { long i; @@ -4568,7 +4609,7 @@ return i; } -@@ -294,12 +352,46 @@ edit_insert_file (WEdit *edit, const cha +@@ -291,12 +349,46 @@ edit_insert_file (WEdit *edit, const cha int i, file, blocklen; long current = edit->curs1; unsigned char *buf; @@ -4615,7 +4656,7 @@ } edit_cursor_move (edit, current - edit->curs1); g_free (buf); -@@ -393,7 +485,11 @@ check_file_access (WEdit *edit, const ch +@@ -386,7 +478,11 @@ cleanup: static int edit_load_file (WEdit *edit) { @@ -4627,7 +4668,15 @@ /* Cannot do fast load if a filter is used */ if (edit_find_filter (edit->filename) >= 0) -@@ -540,7 +636,7 @@ edit_init (WEdit *edit, int lines, int c +@@ -452,6 +548,7 @@ edit_load_position (WEdit *edit) + edit->prev_col = column; + edit_move_to_prev_col (edit, edit_bol (edit, edit->curs1)); + edit_move_display (edit, line - (edit->num_widget_lines / 2)); ++ edit->charpoint = 0; + } + + /* Save cursor position in the file */ +@@ -534,7 +631,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; @@ -4636,16 +4685,7 @@ if (edit_load_file (edit)) { /* edit_load_file already gives an error message */ if (to_free) -@@ -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); - } -- -+ edit->charpoint = 0; - return edit; - } - -@@ -693,13 +789,23 @@ void edit_push_action (WEdit * edit, lon +@@ -689,13 +786,23 @@ void edit_push_action (WEdit * edit, lon { unsigned long sp = edit->stack_pointer; unsigned long spm1; @@ -4671,7 +4711,7 @@ if (t) { edit->undo_stack = t; edit->stack_size <<= 1; -@@ -714,7 +820,7 @@ void edit_push_action (WEdit * edit, lon +@@ -710,7 +817,7 @@ void edit_push_action (WEdit * edit, lon #ifdef FAST_MOVE_CURSOR if (c == CURS_LEFT_LOTS || c == CURS_RIGHT_LOTS) { va_list ap; @@ -4680,7 +4720,7 @@ edit->stack_pointer = (edit->stack_pointer + 1) & edit->stack_size_mask; va_start (ap, c); c = -(va_arg (ap, int)); -@@ -725,12 +831,14 @@ void edit_push_action (WEdit * edit, lon +@@ -721,12 +828,14 @@ void edit_push_action (WEdit * edit, lon && spm1 != edit->stack_bottom && ((sp - 2) & edit->stack_size_mask) != edit->stack_bottom) { int d; @@ -4700,7 +4740,7 @@ return; } } -@@ -738,19 +846,20 @@ void edit_push_action (WEdit * edit, lon +@@ -734,19 +843,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 */ @@ -4726,7 +4766,7 @@ goto check_bottom; } #ifndef NO_STACK_CURSMOVE_ANIHILATION -@@ -762,7 +871,9 @@ void edit_push_action (WEdit * edit, lon +@@ -758,7 +868,9 @@ void edit_push_action (WEdit * edit, lon #endif } } @@ -4737,7 +4777,7 @@ check_bottom: edit->stack_pointer = (edit->stack_pointer + 1) & edit->stack_size_mask; -@@ -775,10 +886,10 @@ void edit_push_action (WEdit * edit, lon +@@ -771,10 +883,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; @@ -4750,7 +4790,7 @@ edit->stack_bottom = edit->stack_pointer = 0; } -@@ -787,30 +898,30 @@ void edit_push_action (WEdit * edit, lon +@@ -783,30 +895,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 @@ -4792,7 +4832,7 @@ } /* is called whenever a modification is made by one of the four routines below */ -@@ -831,7 +942,7 @@ static inline void edit_modification (WE +@@ -827,7 +939,7 @@ static inline void edit_modification (WE */ void @@ -4801,7 +4841,7 @@ { /* check if file has grown to large */ if (edit->last_byte >= SIZE_LIMIT) -@@ -869,12 +980,11 @@ edit_insert (WEdit *edit, int c) +@@ -865,12 +977,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] = @@ -4817,7 +4857,7 @@ /* update file length */ edit->last_byte++; -@@ -885,7 +995,7 @@ edit_insert (WEdit *edit, int c) +@@ -881,7 +992,7 @@ edit_insert (WEdit *edit, int c) /* same as edit_insert and move left */ @@ -4826,7 +4866,7 @@ { if (edit->last_byte >= SIZE_LIMIT) return; -@@ -908,7 +1018,7 @@ void edit_insert_ahead (WEdit * edit, in +@@ -904,7 +1015,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)) @@ -4835,7 +4875,7 @@ edit->buffers2[edit->curs2 >> S_EDIT_BUF_SIZE][EDIT_BUF_SIZE - (edit->curs2 & M_EDIT_BUF_SIZE) - 1] = c; edit->last_byte++; -@@ -918,7 +1028,7 @@ void edit_insert_ahead (WEdit * edit, in +@@ -914,7 +1025,7 @@ void edit_insert_ahead (WEdit * edit, in int edit_delete (WEdit * edit) { @@ -4844,7 +4884,7 @@ if (!edit->curs2) return 0; -@@ -942,7 +1052,7 @@ int edit_delete (WEdit * edit) +@@ -938,7 +1049,7 @@ int edit_delete (WEdit * edit) edit->total_lines--; edit->force |= REDRAW_AFTER_CURSOR; } @@ -4853,7 +4893,7 @@ if (edit->curs1 < edit->start_display) { edit->start_display--; if (p == '\n') -@@ -956,7 +1066,7 @@ int edit_delete (WEdit * edit) +@@ -952,7 +1063,7 @@ int edit_delete (WEdit * edit) static int edit_backspace (WEdit * edit) { @@ -4862,7 +4902,7 @@ if (!edit->curs1) return 0; -@@ -980,7 +1090,7 @@ edit_backspace (WEdit * edit) +@@ -976,7 +1087,7 @@ edit_backspace (WEdit * edit) edit->total_lines--; edit->force |= REDRAW_AFTER_CURSOR; } @@ -4871,7 +4911,7 @@ if (edit->curs1 < edit->start_display) { edit->start_display--; -@@ -993,10 +1103,18 @@ edit_backspace (WEdit * edit) +@@ -989,10 +1100,18 @@ edit_backspace (WEdit * edit) #ifdef FAST_MOVE_CURSOR @@ -4891,7 +4931,7 @@ edit->curs_line--; next -= (unsigned long) dest; n -= next; -@@ -1009,7 +1127,7 @@ int +@@ -1005,7 +1124,7 @@ int edit_move_backward_lots (WEdit *edit, long increment) { int r, s, t; @@ -4900,7 +4940,7 @@ if (increment > edit->curs1) increment = edit->curs1; -@@ -1049,7 +1167,7 @@ edit_move_backward_lots (WEdit *edit, lo +@@ -1045,7 +1164,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] = @@ -4909,7 +4949,7 @@ } else { g_free (p); } -@@ -1087,7 +1205,7 @@ edit_move_backward_lots (WEdit *edit, lo +@@ -1083,7 +1202,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] = @@ -4918,7 +4958,7 @@ } else { g_free (p); } -@@ -1119,7 +1237,7 @@ int edit_cursor_move (WEdit * edit, long +@@ -1115,7 +1234,7 @@ int edit_cursor_move (WEdit * edit, long c = edit_get_byte (edit, edit->curs1 - 1); if (!((edit->curs2 + 1) & M_EDIT_BUF_SIZE)) @@ -4927,7 +4967,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]; -@@ -1144,7 +1262,7 @@ int edit_cursor_move (WEdit * edit, long +@@ -1140,7 +1259,7 @@ int edit_cursor_move (WEdit * edit, long c = edit_get_byte (edit, edit->curs1); if (!(edit->curs1 & M_EDIT_BUF_SIZE)) @@ -4936,7 +4976,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]; -@@ -1251,7 +1369,7 @@ long edit_move_forward3 (WEdit * edit, l +@@ -1247,7 +1366,7 @@ long edit_move_forward3 (WEdit * edit, l q = edit->last_byte + 2; for (col = 0, p = current; p < q; p++) { @@ -4945,7 +4985,7 @@ if (cols != -10) { if (col == cols) return p; -@@ -1269,7 +1387,7 @@ long edit_move_forward3 (WEdit * edit, l +@@ -1265,7 +1384,7 @@ long edit_move_forward3 (WEdit * edit, l } else if (c < 32 || c == 127) col += 2; /* Caret notation for control characters */ else @@ -4954,7 +4994,7 @@ } return col; } -@@ -1402,7 +1520,7 @@ static int +@@ -1398,7 +1517,7 @@ static int is_blank (WEdit *edit, long offset) { long s, f; @@ -4963,7 +5003,7 @@ s = edit_bol (edit, offset); f = edit_eol (edit, offset) - 1; while (s <= f) { -@@ -1774,13 +1892,13 @@ static void edit_left_delete_word (WEdit +@@ -1770,13 +1889,13 @@ static void edit_left_delete_word (WEdit static void edit_do_undo (WEdit * edit) { @@ -4980,7 +5020,7 @@ case STACK_BOTTOM: goto done_undo; case CURS_RIGHT: -@@ -1801,31 +1919,33 @@ edit_do_undo (WEdit * edit) +@@ -1797,31 +1916,33 @@ edit_do_undo (WEdit * edit) case COLUMN_OFF: column_highlighting = 0; break; @@ -5027,7 +5067,7 @@ edit_update_curs_row (edit); done_undo:; -@@ -2102,7 +2222,7 @@ static void edit_goto_matching_bracket ( +@@ -2098,7 +2219,7 @@ static void edit_goto_matching_bracket ( * passed as -1. Commands are executed, and char_for_insertion is * inserted at the cursor. */ @@ -5036,7 +5076,7 @@ { if (command == CK_Begin_Record_Macro) { edit->macro_i = 0; -@@ -2137,7 +2257,7 @@ static const char * const shell_cmd[] = +@@ -2133,7 +2254,7 @@ static const char * const shell_cmd[] = all of them. It also does not check for the Undo command. */ void @@ -5045,7 +5085,7 @@ { edit->force |= REDRAW_LINE; -@@ -2170,7 +2290,7 @@ edit_execute_cmd (WEdit *edit, int comma +@@ -2166,7 +2287,7 @@ edit_execute_cmd (WEdit *edit, int comma } /* An ordinary key press */ diff --git a/mc.spec b/mc.spec index d4e5607..d6d93e8 100644 --- a/mc.spec +++ b/mc.spec @@ -1,11 +1,11 @@ Summary: User-friendly text console file manager and visual shell. Name: mc Version: 4.6.1a -Release: 0.18 +Release: 0.19 Epoch: 1 License: GPL Group: System Environment/Shells -Source0: http://www.ibiblio.org/pub/Linux/utils/file/managers/mc/mc-4.6.1.tar.bz2 +Source0: http://www.ibiblio.org/pub/Linux/utils/file/managers/mc/mc-%{version}.tar.bz2 URL: http://www.ibiblio.org/mc/ BuildRoot: %{_tmppath}/%{name}-%{version}-root BuildRequires: gpm-devel, slang-devel, glib2-devel @@ -19,14 +19,7 @@ Patch3: mc-uglydir.patch Patch4: mc-fish-upload.patch Patch5: mc-userhost.patch Patch6: mc-64bit.patch -Patch7: mc-gcc4.patch -Patch8: mc-ftpcrash.patch -Patch9: mc-specsyntax.patch -Patch10: mc-find.patch -Patch11: mc-symcrash.patch -Patch12: mc-cstrans.patch -Patch13: mc-ctrl-t.patch -Patch14: mc-searchfix.patch +Patch7: mc-specsyntax.patch %description Midnight Commander is a visual shell much like a file manager, only @@ -36,7 +29,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 %{name}-4.6.1 +%setup -q -n %{name}-%{version} %patch0 -p1 -b .utf8 %patch1 -p1 -b .extensions @@ -45,14 +38,7 @@ poke into RPMs for specific files. %patch4 -p1 -b .fish-upload %patch5 -p1 -b .userhost %patch6 -p1 -b .64bit -%patch7 -p1 -b .gcc4 -%patch8 -p1 -b .ftpcrash -%patch9 -p1 -b .specsyntax -%patch10 -p1 -b .find -%patch11 -p1 -b .symcrash -%patch12 -p1 -b .cstrans -%patch13 -p1 -b .ctrl-t -%patch14 -p1 -b .searchfix +%patch7 -p1 -b .specsyntax # convert files in /lib to UTF-8 pushd lib @@ -189,6 +175,15 @@ rm -rf $RPM_BUILD_ROOT %dir %{_datadir}/mc %changelog +* Mon Oct 16 2005 Jindrich Novy 4.6.1a-0.19 +- update from CVS +- convert spec to UTF-8 +- sync utf8, promptfix, 64bit patches +- drop upstreamed gcc4, ftpcrash, find, symcrash, cstrans, searchfix patches +- drop ctrl-t patch +- update userhost patch to let the edited/viewed file name be displayed in + xterm title + * Tue Oct 4 2005 Jindrich Novy 4.6.1a-0.18 - fix off-by-one highlighting when searching backwards in mcedit (#169823) - fix yet another duplicates in menus for Czech locale @@ -560,7 +555,7 @@ rm -rf $RPM_BUILD_ROOT - Add patch to recognize kudzu's fstab entries - Fix path to memstick icon -* Fri Feb 23 2001 Trond Eivind Glomsrød +* Fri Feb 23 2001 Trond Eivind Glomsrød - use %%{_tmppath} - langify @@ -574,7 +569,7 @@ rm -rf $RPM_BUILD_ROOT - include both sys/time.h and time.h on glibc 2.2.2 - fix Japanese patch to include locale.h. -* Tue Feb 6 2001 Trond Eivind Glomsrød +* Tue Feb 6 2001 Trond Eivind Glomsrød - i18nize initscript * Sat Jan 27 2001 Akira TAGOH @@ -771,7 +766,7 @@ rm -rf $RPM_BUILD_ROOT * Wed Apr 8 1998 Marc Ewing - add %{prefix}/lib/mc/layout to gmc -* Tue Dec 23 1997 Tomasz K³oczko +* Tue Dec 23 1997 Tomasz KÅ‚oczko - added --without-debug to configure, - modification in %%build and %%install and cosmetic modification in packages headers, @@ -795,7 +790,7 @@ rm -rf $RPM_BUILD_ROOT - fixed spec file. - Updated to 4.1.8 -* Sun Oct 26 1997 Tomasz K³oczko +* Sun Oct 26 1997 Tomasz KÅ‚oczko - updated to 4.1.6 - added %attr macros in %%files, @@ -839,7 +834,7 @@ rm -rf $RPM_BUILD_ROOT - reverted to un-gzipped man pages (RedHat style) - removed double install line for mcserv.pamd -* Tue May 13 1997 Tomasz K³oczko +* Tue May 13 1997 Tomasz KÅ‚oczko - added new rpmfs script, - removed mcfn_install from mc (adding mc() to bash enviroment is in @@ -848,25 +843,25 @@ rm -rf $RPM_BUILD_ROOT - removed %{prefix}/lib/mc/bin/create_vcs, - removed %{prefix}/lib/mc/term. -* Wed May 9 1997 Tomasz K³oczko +* Wed May 9 1997 Tomasz KÅ‚oczko - changed source url, - fixed link mcedit to mc, -* Tue May 7 1997 Tomasz K³oczko +* Tue May 7 1997 Tomasz KÅ‚oczko - new version 3.5.27, - %dir %{prefix}/lib/mc/icons and icons removed from tkmc, - added commented xmc part. -* Tue Apr 22 1997 Tomasz K³oczko +* Tue Apr 22 1997 Tomasz KÅ‚oczko - FIX spec: - added URL field, - in mc added missing %{prefix}/lib/mc/mc.ext, %{prefix}/lib/mc/mc.hint, %{prefix}/lib/mc/mc.hlp, %{prefix}/lib/mc/mc.lib, %{prefix}/lib/mc/mc.menu. -* Fri Apr 18 1997 Tomasz K³oczko +* Fri Apr 18 1997 Tomasz KÅ‚oczko - added making packages: tkmc, mcserv (xmc not work yet), - gziped man pages,