Fix conflicts after rebasing

This commit is contained in:
Slava Zanko 2009-04-16 13:24:47 +03:00
commit ac8ae55181
8 changed files with 125 additions and 136 deletions

View File

@ -214,13 +214,14 @@ int edit_get_prev_utf (WEdit * edit, long byte_index, int *char_width)
} }
if ( byte_index >= (edit->curs1 + edit->curs2) || byte_index < 0 ) { if ( byte_index >= (edit->curs1 + edit->curs2) || byte_index < 0 ) {
*char_width = 1; *char_width = 0;
return 0; return 0;
} }
str = edit_get_byte_ptr (edit, byte_index); str = edit_get_byte_ptr (edit, byte_index);
buf = edit_get_buf_ptr (edit, byte_index); buf = edit_get_buf_ptr (edit, byte_index);
/* get prev utf8 char */ /* get prev utf8 char */
if ( str != buf )
str = g_utf8_find_prev_char (buf, str); str = g_utf8_find_prev_char (buf, str);
res = g_utf8_get_char_validated (str, -1); res = g_utf8_get_char_validated (str, -1);

View File

@ -66,6 +66,9 @@
static void status_string (WEdit * edit, char *s, int w) static void status_string (WEdit * edit, char *s, int w)
{ {
char byte_str[16]; char byte_str[16];
unsigned char cur_byte = 0;
unsigned int cur_utf = 0;
int cw = 1;
/* /*
* If we are at the end of file, print <EOF>, * If we are at the end of file, print <EOF>,
@ -74,28 +77,32 @@ static void status_string (WEdit * edit, char *s, int w)
*/ */
if (edit->curs1 < edit->last_byte) { if (edit->curs1 < edit->last_byte) {
if ( !edit->utf8 ) { if ( !edit->utf8 ) {
unsigned char cur_byte = edit_get_byte (edit, edit->curs1); cur_byte = edit_get_byte (edit, edit->curs1);
g_snprintf (byte_str, sizeof (byte_str), "%c %3d 0x%02X",
is_printable (cur_byte) ? cur_byte : '.', g_snprintf (byte_str, sizeof (byte_str), "%4d 0x%03X",
(int) cur_byte, (int) cur_byte,
(unsigned) cur_byte); (unsigned) cur_byte);
} else { } else {
int cw = 1; cur_utf = edit_get_utf (edit, edit->curs1, &cw);
unsigned int cur_utf = edit_get_utf (edit, edit->curs1, &cw);
if ( cw > 0 ) { if ( cw > 0 ) {
g_snprintf (byte_str, sizeof (byte_str), "%04d 0x%03X", g_snprintf (byte_str, sizeof (byte_str), "%04d 0x%03X",
(unsigned) cur_utf, (unsigned) cur_utf,
(unsigned) cur_utf); (unsigned) cur_utf);
} else {
cur_utf = edit_get_byte (edit, edit->curs1);
g_snprintf (byte_str, sizeof (byte_str), "%04d 0x%03X",
(int) cur_utf,
(unsigned) cur_utf);
} }
} }
} else { } else {
strcpy (byte_str, "<EOF>"); strcpy (byte_str, "<EOF> ");
} }
/* The field lengths just prevent the status line from shortening too much */ /* The field lengths just prevent the status line from shortening too much */
g_snprintf (s, w, g_snprintf (s, w,
"[%c%c%c%c] %2ld L:[%3ld+%2ld %3ld/%3ld] *(%-4ld/%4ldb)= %s C:%s", "[%c%c%c%c] %2ld L:[%3ld+%2ld %3ld/%3ld] *(%-4ld/%4ldb)= %s cp:%s",
edit->mark1 != edit->mark2 ? ( column_highlighting ? 'C' : 'B') : '-', edit->mark1 != edit->mark2 ? ( column_highlighting ? 'C' : 'B') : '-',
edit->modified ? 'M' : '-', edit->modified ? 'M' : '-',
edit->macro_i < 0 ? '-' : 'R', edit->macro_i < 0 ? '-' : 'R',
@ -110,7 +117,9 @@ static void status_string (WEdit * edit, char *s, int w)
edit->curs1, edit->curs1,
edit->last_byte, edit->last_byte,
byte_str, byte_str,
get_codepage_id( source_codepage )); get_codepage_id ( source_codepage )
);
} }
static inline void static inline void

View File

@ -284,15 +284,9 @@ str_translate_char (GIConv conv, char *keys, size_t ch_size,
left = (ch_size == (size_t) (-1)) ? strlen (keys) : ch_size; left = (ch_size == (size_t) (-1)) ? strlen (keys) : ch_size;
cnv = g_iconv (conv, &keys, &left, &output, &out_size); cnv = g_iconv (conv, &keys, &left, &output, &out_size);
if (cnv == (size_t) (-1)) if (cnv == (size_t)(-1)) {
{ if (errno == EINVAL) return ESTR_PROBLEM; else return ESTR_FAILURE;
if (errno == EINVAL) } else {
return ESTR_PROBLEM;
else
return ESTR_FAILURE;
}
else
{
output[0] = '\0'; output[0] = '\0';
return 0; return 0;
} }
@ -316,7 +310,6 @@ str_test_encoding_class (const char *encoding, const char **table)
result += (g_ascii_strncasecmp (encoding, table[t], result += (g_ascii_strncasecmp (encoding, table[t],
strlen (table[t])) == 0); strlen (table[t])) == 0);
} }
return result; return result;
} }
@ -352,7 +345,8 @@ void
str_init_strings (const char *termenc) str_init_strings (const char *termenc)
{ {
codeset = g_strdup ((termenc != NULL) codeset = g_strdup ((termenc != NULL)
? termenc : str_detect_termencoding ()); ? termenc
: str_detect_termencoding ());
str_cnv_not_convert = g_iconv_open (codeset, codeset); str_cnv_not_convert = g_iconv_open (codeset, codeset);
if (str_cnv_not_convert == INVALID_CONV) if (str_cnv_not_convert == INVALID_CONV)
@ -425,7 +419,7 @@ str_get_next_char (char *text)
const char * const char *
str_cget_next_char (const char *text) str_cget_next_char (const char *text)
{ {
used_class.cnext_char (&text); used_class.cnext_char(&text);
return text; return text;
} }

View File

@ -490,7 +490,7 @@ str_8bit_offset_to_pos (const char *text, size_t length)
static int static int
str_8bit_column_to_pos (const char *text, size_t pos) str_8bit_column_to_pos (const char *text, size_t pos)
{ {
return (int) pos; return (int)pos;
} }
static char * static char *

View File

@ -512,7 +512,7 @@ str_ascii_offset_to_pos (const char *text, size_t length)
static int static int
str_ascii_column_to_pos (const char *text, size_t pos) str_ascii_column_to_pos (const char *text, size_t pos)
{ {
return (int) pos; return (int)pos;
} }
static char * static char *

View File

@ -342,7 +342,6 @@ str_utf8_vfs_convert_to (GIConv coder, const char *string,
result = 0; result = 0;
} }
else else
// result = _str_utf8_vfs_convert_to (coder, string, size, buffer);
result = str_nconvert (coder, (char *) string, size, buffer); result = str_nconvert (coder, (char *) string, size, buffer);
return result; return result;
@ -387,43 +386,30 @@ str_utf8_make_make_term_form (const char *text, size_t length)
} }
} }
while (length != 0 && text[0] != '\0') while (length != 0 && text[0] != '\0') {
{
uni = g_utf8_get_char_validated (text, -1); uni = g_utf8_get_char_validated (text, -1);
if ((uni != (gunichar) (-1)) && (uni != (gunichar) (-2))) if ((uni != (gunichar)(-1)) && (uni != (gunichar)(-2))) {
{ if (g_unichar_isprint(uni)) {
if (g_unichar_isprint (uni))
{
left = g_unichar_to_utf8 (uni, actual); left = g_unichar_to_utf8 (uni, actual);
actual += left; actual+= left;
if (!str_unichar_iscombiningmark (uni)) if (!str_unichar_iscombiningmark (uni)) {
{
result.width++; result.width++;
if (g_unichar_iswide (uni)) if (g_unichar_iswide(uni)) result.width++;
result.width++; } else result.compose = 1;
} } else {
else
result.compose = 1;
}
else
{
actual[0] = '.'; actual[0] = '.';
actual++; actual++;
result.width++; result.width++;
} }
text = g_utf8_next_char (text); text = g_utf8_next_char (text);
} } else {
else
{
text++; text++;
//actual[0] = '?'; //actual[0] = '?';
memcpy (actual, replch, strlen (replch)); memcpy (actual, replch, strlen (replch));
actual += strlen (replch); actual+= strlen (replch);
result.width++; result.width++;
} }
if (length != (size_t) (-1)) if (length != (size_t) (-1)) length--; }
length--;
}
actual[0] = '\0'; actual[0] = '\0';
return &result; return &result;
@ -1219,12 +1205,9 @@ str_utf8_create_key_gen (const char *text, int case_sen,
{ {
char *result; char *result;
if (case_sen) if (case_sen) {
{
result = str_utf8_normalize (text); result = str_utf8_normalize (text);
} } else {
else
{
const char *start, *end; const char *start, *end;
char *fold, *key; char *fold, *key;
GString *fixed = g_string_new (""); GString *fixed = g_string_new ("");

View File

@ -2780,7 +2780,6 @@ view_get_line_at (WView *view, offset_type from, GString * buffer,
continue; continue;
if (view_read_test_nroff_back (view, &info)) { if (view_read_test_nroff_back (view, &info)) {
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
g_string_truncate (buffer, buffer->len-1); g_string_truncate (buffer, buffer->len-1);
continue; continue;
} }
@ -3653,12 +3652,13 @@ static void view_cmk_moveto_bottom (void *w, int n) {
static void static void
view_select_encoding (WView *view) view_select_encoding (WView *view)
{ {
char *enc; char *enc = NULL;
GIConv conv; GIConv conv;
struct cache_line *line; struct cache_line *line;
enc = input_dialog ("Encoding", "Paste encoding", NULL, ""); do_select_codepage ();
enc = g_strdup( get_codepage_id ( source_codepage ) );
if (enc != NULL) { if (enc != NULL) {
conv = str_crt_conv_from (enc); conv = str_crt_conv_from (enc);
if (conv != (iconv_t)(-1)) { if (conv != (iconv_t)(-1)) {
@ -3668,7 +3668,9 @@ view_select_encoding (WView *view)
line = view_offset_to_line (view, view->dpy_start); line = view_offset_to_line (view, view->dpy_start);
view_set_first_showed (view, line); view_set_first_showed (view, line);
} }
g_free(enc);
} }
} }