From 8df215388eedda560a8362bb074e1e55a9fbe1f7 Mon Sep 17 00:00:00 2001 From: matthias314 Date: Sat, 31 Jan 2026 20:35:10 -0500 Subject: [PATCH 1/2] correct REPL region highlighting (fixes #60762) --- stdlib/REPL/src/LineEdit.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/REPL/src/LineEdit.jl b/stdlib/REPL/src/LineEdit.jl index bf9b2749f5325..513b981434c8b 100644 --- a/stdlib/REPL/src/LineEdit.jl +++ b/stdlib/REPL/src/LineEdit.jl @@ -635,7 +635,7 @@ function refresh_multi_line(termbuf::TerminalBuffer, terminal::UnixTerminal, buf full_input = String(buf.data[1:buf.size]) if !isempty(full_input) passes = StylingPass[] - context = StylingContext(buf_pos, regstart, regstop) + context = StylingContext(buf_pos, regstart + 1, regstop) # region positions are 1-based # Add prompt-specific styling passes if the prompt has them and styling is enabled enable_style_input = prompt_obj === nothing ? false : From 42c6f446f651426ff843e476fbf3573e6fb660df Mon Sep 17 00:00:00 2001 From: matthias314 Date: Sun, 1 Feb 2026 16:25:00 -0500 Subject: [PATCH 2/2] fix REPL highlighting of enclosing parentheses --- stdlib/REPL/src/LineEdit.jl | 2 +- stdlib/REPL/src/StylingPasses.jl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/REPL/src/LineEdit.jl b/stdlib/REPL/src/LineEdit.jl index 513b981434c8b..ab352562abd6b 100644 --- a/stdlib/REPL/src/LineEdit.jl +++ b/stdlib/REPL/src/LineEdit.jl @@ -635,7 +635,7 @@ function refresh_multi_line(termbuf::TerminalBuffer, terminal::UnixTerminal, buf full_input = String(buf.data[1:buf.size]) if !isempty(full_input) passes = StylingPass[] - context = StylingContext(buf_pos, regstart + 1, regstop) # region positions are 1-based + context = StylingContext(buf_pos + 1, regstart + 1, regstop) # StylingContext positions are 1-based # Add prompt-specific styling passes if the prompt has them and styling is enabled enable_style_input = prompt_obj === nothing ? false : diff --git a/stdlib/REPL/src/StylingPasses.jl b/stdlib/REPL/src/StylingPasses.jl index 3606566d341ea..04c3bef6bda40 100644 --- a/stdlib/REPL/src/StylingPasses.jl +++ b/stdlib/REPL/src/StylingPasses.jl @@ -137,7 +137,7 @@ function find_enclosing_parens(content::String, ast, cursor_pos::Int) elseif depthchange < 0 && !isempty(paren_stack) # Closing paren - pop from stack and check if cursor is inside open_pos, depth, open_ptype = pop!(paren_stack) - if open_ptype == ptype && open_pos <= cursor_pos < pos + if open_ptype == ptype && open_pos <= cursor_pos <= pos # Cursor is inside this paren pair - keep only innermost per type # Only update if this is the first pair or if it's smaller (more inner) than existing if !haskey(innermost_pairs, ptype) || (pos - open_pos) < (innermost_pairs[ptype][2] - innermost_pairs[ptype][1])