[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[6672] nodeline user variable
From: |
Gavin D. Smith |
Subject: |
[6672] nodeline user variable |
Date: |
Sat, 03 Oct 2015 16:29:20 +0000 |
Revision: 6672
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=6672
Author: gavin
Date: 2015-10-03 16:29:19 +0000 (Sat, 03 Oct 2015)
Log Message:
-----------
nodeline user variable
Modified Paths:
--------------
trunk/ChangeLog
trunk/info/info-utils.c
trunk/info/nodes.c
trunk/info/session.c
trunk/info/t/Infokey-config
trunk/info/variables.c
trunk/info/variables.h
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2015-10-03 12:10:15 UTC (rev 6671)
+++ trunk/ChangeLog 2015-10-03 16:29:19 UTC (rev 6672)
@@ -1,5 +1,22 @@
2015-10-03 Gavin Smith <address@hidden>
+ * info/variables.c (info_variables): New user variable 'nodeline'.
+ * info/info-utils.c (parse_top_node_line): Depending on value of
+ user variable 'nodeline', include more or less of the nodeline
+ in the displayed node.
+ (scan_node_contents): Set inptr after calling parse_top_node_line.
+ * info/nodes.c (info_node_of_tag): Check contents field of a tag
+ table entry to see if the node has to be (re-)scanned. Don't
+ null contents field after scan_node_contents returns.
+ * info/session.c (gc_file_buffers_and_nodes): Clear contents
+ field of tags table when gc'ing a file buffer.
+ * info/t/Infokey-config: Set 'nodeline'.
+
+ * info/session.c (info_keep_one_window):
+ Call gc_file_buffers_and_nodes.
+
+2015-10-03 Gavin Smith <address@hidden>
+
* info/display.c (ref_rendition, hl_ref_rendition, match_rendition):
Use non-plain default renditions.
(display_update_node_text): Still highlight cross-references if
Modified: trunk/info/info-utils.c
===================================================================
--- trunk/info/info-utils.c 2015-10-03 12:10:15 UTC (rev 6671)
+++ trunk/info/info-utils.c 2015-10-03 16:29:19 UTC (rev 6672)
@@ -1071,94 +1071,115 @@
}
}
+#define NO_NODELINE 0
+#define PRINT_NODELINE 1
+#define NODELINE_POINTERS_ONLY 2
+int nodeline_print = 2;
+
/* Read first line of node and set next, prev and up. */
static void
parse_top_node_line (NODE *node)
{
- char **store_in;
+ char **store_in = 0;
char *nodename;
+ char *ptr, *ptr2;
+ char *display_start = 0;
int value_length;
/* If the first line is empty, leave it in. This is the case
in the index-apropos window. */
- if (*inptr == '\n')
+ if (*node->contents == '\n')
return;
node->next = node->prev = node->up = 0;
+ ptr = node->contents;
while (1)
{
store_in = 0;
- skip_input (skip_whitespace (inptr));
+ ptr += skip_whitespace (ptr);
/* Check what field we are looking at */
- if (!strncasecmp (inptr, INFO_FILE_LABEL, strlen(INFO_FILE_LABEL)))
+ if (!strncasecmp (ptr, INFO_FILE_LABEL, strlen(INFO_FILE_LABEL)))
{
- skip_input (strlen(INFO_FILE_LABEL));
+ ptr2 = ptr + strlen (INFO_FILE_LABEL);
}
- else if (!strncasecmp (inptr, INFO_NODE_LABEL, strlen(INFO_NODE_LABEL)))
+ else if (!strncasecmp (ptr, INFO_NODE_LABEL, strlen(INFO_NODE_LABEL)))
{
- skip_input (strlen(INFO_NODE_LABEL));
+ ptr2 = ptr + strlen (INFO_NODE_LABEL);
}
- else if (!strncasecmp (inptr, INFO_PREV_LABEL, strlen(INFO_PREV_LABEL)))
+ else if (!strncasecmp (ptr, INFO_PREV_LABEL, strlen(INFO_PREV_LABEL)))
{
- skip_input (strlen(INFO_PREV_LABEL));
+ ptr2 = ptr + strlen (INFO_PREV_LABEL);
store_in = &node->prev;
}
- else if (!strncasecmp (inptr, INFO_ALTPREV_LABEL,
+ else if (!strncasecmp (ptr, INFO_ALTPREV_LABEL,
strlen(INFO_ALTPREV_LABEL)))
{
- skip_input (strlen(INFO_ALTPREV_LABEL));
+ ptr2 = ptr + strlen (INFO_ALTPREV_LABEL);
store_in = &node->prev;
}
- else if (!strncasecmp (inptr, INFO_NEXT_LABEL, strlen(INFO_NEXT_LABEL)))
+ else if (!strncasecmp (ptr, INFO_NEXT_LABEL, strlen(INFO_NEXT_LABEL)))
{
- skip_input (strlen(INFO_NEXT_LABEL));
+ ptr2 = ptr + strlen (INFO_NEXT_LABEL);
store_in = &node->next;
}
- else if (!strncasecmp (inptr, INFO_UP_LABEL, strlen(INFO_UP_LABEL)))
+ else if (!strncasecmp (ptr, INFO_UP_LABEL, strlen(INFO_UP_LABEL)))
{
- skip_input (strlen(INFO_UP_LABEL));
+ ptr2 = ptr + strlen (INFO_UP_LABEL);
store_in = &node->up;
}
else
{
+ ptr2 = ptr;
store_in = 0;
/* Not recognized - code below will skip to next comma */
}
- skip_input (skip_whitespace (inptr));
+ if (nodeline_print==NODELINE_POINTERS_ONLY && !display_start && store_in)
+ display_start = ptr;
+ ptr = ptr2;
- if (*inptr != '(')
+ ptr += skip_whitespace (ptr);
+
+ if (*ptr != '(')
value_length = 0;
else
- {
- value_length = read_bracketed_filename (inptr, 0);
- }
+ value_length = read_bracketed_filename (ptr, 0);
/* Separate at commas or newlines, so it will work for
filenames including full stops. */
- value_length += read_quoted_string (inptr + value_length,
+ value_length += read_quoted_string (ptr + value_length,
"\n\r\t,", 1, &nodename);
if (store_in)
{
*store_in = xmalloc (value_length + 1);
- strncpy (*store_in, inptr, value_length);
+ strncpy (*store_in, ptr, value_length);
(*store_in)[value_length] = '\0';
}
free (nodename);
- skip_input (value_length);
+ ptr += value_length;
- if (*inptr == '\n')
+ if (*ptr == '\n')
{
- skip_input (1);
+ ptr++;
break;
}
- skip_input (1); /* Point after field terminator */
+ ptr += 1; /* Point after field terminator */
}
+ if (display_start)
+ {
+ node->nodelen -= display_start - node->contents;
+ node->contents = display_start;
+ }
+ else if (nodeline_print == NO_NODELINE)
+ {
+ node->nodelen -= ptr - node->contents;
+ node->contents = ptr;
+ }
}
/* Output, replace or hide text introducing a reference. INPTR starts on
@@ -1628,13 +1649,14 @@
refs = calloc (1, sizeof *refs);
refs_slots = 1;
+ parse_top_node_line (node);
+
/* This should be the only time we assign to inptr in this function -
all other assignment should be done with the helper functions above. */
inptr = node->contents;
input_start = node->contents;
input_length = node->nodelen;
- parse_top_node_line (node);
while ((match = forward_to_info_syntax (inptr))
&& match < node->contents + node->nodelen)
Modified: trunk/info/nodes.c
===================================================================
--- trunk/info/nodes.c 2015-10-03 12:10:15 UTC (rev 6671)
+++ trunk/info/nodes.c 2015-10-03 16:29:19 UTC (rev 6672)
@@ -1396,7 +1396,7 @@
set_tag_nodelen (subfile, tag);
}
- if (!tag->cache.nodename || (tag->cache.flags & N_Simple))
+ if (!tag->cache.contents || (tag->cache.flags & N_Simple))
{
/* Data for node has not been generated yet. */
NODE *cache = &tag->cache;
@@ -1422,11 +1422,6 @@
if (!preprocess_nodes_p)
node_set_body_start (cache);
-
- /* Don't save a pointer into a file buffer, because it might be
- garbage collected. */
- if (!(cache->flags & N_WasRewritten))
- cache->contents = 0;
}
/* Initialize the node from the tag. */
Modified: trunk/info/session.c
===================================================================
--- trunk/info/session.c 2015-10-03 12:10:15 UTC (rev 6671)
+++ trunk/info/session.c 2015-10-03 16:29:19 UTC (rev 6672)
@@ -1770,6 +1770,7 @@
if (!fb_referenced[i])
{
FILE_BUFFER *fb = info_loaded_files[i];
+ TAG **t;
if (fb->flags & N_TagsIndirect)
continue;
@@ -1790,6 +1791,14 @@
free (fb->contents);
fb->contents = 0;
+
+ /* Clear pointers into the file contents in the tags table. */
+ if (fb->tags)
+ for (t = fb->tags; (*t); t++)
+ {
+ if (!((*t)->cache.flags & N_WasRewritten))
+ (*t)->cache.contents = 0;
+ }
}
}
@@ -2009,8 +2018,8 @@
amount -= (window->pagetop - pagetop);
display_scroll_display (start, end, amount);
}
-
window->flags |= W_UpdateWindow;
+ gc_file_buffers_and_nodes ();
}
/* Change the size of WINDOW by AMOUNT. */
Modified: trunk/info/t/Infokey-config
===================================================================
--- trunk/info/t/Infokey-config 2015-10-03 12:10:15 UTC (rev 6671)
+++ trunk/info/t/Infokey-config 2015-10-03 16:29:19 UTC (rev 6672)
@@ -7,3 +7,4 @@
infopath-no-defaults=On
automatic-footnotes=On
key-time=0
+nodeline=print
Modified: trunk/info/variables.c
===================================================================
--- trunk/info/variables.c 2015-10-03 12:10:15 UTC (rev 6671)
+++ trunk/info/variables.c 2015-10-03 16:29:19 UTC (rev 6672)
@@ -40,6 +40,8 @@
static char *follow_strategy_choices[] = { "remain", "path", NULL };
+static char *nodeline_choices[] = { "no", "print", "pointers", NULL };
+
/* Choices used by the completer when reading a value for the user-visible
variable "scroll-behaviour". */
static char *info_scroll_choices[] = { "Continuous", "Next Only",
@@ -152,6 +154,10 @@
N_("Styles for search matches"),
&match_rendition, &rendition_variable },
+ { "nodeline",
+ N_("How to print the information line at the start of a node"),
+ &nodeline_print, (char **)nodeline_choices },
+
{ NULL }
};
Modified: trunk/info/variables.h
===================================================================
--- trunk/info/variables.h 2015-10-03 12:10:15 UTC (rev 6671)
+++ trunk/info/variables.h 2015-10-03 16:29:19 UTC (rev 6672)
@@ -82,6 +82,7 @@
extern int key_time;
extern int mouse_protocol;
extern int follow_strategy;
+extern int nodeline_print;
typedef struct {
unsigned long mask;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [6672] nodeline user variable,
Gavin D. Smith <=