Skip to content

Commit

Permalink
Introduce text faces
Browse files Browse the repository at this point in the history
To easy text styling, a "Face" type is introduced which bundles a
collection of stylistic attributes together (essentially constituting a
typeface). This builds on the recently added Styled{String,Char} types,
and together allow for an ergonomic way of handling styled text.
  • Loading branch information
tecosaur committed Oct 20, 2023
1 parent 6113e1c commit c505b04
Show file tree
Hide file tree
Showing 4 changed files with 580 additions and 0 deletions.
15 changes: 15 additions & 0 deletions base/client.jl
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,19 @@ function load_InteractiveUtils(mod::Module=Main)
return MainInclude.InteractiveUtils
end

"""
loadfaces!(facetoml::IO)
Parse `facetoml` as TOML, and load all faces described.
The loading is done with `loadfaces!`, which see.
Face entries should be of the following form:
```toml
[face_name]
property = "value"
"""
loadfaces!(facetoml::IO) = loadfaces!(TOML.parse(TOML.Parser(facetoml)))

function load_REPL()
# load interactive-only libraries
try
Expand All @@ -416,6 +429,8 @@ function run_main_repl(interactive::Bool, quiet::Bool, banner::Symbol, history_f
end
end
# TODO cleanup REPL_MODULE_REF
userfaces = joinpath(first(DEPOT_PATH), "config", "faces.toml")
isfile(userfaces) && open(loadfaces!, userfaces)

if !fallback_repl && interactive && isassigned(REPL_MODULE_REF)
invokelatest(REPL_MODULE_REF[]) do REPL
Expand Down
3 changes: 3 additions & 0 deletions base/exports.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export
Dims,
Enum,
ExponentialBackOff,
Face,
IndexCartesian,
IndexLinear,
IndexStyle,
Expand Down Expand Up @@ -582,6 +583,7 @@ export
,

# strings
addface!,
ascii,
bitstring,
bytes2hex,
Expand Down Expand Up @@ -610,6 +612,7 @@ export
isspace,
isuppercase,
isxdigit,
loadfaces!,
lowercase,
lowercasefirst,
isvalid,
Expand Down
Loading

0 comments on commit c505b04

Please sign in to comment.