From 13406827a6f13be62659cdb6dcaf3504b5e6210b Mon Sep 17 00:00:00 2001 From: Rory Dudley Date: Mon, 8 Jul 2024 16:00:19 -0600 Subject: Fix a bug with channels When using IO operations from within a file, the channel would get overriden before pushing a filename to the appropriate vector (op, ep, or both). This is because Rune::Continue is used for newlines, and was resetting the channel to None, before the push operation. Rune::Continue is now broken out into its own match clause, that doesn't set the channel before calling verse.add(). --- src/poem/read.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/poem') diff --git a/src/poem/read.rs b/src/poem/read.rs index 6d7550b..8f3fd4a 100644 --- a/src/poem/read.rs +++ b/src/poem/read.rs @@ -379,17 +379,23 @@ impl Readable for Poem { | Rune::Addendum | Rune::Addendum2 | Rune::AddendumAll => { + channel = Some(rune); verse.add(&mut word, channel); channel = Some(rune); verse.io.push(rune); } // These meters indicate the end of a verse - Rune::Couplet | Rune::Quiet | Rune::And | Rune::Continue => { + Rune::Couplet | Rune::Quiet | Rune::And => { channel = None; verse.add(&mut word, channel); poem.add(&mut verse, rune, env)?; - // append!(poem, last, rune, verse, env); + } + + Rune::Continue => { + verse.add(&mut word, channel); + poem.add(&mut verse, rune, env)?; + channel = None; } // Interpret ~ as $HOME -- cgit v1.2.3