From b5a0e8652bab38bc0d234314e7b1784b271ac634 Mon Sep 17 00:00:00 2001 From: Tor Erlend Fjelde Date: Mon, 2 Aug 2021 00:09:53 +0100 Subject: [PATCH] added :displaysize as chunk option and chunks now respect displaysize --- src/config.jl | 3 ++- src/run.jl | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/config.jl b/src/config.jl index 0dcf901..b2c2947 100644 --- a/src/config.jl +++ b/src/config.jl @@ -17,8 +17,9 @@ const _DEFAULT_PARAMS = Dict{Symbol,Any}( :term => false, :prompt => "julia>", :label => nothing, - :wrap => true, + :wrap => false, :line_width => 75, + :displaysize => displaysize(), :fig_ext => nothing, :fig_pos => nothing, :fig_env => nothing, diff --git a/src/run.jl b/src/run.jl index b47aa97..6003211 100644 --- a/src/run.jl +++ b/src/run.jl @@ -260,7 +260,11 @@ function eval_chunk(doc::WeaveDoc, chunk::CodeChunk, report::Report, mod::Module chunk.options[:out_width] = report.format.out_width end - chunk.result = run_code(doc, chunk, report, mod) + # Get the default `displaysize`. + lines, cols = chunk.options[:displaysize] + chunk.result = withenv("LINES" => lines, "COLUMNS" => cols) do + run_code(doc, chunk, report, mod) + end execute_posthooks!(chunk)