Skip to content

Commit

Permalink
Add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed May 19, 2022
1 parent a41d0fb commit 946f695
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ const ImportForm = observer(({ model }: { model: LGV }) => {
const [ref, rest] = location.split(':')
const allRefs = assembly?.allRefNames || []
try {
// instead of querying text-index, first:
// - check if input matches a refname directly
// - or looks like locstring
// then just navigate as if it were a locstring
if (
allRefs.includes(location) ||
(allRefs.includes(ref) &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,32 @@ function SearchBox({
)
}

async function handleSelectedRegion(option: BaseResult) {
// gets a string as input, or use stored option results from previous query,
// then re-query and
// 1) if it has multiple results: pop a dialog
// 2) if it's a single result navigate to it
// 3) else assume it's a locstring and navigate to it
async function handleSelectedRegion(
option: BaseResult,
assemblyName: string,
) {
let trackId = option.getTrackId()
let location = option.getLocation()
const label = option.getLabel()
const [ref, rest] = location.split(':')
const allRefs = assembly?.allRefNames || []
try {
// instead of querying text-index, first:
// - check if input matches a refName directly
// - or looks like locString
// then just navigate as if it were a locString
if (
allRefs.includes(location) ||
(allRefs.includes(ref) &&
rest !== undefined &&
!Number.isNaN(parseInt(rest, 10)))
) {
model.navToLocString(location)
model.navToLocString(location, assemblyName)
} else {
const results = await fetchResults(label, 'exact')
if (results.length > 1) {
Expand Down

0 comments on commit 946f695

Please sign in to comment.