Library
Documentation for TerminalPager.jl.
TerminalPager.Keystroke — Type
struct KeystrokeStructure that defines a keystroke.
Fields
raw::String: Raw keystroke code converted to string.value::String: String representing the keystroke.alt::Bool:trueif ALT key was pressed (only valid ifvalue != :char).ctrl::Bool:trueif CTRL key was pressed (only valid ifvalue != :char).shift::Bool:trueif SHIFT key was pressed (only valid ifvalue != :char).
TerminalPager._ascend — Method
_ascend(node::SyntaxNode) -> SyntaxNodeAscend to the most specific SyntaxNode containing all the information needed for @help.
TerminalPager._collaterate — Method
_collaterate(input::String, cursor_pos::Integer) -> IntegerBased on cursor position, collaterate (branch) to the intended token's index.
TerminalPager._descend — Method
_descend(node::SyntaxNode, search_index::Integer) -> SyntaxNodeDescend to the most specific syntax node containing search_index.
TerminalPager._extract_identifier — Method
_extract_identifier(input::AbstractString, cursor_pos::Integer) -> StringExtract identifier from the input line using the cursor position.
If the cursor is on an identifier (including module hierarchy like A.B.C) or on the character behind it, return that identifier. If the cursor is not on an identifier, but in the argument/parameter list of a valid callable, return the callable name.
Extraction works even for invalid (i.e. incomplete) input.
TerminalPager._help! — Method
_help!(pargerd::Pager) -> NothingOpen a new pager with the help.
TerminalPager._helpstring — Method
_helpstring(x::SyntaxNode) -> StringExtract the string from syntax node x to be provided for @help.
TerminalPager._jlgetch — Method
_jlgetch(stream::IO) -> KeystrokeWait for an keystroke in the stream stream and return it (see Keystroke).
TerminalPager._register_help_shortcuts — Method
_register_help_shortcuts(repl) -> NothingRegister the <Alt> + h and <F1> shortcuts in the REPL to show help for the identifier under the cursor.
TerminalPager._show_pager_extended_help — Method
_show_pager_extended_help(s, _, _) -> SymbolShow the pager extended help for the identifier under the cursor in the REPL.
TerminalPager._show_pager_help — Method
_show_pager_help(s, extended) -> SymbolShow either the regular or the extended pager help for the identifier under the cursor.
TerminalPager._show_pager_regular_help — Method
_show_pager_regular_help(s, _, _) -> SymbolShow the pager help for the identifier under the cursor in the REPL.
TerminalPager._tryparsestmt — Method
_tryparsestmt(x::String) -> SyntaxNodeTry to parse x into a SyntaxNode. If there are errors or warnings, they are ignored.
TerminalPager.debug_keycode — Method
debug_keycode() -> NothingDebug key codes.
TerminalPager.delete_keybinding — Method
delete_keybinding(key::Union{Char, Symbol}; kwargs...) -> NothingDelete the keybinding key. The modifiers keys can be selected using the keywords alt, ctrl, and shift.
For more information about how specify key see set_keybinding.
TerminalPager.drop_all_preferences! — Method
drop_all_preferences!()Drop all preferences.
Examples
julia> TerminalPager.drop_all_preference!()TerminalPager.drop_preference! — Method
drop_preference!(pref::String, value) -> NothingDrop the preference pref.
Examples
julia> TerminalPager.drop_preference!("visual_mode_line_background")TerminalPager.pager — Method
pager(obj; kwargs...)Call the pager to show the output of the object obj.
Keywords
auto::Bool: Iftrue, then the pager is only shown if the output does not fit into the display. (Default =false)change_freeze::Bool: Iftrue, then the user can change the number of frozen rows and columns inside the pager. (Default =true)frozen_columns::Int = 0: Number of columns to be frozen at startup. (Default = 0)frozen_rows::Int = 0: Number of rows to be frozen at startup. (Default = 0)hashelp::Bool = true: Iftrue, then the user can see the pager help. (Default =true)has_visual_mode::Bool = true: Iftrue, the user can use the visual mode. (Default =true)show_ruler::Bool: Iftrue, a vertical ruler is shown at the pager with the line numbers. (Default =false)use_alternate_screen_buffer::Bool: Iftrue, the pager will use the alternate screen buffer, which keeps the current screen when exiting the pager. Notice, however, that we use the XTerm escape sequences here. Hence, if your terminal is different, this option can lead to rendering problems.
Preferences
The user can defined custom preferences using the function TerminalPager.set_preference!. The available preferences are listed as follows:
"active_search_decoration":Stringwith the ANSI escape sequence to decorate the active search element. One can easily obtain this sequence by converting aCrayonto string. (Default =string(crayon"black bg:yellow"))"inactive_search_decoration":Stringwith the ANSI escape sequence to decorate the inactive search element. One can easily obtain this sequence by converting aCrayonto string. (Default =string(crayon"black bg:light_gray"))"always_use_alternate_screen_buffer_in_repl_mode": Iftrue, we will always use the alternate screen buffer when showing the pager in REPL mode. (Default = false)"block_alternate_screen_buffer": Iftrue, the alternate screen buffer support will be globally blocked, regardless of the keyword options. This modification is helpful when the terminal is not compatible with XTerm. (Default =false)"pager_mode": If it is "vi", some keywords are modified to match the behavior of Vi. Notice that this change only takes effect when a new Julia session is initialized. (Default = "default")"visual_mode_line_background":Stringwith the ANSI code of the background for the selected lines in the visual mode. (Default = "100")"visual_mode_active_line_background":Stringwith the ANSI code of the background for the active line in the visual mode. (Default = "44")
For more information, see: TerminalPager.set_preference!, TerminalPager.drop_preference!, and TerminalPager.drop_all_preferences!.
TerminalPager.reset_keybindings — Method
reset_keybindings() -> NothingReset key bindings to the original ones.
TerminalPager.set_keybinding — Method
set_keybinding(key::Union{Char, Symbol}, action::Symbol; kwargs...) -> NothingSet key binding key to the action action. The modifiers keys can be selected using the keywords alt, ctrl, and shift.
key can be a Char or a Symbol indicating one of the following special keys:
"<up>", "<down>", "<right>", "<left>", "<home>", "<end>", "<F1>", "<F2>",
"<F3>", "<F4>", "<F5>", "<F6>", "<F7>", "<F8>", "<F9>", "<F10>", "<F11>",
"<F12>", "<keypad_dot>", "<keypad_enter>", "<keypad_asterisk>",
"<keypad_plus>", "<keypad_minus>", "<keypad_slash>", "<keypad_equal>",
"<keypad_0>", "<keypad_1>", "<keypad_2>", "<keypad_3>", "<keypad_4>",
"<keypad_5>", "<keypad_6>", "<keypad_7>", "<keypad_8>", "<keypad_9>",
"<delete>", "<pageup>", "<pagedown>", "<tab>"action can be one of the following symbols:
:quit, :help, :up, :down, :left, :right, :fastup, :fastdown, :fastleft,
:fastright :bol, :eol, :pageup, :pagedown, :home, :endTerminalPager.set_preference! — Method
set_preference!(pref::String, value) -> NothingSet the preference pref to the value.
Examples
julia> TerminalPager.set_preference!("visual_mode_line_background", "44")TerminalPager.@help — Macro
@help(f)Open the documentation of the function, macro or other object f in pager.
Examples
julia> @help writeTerminalPager.@stdout_to_pager — Macro
@stdout_to_pager(ex_in)Capture the stdout generated by ex_in and show inside a pager.