texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[7130] parsetexi noindent indent


From: Gavin D. Smith
Subject: [7130] parsetexi noindent indent
Date: Sun, 24 Apr 2016 13:30:27 +0000

Revision: 7130
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=7130
Author:   gavin
Date:     2016-04-24 13:30:27 +0000 (Sun, 24 Apr 2016)
Log Message:
-----------
parsetexi noindent indent

Modified Paths:
--------------
    trunk/tp/parsetexi/handle_commands.c
    trunk/tp/parsetexi/parser.h

Modified: trunk/tp/parsetexi/handle_commands.c
===================================================================
--- trunk/tp/parsetexi/handle_commands.c        2016-04-24 12:58:14 UTC (rev 
7129)
+++ trunk/tp/parsetexi/handle_commands.c        2016-04-24 13:30:27 UTC (rev 
7130)
@@ -541,6 +541,47 @@
             push_context (ct_line);
         }
       start_empty_line_after_command (current, &line, misc); //4621
+
+      if (cmd == CM_indent || cmd == CM_noindent)
+        {
+          /* Start a new paragraph if not in one already. */
+          int spaces;
+          enum element_type t;
+          ELEMENT *paragraph;
+
+          /* Check if if we should change an ET_empty_line_after_command
+             element to ET_empty_spaces_after_command by looking ahead
+             to see what comes next. */
+#if 0
+          if (!strchr (line, '\n'))
+            {
+              new_line ();
+            }
+#endif
+          spaces = strspn (line, whitespace_chars);
+          if (spaces > 0)
+            {
+              char saved = line[spaces];
+              current = merge_text (current, line);
+              line[spaces] = saved;
+              line += spaces;
+            }
+          if (*line
+              && last_contents_child(current)->type
+                == ET_empty_line_after_command)
+            {
+              last_contents_child(current)->type
+                                              = ET_empty_spaces_after_command;
+            }
+          paragraph = begin_paragraph (current);
+          if (paragraph)
+            current = paragraph;
+          if (!*line)
+            {
+              *status = 1; /* Get a new line. */
+              goto funexit;
+            }
+        }
     }
 
   /* line 4622 */
@@ -548,6 +589,7 @@
                                      nesting */
   register_global_command (cmd, misc);
 
+funexit:
   *line_inout = line;
   return current;
 }

Modified: trunk/tp/parsetexi/parser.h
===================================================================
--- trunk/tp/parsetexi/parser.h 2016-04-24 12:58:14 UTC (rev 7129)
+++ trunk/tp/parsetexi/parser.h 2016-04-24 13:30:27 UTC (rev 7130)
@@ -67,6 +67,7 @@
 void start_empty_line_after_command (ELEMENT *current, char **line_inout,
                                      ELEMENT *command);
 ELEMENT *trim_spaces_comment_from_content (ELEMENT *original);
+ELEMENT *begin_paragraph (ELEMENT *current);
 
 extern const char *whitespace_chars, *whitespace_chars_except_newline;
 extern const char *digit_chars;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]