Skip to content

Commit

Permalink
refactor: simplify _todo_from_clipboard
Browse files Browse the repository at this point in the history
  • Loading branch information
mecaneer23 committed Jun 20, 2024
1 parent c6f89b8 commit e4e2836
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/clipboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,12 @@ def _todo_from_clipboard(
"Paste dependency not available: try running `pip install pyperclip`",
)
return todos
todo = paste() # pyright: ignore
if copied_todo.get_display_text() == todo:
pasted = paste() # pyright: ignore
if copied_todo.get_display_text() == pasted:
todos.insert(selected + 1, Todo(repr(copied_todo)))
return todos
if "\n" in todo:
todo = todo.strip()
for index, line in enumerate(todo.split("\n"), start=1):
todos.insert(selected + index, Todo(f"- {line}"))
return todos
todos.insert(selected + 1, Todo(f"- {todo}"))
for index, line in enumerate(pasted.strip().split("\n"), start=1):
todos.insert(selected + index, Todo(f"- {line}"))
return todos


Expand Down

0 comments on commit e4e2836

Please sign in to comment.