From f0a000343be32d7463dc07af2a690fe4c4c8ee14 Mon Sep 17 00:00:00 2001 From: pagedmov Date: Fri, 27 Feb 2026 21:25:01 -0500 Subject: [PATCH] double bracket tests now do regex on '==' between two strings fixed line wrapping causing weird cursor issues --- src/builtin/map.rs | 2 +- src/builtin/test.rs | 10 ++++++++-- src/readline/term.rs | 4 ++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/builtin/map.rs b/src/builtin/map.rs index 4bad1ab..bfde9a9 100644 --- a/src/builtin/map.rs +++ b/src/builtin/map.rs @@ -147,7 +147,7 @@ impl MapNode { match self { MapNode::Branch(map) => map.keys().map(|k| k.to_string()).collect(), MapNode::Array(nodes) => nodes.iter().filter_map(|n| n.display(false, false).ok()).collect(), - MapNode::Leaf(s) => vec![s.clone()], + MapNode::Leaf(s) => vec![], } } diff --git a/src/builtin/test.rs b/src/builtin/test.rs index 8a39bc6..063268e 100644 --- a/src/builtin/test.rs +++ b/src/builtin/test.rs @@ -255,8 +255,14 @@ pub fn double_bracket_test(node: Node) -> ShResult { span: err_span, }); } - TestOp::StringEq => rhs.trim() == lhs.trim(), - TestOp::StringNeq => rhs.trim() != lhs.trim(), + TestOp::StringEq => { + let pattern = crate::expand::glob_to_regex(rhs.trim(), true); + pattern.is_match(lhs.trim()) + } + TestOp::StringNeq => { + let pattern = crate::expand::glob_to_regex(rhs.trim(), true); + !pattern.is_match(lhs.trim()) + } TestOp::IntNeq | TestOp::IntGt | TestOp::IntLt diff --git a/src/readline/term.rs b/src/readline/term.rs index c62f02a..d0bebac 100644 --- a/src/readline/term.rs +++ b/src/readline/term.rs @@ -835,12 +835,12 @@ impl Layout { pos.col += c_width; if pos.col > term_width { pos.row += 1; - pos.col = left_margin + c_width; + pos.col = c_width; } } if pos.col >= term_width { pos.row += 1; - pos.col = left_margin; + pos.col = 0; } pos