This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[TUI] correctly display windows source files


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
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' &&

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]