/* (re) Initialize the echo area node. */ static void echo_area_initialize_node (void) { register int i; for (i = input_line_end; (unsigned int) i < sizeof (input_line); i++) input_line[i] = ' '; input_line[i - 1] = '\n'; window_set_node_of_window (the_echo_area, &input_line_node); input_line[input_line_end] = '\n'; }
/* Create or delete the footnotes window depending on whether footnotes exist in WINDOW's node or not. Returns FN_FOUND if footnotes were found and displayed. Returns FN_UNFOUND if there were no footnotes found in WINDOW's node. Returns FN_UNABLE if there were footnotes, but the window to show them couldn't be made. */ int info_get_or_remove_footnotes (WINDOW *window) { WINDOW *fn_win; NODE *new_footnotes; fn_win = find_footnotes_window (); /* If we are in the footnotes window, change nothing. */ if (fn_win == window) return (FN_FOUND); /* Try to find footnotes for this window's node. */ new_footnotes = make_footnotes_node (window->node); /* If there was a window showing footnotes, and there are no footnotes for the current window, delete the old footnote window. */ if (fn_win && !new_footnotes) { if (windows->next) info_delete_window_internal (fn_win); } /* If there are footnotes for this window's node, but no window around showing footnotes, try to make a new window. */ if (new_footnotes && !fn_win) { WINDOW *old_active; WINDOW *last, *win; /* Always make this window be the last one appearing in the list. Find the last window in the chain. */ for (win = windows, last = windows; win; last = win, win = win->next); /* Try to split this window, and make the split window the one to contain the footnotes. */ old_active = active_window; active_window = last; fn_win = window_make_window (new_footnotes); active_window = old_active; if (!fn_win) { free (new_footnotes->contents); free (new_footnotes); /* If we are hacking automatic footnotes, and there are footnotes but we couldn't display them, print a message to that effect. */ if (auto_footnotes_p) inform_in_echo_area ((char *) _("Footnotes could not be displayed")); return (FN_UNABLE); } } /* If there are footnotes, and there is a window to display them, make that window be the number of lines appearing in the footnotes. */ if (new_footnotes && fn_win) { window_set_node_of_window (fn_win, new_footnotes); window_change_window_height (fn_win, fn_win->line_count - fn_win->height); remember_window_and_node (fn_win, new_footnotes); add_gcable_pointer (new_footnotes->contents); } if (!new_footnotes) return (FN_UNFOUND); else return (FN_FOUND); }
/* Restore the caller's window so that it shows the node that it was showing on entry to info_read_xxx_echo_area (). */ static void restore_calling_window (void) { register WINDOW *win, *compwin = NULL; /* If the calling window is still visible, and it is the window that we used for completions output, then restore the calling window. */ for (win = windows; win; win = win->next) { if (completions_window_p (win)) compwin = win; if (win == calling_window && win == compwin) { window_set_node_of_window (calling_window, calling_window_node); calling_window->point = calling_window_point; calling_window->pagetop = calling_window_pagetop; compwin = NULL; break; } } /* Delete the completions window if it is still present, it isn't the last window on the screen, and there aren't any prior echo area reads pending which created a completions window. */ if (compwin) { if ((compwin != windows || windows->next) && !echo_area_stack_contains_completions_p ()) { WINDOW *next; int pagetop = 0; int start = 0; int end = 0; int amount = 0; next = compwin->next; if (next) { start = next->first_row; end = start + next->height; amount = - (compwin->height + 1); pagetop = next->pagetop; } info_delete_window_internal (compwin); /* This is not necessary because info_delete_window_internal () calls echo_area_inform_of_deleted_window (), which does the right thing. */ #if defined (UNNECESSARY) echo_area_completions_window = NULL; #endif /* UNNECESSARY */ if (next) { display_scroll_display (start, end, amount); next->pagetop = pagetop; display_update_display (windows); } } } }
static WINDOW * info_find_or_create_help_window (void) { int help_is_only_window_p; WINDOW *eligible = NULL; WINDOW *help_window = get_window_of_node (internal_info_help_node); /* If we couldn't find the help window, then make it. */ if (!help_window) { WINDOW *window; int max = 0; for (window = windows; window; window = window->next) { if (window->height > max) { max = window->height; eligible = window; } } if (!eligible) return NULL; } #ifndef HELP_NODE_GETS_REGENERATED else /* help window is static, just return it. */ return help_window; #endif /* not HELP_NODE_GETS_REGENERATED */ /* Make sure that we have a node containing the help text. The argument is false if help will be the only window (so l must be used to quit help), true if help will be one of several visible windows (so CTRL-x 0 must be used to quit help). */ help_is_only_window_p = ((help_window && !windows->next) || (!help_window && eligible->height < HELP_SPLIT_SIZE)); create_internal_info_help_node (help_is_only_window_p); /* Either use the existing window to display the help node, or create a new window if there was no existing help window. */ if (!help_window) { /* Split the largest window into 2 windows, and show the help text in that window. */ if (eligible->height >= HELP_SPLIT_SIZE) { active_window = eligible; help_window = window_make_window (internal_info_help_node); } else { set_remembered_pagetop_and_point (active_window); window_set_node_of_window (active_window, internal_info_help_node); help_window = active_window; } } else { /* Case where help node always gets regenerated, and we have an existing window in which to place the node. */ if (active_window != help_window) { set_remembered_pagetop_and_point (active_window); active_window = help_window; } window_set_node_of_window (active_window, internal_info_help_node); } remember_window_and_node (help_window, help_window->node); return help_window; }