fix: build without HAVE_CHARSET

This commit is contained in:
Ilia Maslakov 2009-04-20 05:51:32 +00:00
parent a4b354f99c
commit 9d855b3253
5 changed files with 21 additions and 6 deletions

View File

@ -277,9 +277,10 @@ edit_load_file_fast (WEdit *edit, const char *filename)
edit->curs2 = edit->last_byte;
buf2 = edit->curs2 >> S_EDIT_BUF_SIZE;
edit->utf8 = 0;
#ifdef HAVE_CHARSET
if ( get_codepage_id( source_codepage ) )
edit->utf8 = str_isutf8 (get_codepage_id( source_codepage ));
#endif
if ((file = mc_open (filename, O_RDONLY | O_BINARY)) == -1) {
GString *errmsg = g_string_new(NULL);
g_string_sprintf(errmsg, _(" Cannot open %s for reading "), filename);

View File

@ -102,7 +102,7 @@ static void status_string (WEdit * edit, char *s, int w)
/* The field lengths just prevent the status line from shortening too much */
g_snprintf (s, w,
"[%c%c%c%c] %2ld L:[%3ld+%2ld %3ld/%3ld] *(%-4ld/%4ldb)= %s cp:%s",
"[%c%c%c%c] %2ld L:[%3ld+%2ld %3ld/%3ld] *(%-4ld/%4ldb)= %s %s",
edit->mark1 != edit->mark2 ? ( column_highlighting ? 'C' : 'B') : '-',
edit->modified ? 'M' : '-',
edit->macro_i < 0 ? '-' : 'R',
@ -117,7 +117,12 @@ static void status_string (WEdit * edit, char *s, int w)
edit->curs1,
edit->last_byte,
byte_str,
#ifdef HAVE_CHARSET
get_codepage_id ( source_codepage )
#else
""
#endif
);
}
@ -432,6 +437,7 @@ edit_draw_this_line (WEdit *edit, long b, long row, long start_col,
}
/* fallthrough */
default:
#ifdef HAVE_CHARSET
if ( utf8_display ) {
if ( !edit->utf8 ) {
c = convert_from_8bit_to_utf_c ((unsigned char) c);
@ -440,9 +446,12 @@ edit_draw_this_line (WEdit *edit, long b, long row, long start_col,
if ( edit->utf8 ) {
c = convert_from_utf_to_current_c (c);
} else {
#endif
c = convert_to_display_c (c);
#ifdef HAVE_CHARSET
}
}
#endif
/* Caret notation for control characters */
if (c < 32) {
p->ch = '^';

View File

@ -247,6 +247,7 @@ edit_translate_key (WEdit *edit, long x_key, int *cmd, int *ch)
/* an ordinary insertable character */
if (x_key < 256 && !extmod) {
#ifdef HAVE_CHARSET
if ( edit->charpoint >= 4 ) {
edit->charpoint = 0;
edit->charbuf[edit->charpoint] = '\0';
@ -260,11 +261,13 @@ edit_translate_key (WEdit *edit, long x_key, int *cmd, int *ch)
if ( !utf8_display ) {
/* source in 8-bit codeset */
if (!edit->utf8) {
#endif
c = convert_from_input_c (x_key);
if (is_printable (c)) {
char_for_insertion = c;
goto fin;
}
#ifdef HAVE_CHARSET
} else {
//FIXME: need more think about
//must be return multibyte char but this func return 8bit char
@ -317,6 +320,7 @@ edit_translate_key (WEdit *edit, long x_key, int *cmd, int *ch)
}
}
}
#endif
}
/* Commands specific to the key emulation */

View File

@ -1423,10 +1423,10 @@ set_panel_encoding (WPanel *panel)
char *encoding = NULL;
char *cd_path;
#ifdef HAVE_CHARSET
do_select_codepage ();
encoding = g_strdup( get_codepage_id ( source_codepage ) );
#endif
if (encoding) {
cd_path = add_encoding_to_path (panel->cwd, encoding);
if (!do_panel_cd (MENU_PANEL, cd_path, 0))

View File

@ -3657,10 +3657,11 @@ view_select_encoding (WView *view)
GIConv conv;
struct cache_line *line;
#ifdef HAVE_CHARSET
do_select_codepage ();
enc = g_strdup( get_codepage_id ( source_codepage ) );
if (enc != NULL) {
#endif
if ( enc ) {
conv = str_crt_conv_from (enc);
if (conv != INVALID_CONV) {
if (view->converter != str_cnv_from_term)