Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
luckman212 committed Jun 22, 2024
1 parent 49731bc commit ebb795d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/block_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@ export abstract class BlockUtils {
console.log('error reading FileCache (empty file?)');
return;
}
let currentBlock: SectionCache | ListItemCache = (() => {
const i = sections.findIndex(section => section.position.start.line > cursor.line);
return i > 0 ? sections[i - 1] : sections[sections.length - 1];
})();
const foundSectionIndex = sections.findIndex(section => section.position.start.line > cursor.line);
let currentBlock: SectionCache | ListItemCache = foundSectionIndex > 0 ? sections[foundSectionIndex - 1] : sections[sections.length - 1];
if (currentBlock?.type == "list") {
currentBlock = fileCache.listItems?.find(section =>
section.position.start.line <= cursor.line &&
Expand Down

0 comments on commit ebb795d

Please sign in to comment.