summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRory Dudley2024-07-08 16:00:19 -0600
committerRory Dudley2024-07-08 16:00:19 -0600
commit13406827a6f13be62659cdb6dcaf3504b5e6210b (patch)
tree8844dbc7766b3423a97fb7782af72299db418087
parente022a7eff4b9af4df3b3a852b911d89a04fdb98b (diff)
downloaddwarvish-13406827a6f13be62659cdb6dcaf3504b5e6210b.tar.gz
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().
-rw-r--r--src/poem/read.rs10
1 files changed, 8 insertions, 2 deletions
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