mirror of
https://github.com/leporello-js/leporello-js
synced 2026-01-13 21:14:28 -08:00
fix display console.log args when navigating logs view
This commit is contained in:
@@ -713,8 +713,11 @@ const select_return_value = state => {
|
||||
selection_state: {
|
||||
node,
|
||||
initial_is_expand: true,
|
||||
},
|
||||
value_explorer: {
|
||||
index: node.index + node.length,
|
||||
result: result_node.result,
|
||||
}
|
||||
},
|
||||
},
|
||||
effects: {type: 'set_focus'}
|
||||
}
|
||||
@@ -755,8 +758,11 @@ const select_arguments = (state, with_focus = true) => {
|
||||
selection_state: {
|
||||
node,
|
||||
initial_is_expand: true,
|
||||
},
|
||||
value_explorer: {
|
||||
index: node.index + node.length,
|
||||
result,
|
||||
}
|
||||
},
|
||||
},
|
||||
effects: with_focus
|
||||
? {type: 'set_focus'}
|
||||
|
||||
39
src/cmd.js
39
src/cmd.js
@@ -453,16 +453,18 @@ const get_next_selection_state = (selection_state, frame, is_expand, index) => {
|
||||
export const selection = (selection_state, frame, is_expand, index) => {
|
||||
const leaf = find_leaf(frame, index)
|
||||
if(leaf == null) {
|
||||
return {
|
||||
ok: false,
|
||||
message: 'out of scope',
|
||||
return {
|
||||
selection_state: {
|
||||
ok: false,
|
||||
message: 'out of scope',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const next_selection_state = get_next_selection_state(selection_state, frame, is_expand, index)
|
||||
|
||||
if(!next_selection_state.ok) {
|
||||
return next_selection_state
|
||||
return {selection_state: next_selection_state}
|
||||
}
|
||||
|
||||
const {ok, message} = can_evaluate_node(frame, next_selection_state.node)
|
||||
@@ -470,9 +472,11 @@ export const selection = (selection_state, frame, is_expand, index) => {
|
||||
const node = find_node(frame, n => is_eq(n, next_selection_state.node))
|
||||
if(node.result == null) {
|
||||
return {
|
||||
...next_selection_state,
|
||||
ok: false,
|
||||
message: 'expression was not reached during program execution',
|
||||
selection_state: {
|
||||
...next_selection_state,
|
||||
ok: false,
|
||||
message: 'expression was not reached during program execution',
|
||||
}
|
||||
}
|
||||
} else {
|
||||
let result
|
||||
@@ -482,10 +486,15 @@ export const selection = (selection_state, frame, is_expand, index) => {
|
||||
const error_node = find_error_origin_node(node)
|
||||
result = error_node.result
|
||||
}
|
||||
return {...next_selection_state, ok: true, result}
|
||||
return {
|
||||
selection_state: {...next_selection_state, ok: true},
|
||||
result
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return {...next_selection_state, ok: false, message}
|
||||
return {
|
||||
selection_state: {...next_selection_state, ok: false, message}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -495,14 +504,22 @@ const eval_selection = (state, index, is_expand) => {
|
||||
return validate_result
|
||||
}
|
||||
|
||||
const selection_state = selection(
|
||||
const {selection_state, result} = selection(
|
||||
state.selection_state,
|
||||
active_frame(state),
|
||||
is_expand,
|
||||
index
|
||||
)
|
||||
|
||||
const nextstate = {...state, selection_state}
|
||||
const nextstate = {...state,
|
||||
selection_state,
|
||||
value_explorer: selection_state.ok
|
||||
? {
|
||||
index: selection_state.node.index + selection_state.node.length,
|
||||
result,
|
||||
}
|
||||
: null
|
||||
}
|
||||
|
||||
if(!selection_state.ok) {
|
||||
return {state: nextstate, effects: {type: 'set_status', args: [selection_state.message]}}
|
||||
|
||||
8
src/effects.js
vendored
8
src/effects.js
vendored
@@ -278,14 +278,6 @@ export const render_common_side_effects = (prev, next, command, ui) => {
|
||||
}
|
||||
}
|
||||
|
||||
const selresult = next.selection_state?.result
|
||||
if(selresult != null && prev.selection_state?.result != selresult) {
|
||||
const node = next.selection_state.node
|
||||
ui.editor.embed_value_explorer({
|
||||
index: node.index + node.length,
|
||||
result: next.selection_state.result,
|
||||
})
|
||||
}
|
||||
|
||||
// Value explorer
|
||||
if(prev.value_explorer != next.value_explorer) {
|
||||
|
||||
Reference in New Issue
Block a user