1
1

revert the conversion of each line to a valid multibyte string, as it

doesn't take encodings other than ASCII and Latin-1 into account and
hence isn't accurate enough


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2614 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Этот коммит содержится в:
David Lawrence Ramsey 2005-06-08 20:12:57 +00:00
родитель 01458cd380
Коммит c7935e20b7
3 изменённых файлов: 5 добавлений и 15 удалений

Просмотреть файл

@ -54,10 +54,6 @@ CVS code -
and NANO_APPEND_KEY are. Changes to shortcut_init(), usage(), and NANO_APPEND_KEY are. Changes to shortcut_init(), usage(),
main(), search_init(), nanorc.sample, nano.1, nanorc.5, main(), search_init(), nanorc.sample, nano.1, nanorc.5,
nano.texi, etc. (DLR) nano.texi, etc. (DLR)
- When reading a file in, make sure each line is a valid
multibyte string, unless the NO_CONVERT flag is set. Note
that this is disabled when NANO_SMALL is defined. Changes to
make_mbstring(), read_line(), and do_credits(). (DLR)
- chars.c: - chars.c:
make_mbstring() make_mbstring()
- Change erroneous ENABLE_EXTRA #ifdef to NANO_EXTRA to fix a - Change erroneous ENABLE_EXTRA #ifdef to NANO_EXTRA to fix a

Просмотреть файл

@ -301,7 +301,7 @@ char *make_mbchar(int chr, int *chr_mb_len)
return chr_mb; return chr_mb;
} }
#if !defined(NANO_SMALL) || defined(ENABLE_NANORC) || defined(NANO_EXTRA) #if defined(ENABLE_NANORC) || defined(NANO_EXTRA)
/* Convert the string str to a valid multibyte string with the same wide /* Convert the string str to a valid multibyte string with the same wide
* character values as str. Return the (dynamically allocated) * character values as str. Return the (dynamically allocated)
* multibyte string. */ * multibyte string. */

Просмотреть файл

@ -77,16 +77,10 @@ filestruct *read_line(char *buf, filestruct *prevnode, bool
fileptr->data = mallocstrcpy(NULL, buf); fileptr->data = mallocstrcpy(NULL, buf);
#ifndef NANO_SMALL #ifndef NANO_SMALL
if (!ISSET(NO_CONVERT)) { /* If it's a DOS file (CR LF), and file conversion isn't disabled,
/* If it's a DOS file (CR LF), and file conversion isn't * strip the CR part from fileptr->data. */
* disabled, strip the CR part from fileptr->data. */ if (!ISSET(NO_CONVERT) && len > 0 && buf[len - 1] == '\r')
if (len > 0 && buf[len - 1] == '\r')
fileptr->data[len - 1] = '\0'; fileptr->data[len - 1] = '\0';
/* Make sure fileptr->data is a valid multibyte string. */
fileptr->data = mallocstrassn(fileptr->data,
make_mbstring(fileptr->data));
}
#endif #endif
if (*first_line_ins || fileage == NULL) { if (*first_line_ins || fileage == NULL) {