From e4e2836935a5a68169b522738e5be4520782ee1e Mon Sep 17 00:00:00 2001 From: Mecaneer23 <74385377+Mecaneer23@users.noreply.github.com> Date: Thu, 20 Jun 2024 17:02:27 -0500 Subject: [PATCH] refactor: simplify _todo_from_clipboard --- src/clipboard.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/clipboard.py b/src/clipboard.py index 1be0a65..51c56a3 100644 --- a/src/clipboard.py +++ b/src/clipboard.py @@ -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