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 ) {
*char_width = 1;
*char_width = 0;
return 0;
}
str = edit_get_byte_ptr (edit, byte_index);
buf = edit_get_buf_ptr (edit, byte_index);
/* get prev utf8 char */
if ( str != buf )
str = g_utf8_find_prev_char (buf, str);
res = g_utf8_get_char_validated (str, -1);

View File

@ -66,6 +66,9 @@
static void status_string (WEdit * edit, char *s, int w)
{
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>,
@ -74,28 +77,32 @@ static void status_string (WEdit * edit, char *s, int w)
*/
if (edit->curs1 < edit->last_byte) {
if ( !edit->utf8 ) {
unsigned char 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 : '.',
cur_byte = edit_get_byte (edit, edit->curs1);
g_snprintf (byte_str, sizeof (byte_str), "%4d 0x%03X",
(int) cur_byte,
(unsigned) cur_byte);
} else {
int cw = 1;
unsigned int cur_utf = edit_get_utf (edit, edit->curs1, &cw);
cur_utf = edit_get_utf (edit, edit->curs1, &cw);
if ( cw > 0 ) {
g_snprintf (byte_str, sizeof (byte_str), "%04d 0x%03X",
(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 {
strcpy (byte_str, "<EOF>");
strcpy (byte_str, "<EOF> ");
}
/* 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 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->modified ? 'M' : '-',
edit->macro_i < 0 ? '-' : 'R',
@ -110,7 +117,9 @@ static void status_string (WEdit * edit, char *s, int w)
edit->curs1,
edit->last_byte,
byte_str,
get_codepage_id( source_codepage ));
get_codepage_id ( source_codepage )
);
}
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;
cnv = g_iconv (conv, &keys, &left, &output, &out_size);
if (cnv == (size_t) (-1))
{
if (errno == EINVAL)
return ESTR_PROBLEM;
else
return ESTR_FAILURE;
}
else
{
if (cnv == (size_t)(-1)) {
if (errno == EINVAL) return ESTR_PROBLEM; else return ESTR_FAILURE;
} else {
output[0] = '\0';
return 0;
}
@ -316,7 +310,6 @@ str_test_encoding_class (const char *encoding, const char **table)
result += (g_ascii_strncasecmp (encoding, table[t],
strlen (table[t])) == 0);
}
return result;
}
@ -352,7 +345,8 @@ void
str_init_strings (const char *termenc)
{
codeset = g_strdup ((termenc != NULL)
? termenc : str_detect_termencoding ());
? termenc
: str_detect_termencoding ());
str_cnv_not_convert = g_iconv_open (codeset, codeset);
if (str_cnv_not_convert == INVALID_CONV)
@ -425,7 +419,7 @@ str_get_next_char (char *text)
const char *
str_cget_next_char (const char *text)
{
used_class.cnext_char (&text);
used_class.cnext_char(&text);
return text;
}

View File

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

View File

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

View File

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

View File

@ -2780,7 +2780,6 @@ view_get_line_at (WView *view, offset_type from, GString * buffer,
continue;
if (view_read_test_nroff_back (view, &info)) {
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
g_string_truncate (buffer, buffer->len-1);
continue;
}
@ -3653,12 +3652,13 @@ static void view_cmk_moveto_bottom (void *w, int n) {
static void
view_select_encoding (WView *view)
{
char *enc;
char *enc = NULL;
GIConv conv;
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) {
conv = str_crt_conv_from (enc);
if (conv != (iconv_t)(-1)) {
@ -3668,7 +3668,9 @@ view_select_encoding (WView *view)
line = view_offset_to_line (view, view->dpy_start);
view_set_first_showed (view, line);
}
g_free(enc);
}
}