Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions stdlib/REPL/docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,10 @@ Just as `^R` is a reverse search, `^S` is a forward search, with the prompt ```(
The two may be used in conjunction with each other to move through the previous or next matching
results, respectively.

All executed commands in the Julia REPL are logged into `~/.julia/logs/repl_history.jl` along with a timestamp of when it was executed
and the current REPL mode you were in. Search mode queries this log file in order to find the commands which you previously ran.
All executed commands in the Julia REPL are logged into `~/.julia/logs/repl_history.jl` along with a timestamp of when it was executed,
a session id,
and the current REPL mode you were in. The session id is set at the start of execution of the REPL.
Search mode queries this log file in order to find the commands which you previously ran.
This can be disabled at startup by passing the `--history-file=no` flag to Julia.

## Key bindings
Expand Down
8 changes: 6 additions & 2 deletions stdlib/REPL/src/REPL.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ import Base:
display,
show,
AnyDict,
==
==,
UUID,
rand

_displaysize(io::IO) = displaysize(io)::Tuple{Int,Int}

Expand Down Expand Up @@ -534,10 +536,11 @@ mutable struct REPLHistoryProvider <: HistoryProvider
last_mode::Union{Nothing,Prompt}
mode_mapping::Dict{Symbol,Prompt}
modes::Vector{Symbol}
session::UUID
end
REPLHistoryProvider(mode_mapping::Dict{Symbol}) =
REPLHistoryProvider(String[], nothing, 0, 0, -1, IOBuffer(),
nothing, mode_mapping, UInt8[])
nothing, mode_mapping, UInt8[], UUID(rand(UInt128)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe could use uuid4() instead of UUID(rand(UInt128))?


invalid_history_message(path::String) = """
Invalid history file ($path) format:
Expand Down Expand Up @@ -614,6 +617,7 @@ function add_history(hist::REPLHistoryProvider, s::PromptState)
entry = """
# time: $(Libc.strftime("%Y-%m-%d %H:%M:%S %Z", time()))
# mode: $mode
# session: $(hist.session)
$(replace(str, r"^"ms => "\t"))
"""
# TODO: write-lock history file
Expand Down