[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[5698] filename, parent fields of NODE changed
From: |
Gavin D. Smith |
Subject: |
[5698] filename, parent fields of NODE changed |
Date: |
Sat, 05 Jul 2014 15:53:29 +0000 |
Revision: 5698
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5698
Author: gavin
Date: 2014-07-05 15:53:27 +0000 (Sat, 05 Jul 2014)
Log Message:
-----------
filename, parent fields of NODE changed
Modified Paths:
--------------
trunk/ChangeLog
trunk/info/dir.c
trunk/info/footnotes.c
trunk/info/indices.c
trunk/info/info-utils.c
trunk/info/info.c
trunk/info/infodoc.c
trunk/info/man.c
trunk/info/nodemenu.c
trunk/info/nodes.c
trunk/info/nodes.h
trunk/info/session.c
trunk/info/window.c
trunk/info/window.h
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2014-07-03 15:05:31 UTC (rev 5697)
+++ trunk/ChangeLog 2014-07-05 15:53:27 UTC (rev 5698)
@@ -1,3 +1,37 @@
+2014-07-05 Gavin Smith <address@hidden>
+
+ * info/nodes.h (NODE): Fields 'parent', 'filename' removed. Fields
+ 'fullpath', 'subfile' added.
+ (N_Subfile): New symbol.
+
+ * info/nodes.c (info_load_file): Arguments changed. Callers updated.
+ Set N_Subfile flag for subfiles.
+
+ * info/nodes.c (init_file_buffer_tag, get_nodes_of_info_file)
+ (get_nodes_of_tag_table, info_create_node, get_filename_and_nodename)
+ (info_get_node_of_file_buffer, info_node_of_tag)
+ * info/dir.c (build_dir_node)
+ * info/footnotes.c (make_footnotes_node)
+ * info/indices.c (create_virtindex_node)
+ * info/info-utils.c (name_internal_node)
+ * info/info.c (add_initial_nodes, allfiles_create_node)
+ * info/infodoc.c (info_get_info_help_node)
+ * info/man.c (get_manpage_node)
+ * info/session.c (info_handle_pointer, info_follow_menus)
+ (info_menu_sequence, node_printed_rep, info_intuit_options_node)
+ (info_goto_invocation_node, info_display_file_info)
+ (file_buffer_of_window, info_search_internal)
+ * info/window.c (window_make_modeline):
+ Access changed fields of NODE objects. Use fullpath field
+ instead of checking if parent is set and falling back to filename.
+
+ * info/nodemenu.c (format_node_info): Use struct text_buffer to hold
+ returned string.
+ * info/window.c (pad_to): Removed.
+
+ * info/session.c (gc_file_buffers_and_nodes): Free subfiles if no
+ window contains a node from the subfile.
+
2014-07-03 Gavin Smith <address@hidden>
* info/nodes.h (INFO_MENU_REGEXP, INFO_MENU_ENTRY_REGEXP)
Modified: trunk/info/dir.c
===================================================================
--- trunk/info/dir.c 2014-07-03 15:05:31 UTC (rev 5697)
+++ trunk/info/dir.c 2014-07-05 15:53:27 UTC (rev 5698)
@@ -64,7 +64,7 @@
node = info_create_node ();
node->nodename = xstrdup ("Top");
- node->filename = xstrdup ("dir");
+ node->fullpath = xstrdup ("dir");
node->contents = xstrdup (
"File: dir, Node: Top, This is the top of the INFO tree.\n"
Modified: trunk/info/footnotes.c
===================================================================
--- trunk/info/footnotes.c 2014-07-03 15:05:31 UTC (rev 5697)
+++ trunk/info/footnotes.c 2014-07-05 15:53:27 UTC (rev 5698)
@@ -90,13 +90,7 @@
refs[i]->nodename[reflen - 1] == '-' &&
isdigit (refs[i]->nodename[reflen]))))
{
- char *filename;
-
- filename = node->parent;
- if (!filename)
- filename = node->filename;
-
- fn_node = info_get_node (filename, refname);
+ fn_node = info_get_node (node->fullpath, refname);
if (fn_node)
fn_start = 0;
@@ -161,8 +155,8 @@
name_internal_node (result, footnote_nodename);
/* Needed in case the user follows a reference in the footnotes window. */
- result->filename = fn_node->filename;
- result->parent = fn_node->parent;
+ result->fullpath = fn_node->fullpath;
+ result->subfile = fn_node->subfile;
free (header);
}
Modified: trunk/info/indices.c
===================================================================
--- trunk/info/indices.c 2014-07-03 15:05:31 UTC (rev 5697)
+++ trunk/info/indices.c 2014-07-05 15:53:27 UTC (rev 5698)
@@ -723,7 +723,7 @@
text += skip_node_separator (text);
node = info_create_node ();
- node->filename = file_buffer->filename;
+ node->fullpath = file_buffer->fullpath;
node->nodename = xstrdup (tag->nodename);
node->contents = text;
node->nodelen = strlen (text);
Modified: trunk/info/info-utils.c
===================================================================
--- trunk/info/info-utils.c 2014-07-03 15:05:31 UTC (rev 5697)
+++ trunk/info/info-utils.c 2014-07-05 15:53:27 UTC (rev 5698)
@@ -1750,8 +1750,8 @@
if (!node)
return;
- node->filename = "";
- node->parent = NULL;
+ node->fullpath = "";
+ node->subfile = 0;
node->nodename = name;
node->flags |= N_IsInternal;
}
Modified: trunk/info/info.c
===================================================================
--- trunk/info/info.c 2014-07-03 15:05:31 UTC (rev 5697)
+++ trunk/info/info.c 2014-07-05 15:53:27 UTC (rev 5698)
@@ -380,10 +380,8 @@
argv += argc; argc = 0;
free (ref_list[0]);
- ref_list[0] = info_new_reference (node_via_menus->parent,
+ ref_list[0] = info_new_reference (node_via_menus->fullpath,
node_via_menus->nodename);
- if (!ref_list[0]->filename) /* Not a split file. */
- ref_list[0]->filename = node_via_menus->filename;
free (node_via_menus);
}
@@ -435,10 +433,8 @@
argv += argc; argc = 0;
free (ref_list[0]);
- ref_list[0] = info_new_reference (node_via_menus->parent,
+ ref_list[0] = info_new_reference (node_via_menus->fullpath,
node_via_menus->nodename);
- if (!ref_list[0]->filename) /* Not a split file. */
- ref_list[0]->filename = node_via_menus->filename;
free (node_via_menus);
}
}
@@ -487,7 +483,7 @@
}
allfiles_node = info_create_node ();
- allfiles_node->filename = xstrdup ("");
+ allfiles_node->fullpath = xstrdup ("");
allfiles_node->nodename = xstrdup ("*Info File Index*");
allfiles_node->contents = text_buffer_base (&text);
allfiles_node->nodelen = text_buffer_off (&text);
Modified: trunk/info/infodoc.c
===================================================================
--- trunk/info/infodoc.c 2014-07-03 15:05:31 UTC (rev 5697)
+++ trunk/info/infodoc.c 2014-07-05 15:53:27 UTC (rev 5698)
@@ -400,11 +400,11 @@
for (win = windows; win; win = win->next)
{
- if (win->node && win->node->filename &&
- (mbscasecmp
- (filename_non_directory (win->node->filename), "info") == 0) &&
- ((strcmp (win->node->nodename, "Help") == 0) ||
- (strcmp (win->node->nodename, "Help-Small-Screen") == 0)))
+ if (win->node && win->node->fullpath
+ && !mbscasecmp ("info",
+ filename_non_directory (win->node->fullpath))
+ && (!strcmp (win->node->nodename, "Help")
+ || !strcmp (win->node->nodename, "Help-Small-Screen")))
{
active_window = win;
return;
Modified: trunk/info/man.c
===================================================================
--- trunk/info/man.c 2014-07-03 15:05:31 UTC (rev 5697)
+++ trunk/info/man.c 2014-07-05 15:53:27 UTC (rev 5698)
@@ -81,7 +81,7 @@
if (!tag)
{
tag = info_create_node ();
- tag->filename = MANPAGE_FILE_BUFFER_NAME;
+ tag->fullpath = MANPAGE_FILE_BUFFER_NAME;
tag->nodename = xstrdup (pagename);
tag->flags |= (N_HasTagsTable | N_IsManPage);
Modified: trunk/info/nodemenu.c
===================================================================
--- trunk/info/nodemenu.c 2014-07-03 15:05:31 UTC (rev 5697)
+++ trunk/info/nodemenu.c 2014-07-05 15:53:27 UTC (rev 5698)
@@ -47,45 +47,29 @@
format_node_info (NODE *node)
{
register int i, len;
- char *parent, *containing_file;
- static char *line_buffer = NULL;
+ char *containing_file;
+ static struct text_buffer line_buffer = {};
- if (!line_buffer)
- line_buffer = xmalloc (1000);
+ if (!text_buffer_base (&line_buffer))
+ text_buffer_init (&line_buffer);
+ else
+ text_buffer_reset (&line_buffer);
- if (node->parent)
- {
- parent = filename_non_directory (node->parent);
- if (!parent)
- parent = node->parent;
- }
+ if (node->subfile)
+ containing_file = node->subfile;
else
- parent = NULL;
+ containing_file = node->fullpath;
- containing_file = node->filename;
-
- if (!parent && !*containing_file)
- sprintf (line_buffer, "* %s::", node->nodename);
+ if (!containing_file || !*containing_file)
+ text_buffer_printf (&line_buffer, "* %s::", node->nodename);
else
- {
- char *file = NULL;
+ text_buffer_printf (&line_buffer, "* (%s)%s::",
+ filename_non_directory (node->fullpath),
+ node->nodename);
- if (parent)
- file = parent;
- else
- file = filename_non_directory (containing_file);
+ for (i = text_buffer_off (&line_buffer); i < 36; i++)
+ text_buffer_add_char (&line_buffer, ' ');
- if (!file)
- file = containing_file;
-
- if (!*file)
- file = "dir";
-
- sprintf (line_buffer, "* (%s)%s::", file, node->nodename);
- }
-
- len = pad_to (36, line_buffer);
-
{
int lines = 1;
@@ -93,19 +77,22 @@
if (node->contents[i] == '\n')
lines++;
- sprintf (line_buffer + len, "%d", lines);
+ text_buffer_printf (&line_buffer, "%d", lines);
}
- len = pad_to (44, line_buffer);
- sprintf (line_buffer + len, "%ld", node->nodelen);
+ text_buffer_add_char (&line_buffer, ' ');
+ for (i = text_buffer_off (&line_buffer); i < 44; i++)
+ text_buffer_add_char (&line_buffer, ' ');
+ text_buffer_printf (&line_buffer, "%ld", node->nodelen);
- if (node->filename && *(node->filename))
+ if (containing_file)
{
- len = pad_to (51, line_buffer);
- strcpy (line_buffer + len, node->filename);
+ for (i = text_buffer_off (&line_buffer); i < 51; i++)
+ text_buffer_add_char (&line_buffer, ' ');
+ text_buffer_printf (&line_buffer, containing_file);
}
- return xstrdup (line_buffer);
+ return xstrdup (text_buffer_base (&line_buffer));
}
/* Little string comparison routine for qsort (). */
Modified: trunk/info/nodes.c
===================================================================
--- trunk/info/nodes.c 2014-07-03 15:05:31 UTC (rev 5697)
+++ trunk/info/nodes.c 2014-07-05 15:53:27 UTC (rev 5698)
@@ -165,12 +165,10 @@
if (fb->flags & N_HasTagsTable)
{
entry->flags |= N_HasTagsTable;
+ entry->fullpath = fb->fullpath;
if (fb->flags & N_TagsIndirect)
- {
- entry->flags |= N_TagsIndirect;
- entry->parent = fb->fullpath;
- }
+ entry->flags |= N_TagsIndirect;
}
}
@@ -234,7 +232,7 @@
/* Record that the length is unknown. */
entry->nodelen = -1;
- entry->filename = file_buffer->fullpath;
+ entry->fullpath = file_buffer->fullpath;
/* Add this tag to the array of tag structures in this FILE_BUFFER. */
add_pointer_to_array (entry, tags_index, file_buffer->tags,
@@ -331,7 +329,7 @@
/* The filename of this node is currently known as the same as the
name of this file. */
- entry->filename = file_buffer->filename;
+ entry->fullpath = file_buffer->fullpath;
/* Add this node structure to the array of node structures in this
FILE_BUFFER. */
@@ -498,7 +496,7 @@
starting position. This means that the subfile directly
preceding this one is the one containing the node. */
- entry->filename = file_buffer->subfiles[i - 1];
+ entry->subfile = file_buffer->subfiles[i - 1];
entry->nodestart -= subfiles[i - 1]->first_byte;
entry->nodestart += header_length;
}
@@ -666,7 +664,7 @@
if (!fullpath)
return NULL;
- file_buffer = info_load_file (fullpath, 1);
+ file_buffer = info_load_file (fullpath, 0);
return file_buffer;
}
@@ -708,19 +706,19 @@
with_extension = info_find_fullpath (fullpath, 0);
if (with_extension)
{
- file_buffer = info_load_file (with_extension, 0);
+ file_buffer = info_load_file (with_extension, 1);
free (with_extension);
}
return file_buffer;
}
/* Load the file with path FULLPATH, and return the information structure
- describing this file, even if the file was already loaded. Non-zero
- second argument says to build a list of tags (or nodes) for this file.
- This is not necessary when loading a subfile for which we already have
- tags. */
+ describing this file, even if the file was already loaded. IS_SUBFILE
+ says whether this file is the subfile of a split file. If it is, mark
+ the FILE_BUFFER object as such and do not build a list of nodes for
+ this file. */
static FILE_BUFFER *
-info_load_file (char *fullpath, int get_tags)
+info_load_file (char *fullpath, int is_subfile)
{
char *contents;
size_t filesize;
@@ -747,9 +745,10 @@
/* Find encoding of file, if set */
get_file_character_encoding (file_buffer);
- /* If requested, build the tags and nodes for this file buffer. */
- if (get_tags)
+ if (!is_subfile)
build_tags_and_nodes (file_buffer);
+ else
+ file_buffer->flags |= N_Subfile;
/* If the file was loaded, remember the name under which it was found. */
if (file_buffer)
@@ -893,8 +892,8 @@
{
NODE *n = xmalloc (sizeof (NODE));
- n->filename = 0;
- n->parent = 0;
+ n->fullpath = 0;
+ n->subfile = 0;
n->nodename = 0;
n->contents = 0;
n->nodelen = -1;
@@ -1019,11 +1018,7 @@
if (!*filename)
{
if (node)
- {
- *filename = node->parent;
- if (!*filename)
- *filename = node->filename;
- }
+ *filename = node->fullpath;
else
*filename = "dir";
}
@@ -1070,7 +1065,7 @@
if (strcmp (nodename, "*") == 0)
{
node = info_create_node ();
- node->filename = file_buffer->fullpath;
+ node->fullpath = file_buffer->fullpath;
node->nodename = xstrdup ("*");
node->contents = file_buffer->contents;
node->nodelen = file_buffer->filesize;
@@ -1185,10 +1180,11 @@
/* If not a split file, subfile == fb */
FILE_BUFFER *subfile;
- if (!strcmp (fb->filename, tag->filename))
+ if (!tag->subfile)
subfile = fb;
else
- subfile = info_find_subfile (tag->filename);
+ subfile = info_find_subfile (tag->subfile);
+
if (!subfile)
return NULL;
Modified: trunk/info/nodes.h
===================================================================
--- trunk/info/nodes.h 2014-07-03 15:05:31 UTC (rev 5697)
+++ trunk/info/nodes.h 2014-07-05 15:53:27 UTC (rev 5698)
@@ -49,8 +49,8 @@
paths, so you might have: node->filename = "/usr/gnu/info/emacs-1",
with node->parent = "/usr/gnu/info/emacs". */
typedef struct {
- char *filename; /* The physical file containing this node. */
- char *parent; /* Non-null is the logical file name. */
+ char *fullpath; /* Non-null is the logical file name. */
+ char *subfile; /* File containing node for split files. */
char *nodename; /* The name of this node. */
char *contents; /* Characters appearing in this node. */
long nodelen; /* The length of the CONTENTS member.
@@ -67,7 +67,7 @@
char *up, *prev, *next; /* Names of nearby nodes. */
} NODE;
-/* Defines that can appear in NODE->flags. All informative. */
+/* Values for NODE.flags or FILE_BUFFER.flags. */
#define N_HasTagsTable 0x01 /* This node was found through a tags table. */
#define N_TagsIndirect 0x02 /* The tags table was an indirect one. */
#define N_UpdateTags 0x04 /* The tags table is out of date. */
@@ -79,6 +79,7 @@
#define N_WasRewritten 0x100 /* NODE->contents can be passed to free(). */
#define N_IsIndex 0x200 /* An index node. */
#define N_IsDir 0x400 /* A dir node. */
+#define N_Subfile 0x800 /* File buffer is a subfile of a split file. */
/* String constants. */
#define INFO_FILE_LABEL "File:"
Modified: trunk/info/session.c
===================================================================
--- trunk/info/session.c 2014-07-03 15:05:31 UTC (rev 5697)
+++ trunk/info/session.c 2014-07-05 15:53:27 UTC (rev 5698)
@@ -1723,7 +1723,7 @@
{
NODE *p = window->hist[i]->node;
- if (p->filename && !strcmp (p->filename, node->filename)
+ if (p->fullpath && !strcmp (p->fullpath, node->fullpath)
&& p->nodename && !strcmp (p->nodename, node->nodename))
break;
}
@@ -2645,7 +2645,7 @@
REFERENCE *entry;
char *arg = *menus; /* Remember the name of the menu entry we want. */
- debug (3, ("looking for %s in %s:%s", arg, initial_node->filename,
+ debug (3, ("looking for %s in %s:%s", arg, initial_node->fullpath,
initial_node->nodename));
if (!initial_node->references)
@@ -2686,7 +2686,7 @@
return strict ? 0 : initial_node;
}
- debug (3, ("node: %s, %s", node->filename, node->nodename));
+ debug (3, ("node: %s, %s", node->fullpath, node->nodename));
/* Success. Go round the loop again. */
free (initial_node);
@@ -2752,14 +2752,8 @@
/* If DIR_NODE is NULL, they might be reading a file directly,
like in "info -d . -f ./foo". Try using "Top" instead. */
if (!dir_node)
- {
- char *file_name = window->node->parent;
+ dir_node = info_get_node (window->node->fullpath, 0);
- if (!file_name)
- file_name = window->node->filename;
- dir_node = info_get_node (file_name, 0);
- }
-
/* If we still cannot find the starting point, give up. */
if (!dir_node)
info_error (msg_cant_find_node, "Top");
@@ -2792,10 +2786,9 @@
{
char *rep;
- if (node->filename)
+ if (node->fullpath)
{
- char *filename
- = filename_non_directory (node->parent ? node->parent : node->filename);
+ char *filename = filename_non_directory (node->fullpath);
rep = xmalloc (1 + strlen (filename) + 1 + strlen (node->nodename) + 1);
sprintf (rep, "(%s)%s", filename, node->nodename);
}
@@ -2957,8 +2950,8 @@
/* Go down into menu, and repeat. */
if (!entry->filename)
- entry->filename = xstrdup (initial_node->parent ? initial_node->parent
- : initial_node->filename);
+ entry->filename = xstrdup (initial_node->fullpath);
+
/* Try to find this node. */
node = info_get_node (entry->filename, entry->nodename);
if (!node)
@@ -3002,8 +2995,7 @@
/* Intuit the name of the program they are likely to want.
We use the file name of the current Info file as a hint. */
- file_name = window->node->parent ? window->node->parent
- : window->node->filename;
+ file_name = window->node->fullpath;
default_program_name = program_name_from_file_name (file_name);
prompt = xmalloc (strlen (default_program_name) +
@@ -3080,15 +3072,13 @@
DECLARE_INFO_COMMAND (info_display_file_info,
_("Show full file name of node being displayed"))
{
- char *fname = info_find_fullpath (window->node->filename, 0);
- if (fname)
+ if (window->node->fullpath && *window->node->fullpath)
{
int line = window_line_of_point (window);
window_message_in_echo_area ("File name: %s, line %d of %ld (%ld%%)",
- fname, line,
- window->line_count,
+ window->node->fullpath,
+ line, window->line_count,
line * 100 / window->line_count);
- free (fname);
}
else
window_message_in_echo_area ("Internal node");
@@ -3384,12 +3374,9 @@
if (!window->node)
return NULL;
- if (window->node->parent)
- return info_find_file (window->node->parent);
+ if (window->node->fullpath)
+ return info_find_file (window->node->fullpath);
- if (window->node->filename)
- return info_find_file (window->node->filename);
-
return NULL;
}
@@ -3585,29 +3572,26 @@
if (!file_buffer || (strcmp (initial_nodename, "*") == 0))
return -1;
- /* If this file has tags, search through every subfile, starting at
- this node's subfile and node. Otherwise, search through the
- file's node list. */
+ /* Search through this file's node list. */
if (file_buffer->tags)
{
- register int current_tag = 0, number_of_tags;
- char *last_subfile;
+ register int current_tag = -1, number_of_tags;
+ char *subfile_name = 0;
NODE *tag;
char *msg = NULL;
/* Find number of tags and current tag. */
- last_subfile = NULL;
for (i = 0; file_buffer->tags[i]; i++)
if (strcmp (initial_nodename, file_buffer->tags[i]->nodename) == 0)
{
current_tag = i;
- last_subfile = file_buffer->tags[i]->filename;
+ subfile_name = file_buffer->tags[i]->subfile;
}
number_of_tags = i;
- /* If there is no last_subfile, our tag wasn't found. */
- if (!last_subfile)
+ /* Our tag wasn't found. */
+ if (current_tag == -1)
return -1;
/* Search through subsequent nodes, wrapping around to the top
@@ -3646,13 +3630,14 @@
return -1;
current_tag = i;
- if (!echo_area_is_active && (last_subfile != tag->filename))
+ /* Display message when searching a new subfile. */
+ if (!echo_area_is_active && tag->subfile != subfile_name)
{
window_message_in_echo_area
(_("Searching subfile %s ..."),
- filename_non_directory (tag->filename));
+ filename_non_directory (tag->subfile));
- last_subfile = tag->filename;
+ subfile_name = tag->subfile;
}
node = info_get_node (file_buffer->filename, tag->nodename);
@@ -4384,10 +4369,9 @@
{
FILE_BUFFER *fb = info_loaded_files[fb_index];
- if (fb->flags & N_TagsIndirect)
+ if (fb->flags & N_Subfile)
{
- if (n->parent
- && (FILENAME_CMP (fb->fullpath, n->parent) == 0))
+ if (n->subfile && !FILENAME_CMP (fb->fullpath, n->subfile))
{
fb_referenced[fb_index] = 1;
break;
@@ -4395,19 +4379,12 @@
}
else
{
- /* Check both 'fullpath' and 'filename'. TODO: Make sure
- that the 'filename' field of NODE contains the full path,
- or have some other way of telling different files with
- the same name apart. */
- if (n->filename
- && (FILENAME_CMP (fb->fullpath, n->filename) == 0
- || (FILENAME_CMP (fb->filename, n->filename) == 0)))
+ if (n->fullpath && !FILENAME_CMP (fb->fullpath, n->fullpath))
{
fb_referenced[fb_index] = 1;
break;
}
}
-
}
/* Loop over gcable_pointers. */
Modified: trunk/info/window.c
===================================================================
--- trunk/info/window.c 2014-07-03 15:05:31 UTC (rev 5697)
+++ trunk/info/window.c 2014-07-05 15:53:27 UTC (rev 5698)
@@ -924,14 +924,17 @@
if (node->nodename)
nodename = node->nodename;
- if (node->parent)
+ if (node->subfile)
{
- parent = filename_non_directory (node->parent);
+ parent = filename_non_directory (node->fullpath);
+ filename = filename_non_directory (node->subfile);
}
+ else
+ {
+ parent = 0;
+ filename = filename_non_directory (node->fullpath);
+ }
- if (node->filename)
- filename = filename_non_directory (node->filename);
-
if (node->flags & N_UpdateTags)
update_message = _("--*** Tags out of Date ***");
}
@@ -941,7 +944,7 @@
char *name;
int dot;
- name = parent ? parent : filename ? filename : 0;
+ name = filename_non_directory (node->fullpath);
modeline_len += strlen ("--() --");
modeline_len += 3; /* strlen (location_indicator) */
@@ -966,8 +969,8 @@
}
else
{
- if (node && node->parent)
- modeline_len += strlen ("Subfile: ") + strlen (node->filename);
+ if (node && node->subfile)
+ modeline_len += strlen ("Subfile: ") + strlen (node->subfile);
if (update_message)
modeline_len += strlen (update_message);
@@ -983,7 +986,7 @@
modeline = xmalloc (1 + modeline_len);
/* Special internal windows have no filename. */
- if (!parent && !*filename)
+ if (!filename || !*filename)
sprintf (modeline, _("-%s---Info: %s, %ld lines --%s--"),
(window->flags & W_NoWrap) ? "$" : "-",
nodename, window->line_count, location_indicator);
@@ -993,7 +996,7 @@
(node && (node->flags & N_IsCompressed)) ? "zz" : "--",
parent ? parent : filename,
nodename, window->line_count, location_indicator);
- if (parent)
+ if (node->subfile)
sprintf (modeline + strlen (modeline), _(" Subfile: %s"), filename);
if (update_message)
@@ -1183,26 +1186,6 @@
return node;
}
-/* Pad STRING to COUNT characters by inserting blanks. */
-int
-pad_to (int count, char *string)
-{
- register int i;
-
- i = strlen (string);
-
- if (i >= count)
- string[i++] = ' ';
- else
- {
- while (i < count)
- string[i++] = ' ';
- }
- string[i] = '\0';
-
- return i;
-}
-
/* If ITER points to an info tag, set PLEN to its length in bytes and
return 1. Otherwise, return 0.
Modified: trunk/info/window.h
===================================================================
--- trunk/info/window.h 2014-07-03 15:05:31 UTC (rev 5697)
+++ trunk/info/window.h 2014-07-05 15:53:27 UTC (rev 5698)
@@ -193,9 +193,6 @@
struct text_buffer;
extern NODE *text_buffer_to_node (struct text_buffer *tb);
-/* Pad STRING to COUNT characters by inserting blanks. */
-extern int pad_to (int count, char *string);
-
/* Make a message appear in the echo area, built from arguments formatted
according to FORMAT.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [5698] filename, parent fields of NODE changed,
Gavin D. Smith <=