diff --git a/src/utils.py b/src/utils.py index dbd3586..68c9434 100644 --- a/src/utils.py +++ b/src/utils.py @@ -32,6 +32,10 @@ def parse_options(raw: str) -> list[str]: current_block: list[list[str]] = [] current_list: list[str] = [] + # Remove trailing empty line from paste artifacts + if lines and lines[-1].strip() == "" and len(lines) > 1: + lines = lines[:-1] + for i, line in enumerate(lines, 1): stripped = line.strip() diff --git a/web/prompt_option_picker.js b/web/prompt_option_picker.js index 678649a..7a59a39 100644 --- a/web/prompt_option_picker.js +++ b/web/prompt_option_picker.js @@ -50,6 +50,11 @@ const parseOptions = (raw) => { let currentBlock = []; let currentList = []; + // Remove trailing empty line from paste artifacts + if (lines.length > 1 && lines[lines.length - 1].trim() === "") { + lines.pop(); + } + for (const line of lines) { const stripped = line.trim();