Skip to content

Commit

Permalink
Corrected bug whereby selecting across lines was not copying the enti…
Browse files Browse the repository at this point in the history
…re lines.
  • Loading branch information
jglev committed Jan 6, 2023
1 parent db19385 commit 73a5a9c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
18 changes: 13 additions & 5 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,22 @@ const copyForwardLines = async (
copiedLine = copiedLine.replace(/^\s*/, "");
}


if (
selections.length > 0 &&
(lineNumber === minLine || lineNumber === maxLine) &&
!(minLine === maxLine && cursorFrom.ch === cursorTo.ch)
(
selections.length > 1 && (
lineNumber === minLine || lineNumber === maxLine
) && !(
minLine === maxLine && cursorFrom.ch === cursorTo.ch
)
) || (
(selections.length === 1) &&
minLine === maxLine && cursorFrom.ch !== cursorTo.ch
)
) {
copiedLine = line.slice(
lineNumber === minLine ? cursorFrom.ch : 0,
lineNumber === maxLine ? cursorTo.ch : line.length - 1
lineNumber === minLine ? Math.min(cursorFrom.ch, cursorTo.ch) : 0,
lineNumber === maxLine ? Math.max(cursorFrom.ch, cursorTo.ch) : line.length - 1
);
}

Expand Down
4 changes: 2 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"id": "obsidian-carry-forward",
"name": "Carry-Forward",
"version": "1.4.4",
"minAppVersion": "0.14.5",
"version": "1.4.5",
"minAppVersion": "1.0.0",
"description": "An Obsidian Notes plugin for generating and copying block IDs and for copying lines with links to the copied line.",
"author": "Jacob Levernier",
"authorUrl": "https://github.com/jglev/obsidian-carry-forward",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "obsidian-carry-forward",
"version": "1.4.4",
"version": "1.4.5",
"description": "An Obsidian Notes plugin for generating and copying block IDs, and copying lines with a link to the copied line.",
"main": "main.js",
"scripts": {
Expand Down
3 changes: 2 additions & 1 deletion versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
"1.4.1": "0.13.19",
"1.4.2": "0.14.5",
"1.4.3": "0.14.5",
"1.4.4": "0.14.5"
"1.4.4": "0.14.5",
"1.4.5": "1.0.0"
}

0 comments on commit 73a5a9c

Please sign in to comment.