Skip to content
This repository has been archived by the owner on Oct 18, 2024. It is now read-only.

Commit

Permalink
fix: refresh symbol input view when files are opened
Browse files Browse the repository at this point in the history
  • Loading branch information
itsaky committed Nov 10, 2023
1 parent 15e29ae commit 5ec2401
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,10 @@ abstract class BaseEditorActivity :
}
}

protected fun refreshSymbolInput(editor: CodeEditorView) {
binding.bottomSheet.refreshSymbolInput(editor)
}

private fun handleUiDesignerResult(result: ActivityResult) {
if (result.resultCode != RESULT_OK || result.data == null) {
log.warn("UI Designer returned invalid result", result.resultCode, result.data)
Expand Down Expand Up @@ -555,10 +559,6 @@ abstract class BaseEditorActivity :
}
}

private fun refreshSymbolInput(editor: CodeEditorView) {
binding.bottomSheet.refreshSymbolInput(editor)
}

private fun setupDiagnosticInfo() {
val gd = GradientDrawable()
gd.shape = GradientDrawable.RECTANGLE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,15 +279,18 @@ open class EditorHandlerActivity : ProjectHandlerActivity(), IEditorHandler {
override fun openFileAndSelect(file: File, selection: Range?) {
openFile(file, selection)

getEditorForFile(file)?.editor?.also { editor ->
editor.postInLifecycle {
if (selection == null) {
editor.setSelection(0, 0)
return@postInLifecycle
}
getEditorForFile(file)?.also {
refreshSymbolInput(it)
it.editor?.also { editor ->
editor.postInLifecycle {
if (selection == null) {
editor.setSelection(0, 0)
return@postInLifecycle
}

editor.validateRange(selection)
editor.setSelection(selection)
editor.validateRange(selection)
editor.setSelection(selection)
}
}
}
}
Expand Down

0 comments on commit 5ec2401

Please sign in to comment.