Skip to content

Commit

Permalink
fix bug where cursor was placed outside document
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbicodes committed Sep 7, 2023
1 parent b70458e commit f9d0c86
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ function testExercisesUntilFail() {
console.log("Fails:", fails)
}

testSolution(randExercise())
//testSolution(randExercise())
//testSolution("meetup")
//loadExercise("all_your_base")
//testExercisesUntilFail()
//testExercises()
testExercises()
3 changes: 1 addition & 2 deletions src/eval-region.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,15 @@ export function tryEval(s) {
export const clearEval = (view) => {
const parent = view.dom.parentElement.id
if (parent === 'app') {
posBeforeEval = view.state.selection.main.head
var previousDoc = codeBeforeEval
var previousPos = posBeforeEval
if (evalResult.length != 0) {
evalResult = ""
console.log("moving cursor to previous pos:", previousPos)
updateEditor(view, previousDoc, previousPos)
}
}
if (parent === 'test') {
testPosBeforeEval = view.state.selection.main.head
var previousTestDoc = testCodeBeforeEval
var previousTestPos = testPosBeforeEval
if (evalResult.length != 0) {
Expand Down

0 comments on commit f9d0c86

Please sign in to comment.