📄 session.c
字号:
/* Okay, there wasn't a "Next:" for this node. Move "Up:" until we can move "Next:". If that isn't possible, complain that there are no more nodes. */ { int up_counter, old_current; INFO_WINDOW *info_win; /* Remember the current node and location. */ info_win = get_info_window_of_window (window); old_current = info_win->current; /* Back up through the "Up:" pointers until we have found a "Next:" that isn't the same as the first menu item found in that node. */ up_counter = 0; while (!info_error_was_printed) { info_up_label_of_node (window->node); if (info_label_was_found) { info_handle_pointer (_("Up"), window); if (info_error_was_printed) continue; up_counter++; info_next_label_of_node (window->node); /* If no "Next" pointer, keep backing up. */ if (!info_label_was_found) continue; /* If this node's first menu item is the same as this node's Next pointer, keep backing up. */ if (!info_parsed_filename) { REFERENCE **menu; char *next_nodename; /* Remember the name of the Next node, since reading the menu can overwrite the contents of the info_parsed_xxx strings. */ next_nodename = xstrdup (info_parsed_nodename); menu = info_menu_of_node (window->node); if (menu && (strcmp (menu[0]->nodename, next_nodename) == 0)) { info_free_references (menu); free (next_nodename); continue; } else { /* Restore the world to where it was before reading the menu contents. */ info_free_references (menu); free (next_nodename); info_next_label_of_node (window->node); } } /* This node has a "Next" pointer, and it is not the same as the first menu item found in this node. */ window_message_in_echo_area ("Moving \"Up\" %s, then \"Next\".", times_description (up_counter)); info_handle_pointer (_("Next"), window); return; } else { /* No more "Up" pointers. Print an error, and call it quits. */ register int i; for (i = 0; i < up_counter; i++) { info_win->nodes_index--; free (info_win->nodes[info_win->nodes_index]); info_win->nodes[info_win->nodes_index] = (NODE *)NULL; } info_win->current = old_current; window->node = info_win->nodes[old_current]; window->pagetop = info_win->pagetops[old_current]; window->point = info_win->points[old_current]; recalculate_line_starts (window); window->flags |= W_UpdateWindow; info_error (_("No more nodes.")); } } } break; } }}/* Move Prev, Up or error in WINDOW depending on BEHAVIOUR. */static voidbackward_move_node_structure (window, behaviour) WINDOW *window; int behaviour;{ switch (behaviour) { case IS_PageOnly: info_error (AT_NODE_TOP); break; case IS_NextOnly: info_prev_label_of_node (window->node); if (!info_parsed_nodename && !info_parsed_filename) info_error (_("No \"Prev\" for this node.")); else { window_message_in_echo_area (_("Moving \"Prev\" in this window.")); info_handle_pointer (_("Prev"), window); } break; case IS_Continuous: info_prev_label_of_node (window->node); if (!info_parsed_nodename && !info_parsed_filename) { info_up_label_of_node (window->node); if (!info_parsed_nodename && !info_parsed_filename) info_error (_("No \"Prev\" or \"Up\" for this node.")); else { window_message_in_echo_area (_("Moving \"Up\" in this window.")); info_handle_pointer (_("Up"), window); } } else { REFERENCE **menu; int inhibit_menu_traversing = 0; /* Watch out! If this node's Prev is the same as the Up, then move Up. Otherwise, we could move Prev, and then to the last menu item in the Prev. This would cause the user to loop through a subsection of the info file. */ if (!info_parsed_filename && info_parsed_nodename) { char *pnode; pnode = xstrdup (info_parsed_nodename); info_up_label_of_node (window->node); if (!info_parsed_filename && info_parsed_nodename && strcmp (info_parsed_nodename, pnode) == 0) { /* The nodes are the same. Inhibit moving to the last menu item. */ free (pnode); inhibit_menu_traversing = 1; } else { free (pnode); info_prev_label_of_node (window->node); } } /* Move to the previous node. If this node now contains a menu, and we have not inhibited movement to it, move to the node corresponding to the last menu item. */ window_message_in_echo_area (_("Moving \"Prev\" in this window.")); info_handle_pointer (_("Prev"), window); if (!inhibit_menu_traversing) { while (!info_error_was_printed && (menu = info_menu_of_node (window->node))) { info_free_references (menu); window_message_in_echo_area (_("Moving to \"Prev\"'s last menu item.")); info_menu_digit (window, 1, '0'); } } } break; }}/* Move continuously forward through the node structure of this info file. */DECLARE_INFO_COMMAND (info_global_next_node, _("Move forwards or down through node structure")){ if (count < 0) info_global_prev_node (window, -count, key); else { while (count && !info_error_was_printed) { forward_move_node_structure (window, IS_Continuous); count--; } }}/* Move continuously backward through the node structure of this info file. */DECLARE_INFO_COMMAND (info_global_prev_node, _("Move backwards or up through node structure")){ if (count < 0) info_global_next_node (window, -count, key); else { while (count && !info_error_was_printed) { backward_move_node_structure (window, IS_Continuous); count--; } }}/* Show the next screen of WINDOW's node. */DECLARE_INFO_COMMAND (info_scroll_forward, _("Scroll forward in this window")){ if (count < 0) info_scroll_backward (window, -count, key); else { int desired_top; /* Without an explicit numeric argument, scroll the bottom two lines to the top of this window, Or, if at bottom of window, and the user wishes to scroll through nodes get the "Next" node for this window. */ if (!info_explicit_arg && count == 1) { desired_top = window->pagetop + (window->height - 2); /* If there are no more lines to scroll here, error, or get another node, depending on INFO_SCROLL_BEHAVIOUR. */ if (desired_top > window->line_count) { int behaviour = info_scroll_behaviour; /* Here is a hack. If the key being used is not SPC, do the PageOnly behaviour. */ if (key != SPC && key != DEL) behaviour = IS_PageOnly; forward_move_node_structure (window, behaviour); return; } } else desired_top = window->pagetop + count; if (desired_top >= window->line_count) desired_top = window->line_count - 2; if (window->pagetop > desired_top) return; else set_window_pagetop (window, desired_top); }}/* Show the previous screen of WINDOW's node. */DECLARE_INFO_COMMAND (info_scroll_backward, _("Scroll backward in this window")){ if (count < 0) info_scroll_forward (window, -count, key); else { int desired_top; /* Without an explicit numeric argument, scroll the top two lines to the bottom of this window, or move to the previous, or Up'th node. */ if (!info_explicit_arg && count == 1) { desired_top = window->pagetop - (window->height - 2); if ((desired_top < 0) && (window->pagetop == 0)) { int behaviour = info_scroll_behaviour; /* Same kind of hack as in info_scroll_forward. If the key used to invoke this command is not DEL, do only the PageOnly behaviour. */ if (key != DEL && key != SPC) behaviour = IS_PageOnly; backward_move_node_structure (window, behaviour); return; } } else desired_top = window->pagetop - count; if (desired_top < 0) desired_top = 0; set_window_pagetop (window, desired_top); }}/* Move to the beginning of the node. */DECLARE_INFO_COMMAND (info_beginning_of_node, _("Move to the start of this node")){ window->pagetop = window->point = 0; window->flags |= W_UpdateWindow;}/* Move to the end of the node. */DECLARE_INFO_COMMAND (info_end_of_node, _("Move to the end of this node")){ window->point = window->node->nodelen - 1; info_show_point (window);}/* **************************************************************** *//* *//* Commands for Manipulating Windows *//* *//* **************************************************************** *//* Make the next window in the chain be the active window. */DECLARE_INFO_COMMAND (info_next_window, _("Select the next window")){ if (count < 0) { info_prev_window (window, -count, key); return; } /* If no other window, error now. */ if (!windows->next && !echo_area_is_active) { info_error (ONE_WINDOW); return; } while (count--) { if (window->next) window = window->next; else { if (window == the_echo_area || !echo_area_is_active) window = windows; else window = the_echo_area; } } if (active_window != window) { if (auto_footnotes_p) info_get_or_remove_footnotes (window); window->flags |= W_UpdateWindow; active_window = window; }}/* Make the previous window in the chain be the active window. */DECLARE_INFO_COMMAND (info_prev_window, _("Select the previous window")){ if (count < 0) { info_next_window (window, -count, key); return; } /* Only one window? */ if (!windows->next && !echo_area_is_active) { info_error (ONE_WINDOW); return; } while (count--) { /* If we are in the echo area, or if the echo area isn't active and we are in the first window, find the last window in the chain. */ if (window == the_echo_area || (window == windows && !echo_area_is_active)) { register WINDOW *win, *last; for (win = windows; win; win = win->next) last = win; window = last; } else { if (window == windows) window = the_echo_area; else window = window->prev; } } if (active_window != window) { if (auto_footnotes_p) info_get_or_remove_footnotes (window); window->flags |= W_UpdateWindow; active_window = window; }}/* Split WINDOW into two windows, both showing the same node. If we are automatically tiling windows, re-tile after the split. */DECLARE_INFO_COMMAND (info_split_window, _("Split the current window")){ WINDOW *split, *old_active; int pagetop; /* Remember the current pagetop of the window being split. If it doesn't change, we can scroll its contents around after the split. */ pagetop = window->pagetop; /* Make the new window. */ old_active = active_window; active_window = window; split = window_make_window (window->node); active_window = old_active; if (!split) { info_error (WIN_TOO_SMALL); } else {#if defined (SPLIT_BEFORE_ACTIVE) /* Try to scroll the old window into its new postion. */ if (pagetop == window->pagetop) { int start, end, amount; start = split->first_row; end = start + window->height; amount = split->height + 1; display_scroll_display (start, end, amount); }#else /* !SPLIT_BEFORE_ACTIVE */ /* Make sure point still appears in the active window. */ info_show_point (window);#endif /* !SPLIT_BEFORE_ACTIVE */ /* If the window just split was one internal to Info, try to display something else in it. */ if (internal_info_node_p (split->node)) { register int i, j; INFO_WINDOW *iw; NODE *node = (NODE *)NULL; char *filename; for (i = 0; (iw = info_windows[i]); i++) { for (j = 0; j < iw->nodes_index; j++)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -