Skip to content

Commit

Permalink
Merge pull request #20 from zbjcool/feature/20230718-zbjcool-coalesci…
Browse files Browse the repository at this point in the history
…ng-operator

fix: coalescing-operator
  • Loading branch information
logue authored Jul 26, 2023
2 parents f896b82 + 9160f0b commit 2fd6256
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/components/CodeMirror.ts
Original file line number Diff line number Diff line change
Expand Up @@ -558,14 +558,15 @@ export default defineComponent({
/** Retrieve one end of the primary selection. */
const getCursor = (): number => view.value.state.selection.main.head;
/** Retrieves a list of all current selections. */
const listSelections = (): readonly SelectionRange[] =>
view.value.state.selection.ranges ?? [];
const listSelections = (): readonly SelectionRange[] => {
var _view$value$state$sel;
return (_view$value$state$sel = view.value.state.selection.ranges) !== null && _view$value$state$sel !== void 0 ? _view$value$state$sel : [];
};
/** Get the currently selected code. */
const getSelection = (): string =>
view.value.state.sliceDoc(
view.value.state.selection.main.from,
view.value.state.selection.main.to
) ?? '';
const getSelection = (): string => {
var _view$value$state$sli;
return (_view$value$state$sli = view.value.state.sliceDoc(view.value.state.selection.main.from, view.value.state.selection.main.to)) !== null && _view$value$state$sli !== void 0 ? _view$value$state$sli : '';
};
/**
* The length of the given array should be the same as the number of active selections.
* Replaces the content of the selections with the strings in the array.
Expand Down

0 comments on commit 2fd6256

Please sign in to comment.