[TUI] correctly display windows source files

Denis PILAT
2006-10-09T15:25:02Z

[-- Attachment #1: Type: text/plain, Size: 267 bytes --]

Hello,

The TUI displays windows source files with and extra blank line between
each source line.
Line number are wrong and changes when source is moved up and down.

This patch fixes this problem and should take the case of MAC OS
end-of-line into account.

Denis

[-- Attachment #2: tui-source.c.patch --]
[-- Type: text/plain, Size: 768 bytes --]

2006-10-09 Denis Pilat <denis.pilat@st.com>

* tui-source.c (tui_set_source_content): handle source files that
contain non unix end-of-line.

Index: tui/tui-source.c
===================================================================
--- tui/tui-source.c (revision 528)
+++ tui/tui-source.c (working copy)
@@ -194,6 +194,13 @@ tui_set_source_content (struct symtab *s
chars until we do */
while (c != EOF && c != '\n' && c != '\r')
c = fgetc (stream);
+ /* Handle non-'\n' end-of-line. */
+ if (c == '\r' && (c = fgetc (stream)) != '\n')
+ {
+ ungetc (c, stream);
+ c = '\r';
+ }
+
}
}
while (c != EOF && c != '\n' && c != '\r' &&