mirror of
https://github.com/leporello-js/leporello-js
synced 2026-01-13 21:14:28 -08:00
make cursor position controlled property of state
This commit is contained in:
@@ -416,9 +416,9 @@ export class Editor {
|
||||
? this.ace_editor.getSession()
|
||||
: this.get_session(file)
|
||||
|
||||
// Session was not created for file
|
||||
if(session == null) {
|
||||
return null
|
||||
// Session was not created for file
|
||||
throw new Error('illegal state')
|
||||
}
|
||||
|
||||
return session.doc.positionToIndex(session.selection.getCursor())
|
||||
|
||||
@@ -240,11 +240,7 @@ export class UI {
|
||||
|
||||
change_entrypoint(e) {
|
||||
const file = e.target.value
|
||||
const index = this.editor.get_caret_position(file)
|
||||
// if index is null, session was not created, and index after session
|
||||
// creation will be 0
|
||||
?? 0
|
||||
exec('change_entrypoint', file, index)
|
||||
exec('change_entrypoint', file)
|
||||
this.editor.focus()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user