Added correct handling of Mac line endings.
Этот коммит содержится в:
родитель
2f8a75974b
Коммит
ca988dd28e
@ -1,3 +1,7 @@
|
|||||||
|
2006-08-03 Roland Illig <roland.illig@gmx.de>
|
||||||
|
|
||||||
|
* view.c: Added correct handling of Mac line endings.
|
||||||
|
|
||||||
2006-06-26 Pavel Tsekov <ptsekov@gmx.net>
|
2006-06-26 Pavel Tsekov <ptsekov@gmx.net>
|
||||||
|
|
||||||
* vfsdummy.h [!USE_VFS] (mc_getlocalcopy): Implement.
|
* vfsdummy.h [!USE_VFS] (mc_getlocalcopy): Implement.
|
||||||
|
22
src/view.c
22
src/view.c
@ -915,7 +915,7 @@ view_ccache_lookup (WView *view, struct coord_cache_entry *coord,
|
|||||||
entry = current;
|
entry = current;
|
||||||
nroff_state = NROFF_START;
|
nroff_state = NROFF_START;
|
||||||
for (; current.cc_offset < limit; current = next) {
|
for (; current.cc_offset < limit; current = next) {
|
||||||
int c;
|
int c, nextc;
|
||||||
|
|
||||||
if ((c = get_byte (view, current.cc_offset)) == -1)
|
if ((c = get_byte (view, current.cc_offset)) == -1)
|
||||||
break;
|
break;
|
||||||
@ -938,8 +938,20 @@ view_ccache_lookup (WView *view, struct coord_cache_entry *coord,
|
|||||||
|
|
||||||
/* and override some of them as necessary. */
|
/* and override some of them as necessary. */
|
||||||
if (c == '\r') {
|
if (c == '\r') {
|
||||||
|
nextc = get_byte_indexed(view, current.cc_offset, 1);
|
||||||
|
|
||||||
|
/* Ignore '\r' if it is followed by '\r' or '\n'. If it is
|
||||||
|
* followed by anything else, it is a Mac line ending and
|
||||||
|
* produces a line break.
|
||||||
|
*/
|
||||||
|
if (nextc == '\r' || nextc == '\n') {
|
||||||
next.cc_column = current.cc_column;
|
next.cc_column = current.cc_column;
|
||||||
next.cc_nroff_column = current.cc_nroff_column;
|
next.cc_nroff_column = current.cc_nroff_column;
|
||||||
|
} else {
|
||||||
|
next.cc_line = current.cc_line + 1;
|
||||||
|
next.cc_column = 0;
|
||||||
|
next.cc_nroff_column = 0;
|
||||||
|
}
|
||||||
|
|
||||||
} else if (nroff_state == NROFF_BACKSPACE) {
|
} else if (nroff_state == NROFF_BACKSPACE) {
|
||||||
next.cc_nroff_column = current.cc_nroff_column - 1;
|
next.cc_nroff_column = current.cc_nroff_column - 1;
|
||||||
@ -1945,8 +1957,14 @@ view_display_text (WView * view)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c == '\r')
|
if (c == '\r') {
|
||||||
|
c = get_byte_indexed(view, from, 1);
|
||||||
|
if (c == '\r' || c == '\n')
|
||||||
continue;
|
continue;
|
||||||
|
col = 0;
|
||||||
|
row++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (c == '\t') {
|
if (c == '\t') {
|
||||||
offset_type line, column;
|
offset_type line, column;
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user