mirror of
https://github.com/nushell/nushell.git
synced 2024-11-09 01:54:39 +01:00
WIP
This commit is contained in:
parent
b5965ee8ef
commit
baac60a5a7
@ -204,7 +204,7 @@ impl EngineState {
|
||||
|
||||
pub fn get_span_contents(&self, span: &Span) -> &[u8] {
|
||||
for (contents, start, finish) in &self.file_contents {
|
||||
if span.start >= *start && span.start < *finish {
|
||||
if span.start >= *start && span.start <= *finish {
|
||||
return &contents[(span.start - start)..(span.end - start)];
|
||||
}
|
||||
}
|
||||
@ -550,7 +550,7 @@ impl<'a> StateWorkingSet<'a> {
|
||||
let permanent_end = self.permanent_state.next_span_start();
|
||||
if permanent_end <= span.start {
|
||||
for (contents, start, finish) in &self.delta.file_contents {
|
||||
if (span.start >= *start) && (span.start < *finish) {
|
||||
if (span.start >= *start) && (span.start <= *finish) {
|
||||
return &contents[(span.start - permanent_end)..(span.end - permanent_end)];
|
||||
}
|
||||
}
|
||||
|
12
src/main.rs
12
src/main.rs
@ -195,8 +195,6 @@ fn main() -> Result<()> {
|
||||
continue;
|
||||
}
|
||||
|
||||
let mut engine_state = engine_state.clone();
|
||||
|
||||
eval_source(
|
||||
&mut engine_state,
|
||||
&mut stack,
|
||||
@ -304,7 +302,7 @@ fn eval_source(
|
||||
fname: &str,
|
||||
) -> bool {
|
||||
let (block, delta) = {
|
||||
let mut working_set = StateWorkingSet::new(&engine_state);
|
||||
let mut working_set = StateWorkingSet::new(engine_state);
|
||||
let (output, err) = parse(
|
||||
&mut working_set,
|
||||
Some(fname), // format!("entry #{}", entry_num)
|
||||
@ -320,17 +318,17 @@ fn eval_source(
|
||||
|
||||
EngineState::merge_delta(engine_state, delta);
|
||||
|
||||
match eval_block(&engine_state, stack, &block, PipelineData::new()) {
|
||||
match eval_block(engine_state, stack, &block, PipelineData::new()) {
|
||||
Ok(pipeline_data) => {
|
||||
if let Err(err) = print_value(pipeline_data.into_value(), &engine_state) {
|
||||
let working_set = StateWorkingSet::new(&engine_state);
|
||||
if let Err(err) = print_value(pipeline_data.into_value(), engine_state) {
|
||||
let working_set = StateWorkingSet::new(engine_state);
|
||||
|
||||
report_error(&working_set, &err);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Err(err) => {
|
||||
let working_set = StateWorkingSet::new(&engine_state);
|
||||
let working_set = StateWorkingSet::new(engine_state);
|
||||
|
||||
report_error(&working_set, &err);
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user