📄 session.c
字号:
if (!internal_info_node_p (iw->nodes[j])) { if (iw->nodes[j]->parent) filename = iw->nodes[j]->parent; else filename = iw->nodes[j]->filename; node = info_get_node (filename, iw->nodes[j]->nodename); if (node) { window_set_node_of_window (split, node); i = info_windows_index - 1; break; } } } } split->pagetop = window->pagetop; if (auto_tiling_p) window_tile_windows (DONT_TILE_INTERNALS); else window_adjust_pagetop (split); remember_window_and_node (split, split->node); }}/* Delete WINDOW, forgetting the list of last visited nodes. If we are automatically displaying footnotes, show or remove the footnotes window. If we are automatically tiling windows, re-tile after the deletion. */DECLARE_INFO_COMMAND (info_delete_window, _("Delete the current window")){ if (!windows->next) { info_error (CANT_KILL_LAST); } else if (window->flags & W_WindowIsPerm) { info_error (_("Cannot delete a permanent window")); } else { info_delete_window_internal (window); if (auto_footnotes_p) info_get_or_remove_footnotes (active_window); if (auto_tiling_p) window_tile_windows (DONT_TILE_INTERNALS); }}/* Do the physical deletion of WINDOW, and forget this window and associated nodes. */voidinfo_delete_window_internal (window) WINDOW *window;{ if (windows->next && ((window->flags & W_WindowIsPerm) == 0)) { /* We not only delete the window from the display, we forget it from our list of remembered windows. */ forget_window_and_nodes (window); window_delete_window (window); if (echo_area_is_active) echo_area_inform_of_deleted_window (window); }}/* Just keep WINDOW, deleting all others. */DECLARE_INFO_COMMAND (info_keep_one_window, _("Delete all other windows")){ int num_deleted; /* The number of windows we deleted. */ int pagetop, start, end; /* Remember a few things about this window. We may be able to speed up redisplay later by scrolling its contents. */ pagetop = window->pagetop; start = window->first_row; end = start + window->height; num_deleted = 0; while (1) { WINDOW *win; /* Find an eligible window and delete it. If no eligible windows are found, we are done. A window is eligible for deletion if is it not permanent, and it is not WINDOW. */ for (win = windows; win; win = win->next) if (win != window && ((win->flags & W_WindowIsPerm) == 0)) break; if (!win) break; info_delete_window_internal (win); num_deleted++; } /* Scroll the contents of this window into the right place so that the user doesn't have to wait any longer than necessary for redisplay. */ if (num_deleted) { int amount; amount = (window->first_row - start); amount -= (window->pagetop - pagetop); display_scroll_display (start, end, amount); } window->flags |= W_UpdateWindow;}/* Scroll the "other" window of WINDOW. */DECLARE_INFO_COMMAND (info_scroll_other_window, _("Scroll the other window")){ WINDOW *other; /* If only one window, give up. */ if (!windows->next) { info_error (ONE_WINDOW); return; } other = window->next; if (!other) other = window->prev; info_scroll_forward (other, count, key);}/* Change the size of WINDOW by AMOUNT. */DECLARE_INFO_COMMAND (info_grow_window, _("Grow (or shrink) this window")){ window_change_window_height (window, count);}/* When non-zero, tiling takes place automatically when info_split_window is called. */int auto_tiling_p = 0;/* Tile all of the visible windows. */DECLARE_INFO_COMMAND (info_tile_windows, _("Divide the available screen space among the visible windows")){ window_tile_windows (TILE_INTERNALS);}/* Toggle the state of this window's wrapping of lines. */DECLARE_INFO_COMMAND (info_toggle_wrap, _("Toggle the state of line wrapping in the current window")){ window_toggle_wrap (window);}/* **************************************************************** *//* *//* Info Node Commands *//* *//* **************************************************************** *//* Using WINDOW for various defaults, select the node referenced by ENTRY in it. If the node is selected, the window and node are remembered. */voidinfo_select_reference (window, entry) WINDOW *window; REFERENCE *entry;{ NODE *node; char *filename, *nodename, *file_system_error; file_system_error = (char *)NULL; filename = entry->filename; if (!filename) filename = window->node->parent; if (!filename) filename = window->node->filename; if (filename) filename = xstrdup (filename); if (entry->nodename) nodename = xstrdup (entry->nodename); else nodename = xstrdup ("Top"); node = info_get_node (filename, nodename); /* Try something a little weird. If the node couldn't be found, and the reference was of the form "foo::", see if the entry->label can be found as a file, with a node of "Top". */ if (!node) { if (info_recent_file_error) file_system_error = xstrdup (info_recent_file_error); if (entry->nodename && (strcmp (entry->nodename, entry->label) == 0)) { node = info_get_node (entry->label, "Top"); if (!node && info_recent_file_error) { maybe_free (file_system_error); file_system_error = xstrdup (info_recent_file_error); } } } if (!node) { if (file_system_error) info_error (file_system_error); else info_error (CANT_FIND_NODE, nodename); } maybe_free (file_system_error); maybe_free (filename); maybe_free (nodename); if (node) { set_remembered_pagetop_and_point (window); info_set_node_of_window (window, node); }}/* Parse the node specification in LINE using WINDOW to default the filename. Select the parsed node in WINDOW and remember it, or error if the node couldn't be found. */static voidinfo_parse_and_select (line, window) char *line; WINDOW *window;{ REFERENCE entry; info_parse_node (line, DONT_SKIP_NEWLINES); entry.nodename = info_parsed_nodename; entry.filename = info_parsed_filename; entry.label = "*info-parse-and-select*"; info_select_reference (window, &entry);}/* Given that the values of INFO_PARSED_FILENAME and INFO_PARSED_NODENAME are previously filled, try to get the node represented by them into WINDOW. The node should have been pointed to by the LABEL pointer of WINDOW->node. */static voidinfo_handle_pointer (label, window) char *label; WINDOW *window;{ if (info_parsed_filename || info_parsed_nodename) { char *filename, *nodename; NODE *node; filename = nodename = (char *)NULL; if (info_parsed_filename) filename = xstrdup (info_parsed_filename); else { if (window->node->parent) filename = xstrdup (window->node->parent); else if (window->node->filename) filename = xstrdup (window->node->filename); } if (info_parsed_nodename) nodename = xstrdup (info_parsed_nodename); else nodename = xstrdup ("Top"); node = info_get_node (filename, nodename); if (node) { INFO_WINDOW *info_win; info_win = get_info_window_of_window (window); if (info_win) { info_win->pagetops[info_win->current] = window->pagetop; info_win->points[info_win->current] = window->point; } set_remembered_pagetop_and_point (window); info_set_node_of_window (window, node); } else { if (info_recent_file_error) info_error (info_recent_file_error); else info_error (CANT_FILE_NODE, filename, nodename); } free (filename); free (nodename); } else { info_error (NO_POINTER, label); }}/* Make WINDOW display the "Next:" node of the node currently being displayed. */DECLARE_INFO_COMMAND (info_next_node, _("Select the `Next' node")){ info_next_label_of_node (window->node); info_handle_pointer (_("Next"), window);}/* Make WINDOW display the "Prev:" node of the node currently being displayed. */DECLARE_INFO_COMMAND (info_prev_node, _("Select the `Prev' node")){ info_prev_label_of_node (window->node); info_handle_pointer (_("Prev"), window);}/* Make WINDOW display the "Up:" node of the node currently being displayed. */DECLARE_INFO_COMMAND (info_up_node, _("Select the `Up' node")){ info_up_label_of_node (window->node); info_handle_pointer (_("Up"), window);}/* Make WINDOW display the last node of this info file. */DECLARE_INFO_COMMAND (info_last_node, _("Select the last node in this file")){ register int i; FILE_BUFFER *fb = file_buffer_of_window (window); NODE *node = (NODE *)NULL; if (fb && fb->tags) { for (i = 0; fb->tags[i]; i++); node = info_get_node (fb->filename, fb->tags[i - 1]->nodename); } if (!node) info_error (_("This window has no additional nodes")); else { set_remembered_pagetop_and_point (window); info_set_node_of_window (window, node); }}/* Make WINDOW display the first node of this info file. */DECLARE_INFO_COMMAND (info_first_node, _("Select the first node in this file")){ FILE_BUFFER *fb = file_buffer_of_window (window); NODE *node = (NODE *)NULL; if (fb && fb->tags) node = info_get_node (fb->filename, fb->tags[0]->nodename); if (!node) info_error (_("This window has no additional nodes")); else { set_remembered_pagetop_and_point (window); info_set_node_of_window (window, node); }}/* Select the last menu item in WINDOW->node. */DECLARE_INFO_COMMAND (info_last_menu_item, _("Select the last item in this node's menu")){ info_menu_digit (window, 1, '0');}/* Use KEY (a digit) to select the Nth menu item in WINDOW->node. */DECLARE_INFO_COMMAND (info_menu_digit, _("Select this menu item")){ register int i, item; register REFERENCE *entry, **menu; menu = info_menu_of_node (window->node); if (!menu) { info_error (NO_MENU_NODE); return; } /* We have the menu. See if there are this many items in it. */ item = key - '0'; /* Special case. Item "0" is the last item in this menu. */ if (item == 0) for (i = 0; menu[i + 1]; i++); else { for (i = 0; (entry = menu[i]); i++) if (i == item - 1) break; } if (menu[i]) info_select_reference (window, menu[i]); else info_error (_("There aren't %d items in this menu."), item); info_free_references (menu); return;}/* Read a menu or followed reference from the user defaulting to the reference found on the current line, and select that node. The reading is done with completion. BUILDER is the function used to build the list of references. ASK_P is non-zero if the user should be prompted, or zero to select the default item. */static voidinfo_menu_or_ref_item (window, count, key, builder, ask_p) WINDOW *window; int count; unsigned char key; REFERENCE **(*builder) (); int ask_p;{ REFERENCE **menu, *entry, *defentry = (REFERENCE *)NULL; char *line; menu = (*builder) (window->node); if (!menu) { if (builder == info_menu_of_node) info_error (NO_MENU_NODE); else info_error (NO_XREF_NODE); return; } /* Default the selected reference to the one which is on the line that point is in. */ { REFERENCE **refs = (REFERENCE **)NULL; int point_line; point_line = window_line_of_point (window); if (point_line != -1) { SEARCH_BINDING binding; binding.buffer = window->node->contents; binding.start = window->line_starts[point_line] - binding.buffer; if (window->line_starts[point_line + 1])
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -