@@ -2059,8 +2059,8 @@ end
20592059 end
20602060
20612061 # Test 1: Simple keyword highlighting
2062- write (stdin_write, " function" )
2063- s = readuntil (stdout_read, " function " , keep= true )
2062+ write (stdin_write, " function # SENTINEL1 " )
2063+ s = readuntil (stdout_read, " # SENTINEL1 " , keep= true )
20642064 # The keyword "function" should be styled (have escape code before it)
20652065 # Look for "function" that appears after the prompt, not just anywhere
20662066 # Extract just the input portion after "julia> "
@@ -2075,8 +2075,8 @@ end
20752075
20762076 # Test 2: Unicode identifiers with syntax highlighting
20772077 readuntil (stdout_read, " julia> " )
2078- write (stdin_write, " function αβ(a, β)" )
2079- s = readuntil (stdout_read, " β) " , keep= true )
2078+ write (stdin_write, " function αβ(a, β) # SENTINEL2 " )
2079+ s = readuntil (stdout_read, " # SENTINEL2 " , keep= true )
20802080 # Should highlight "function" keyword even with unicode following
20812081 input_part = split (s, " julia> " , keepempty= false )
20822082 if ! isempty (input_part)
@@ -2095,27 +2095,28 @@ end
20952095 readuntil (stdout_read, " julia> " )
20962096 write (stdin_write, " begin\n " )
20972097 readuntil (stdout_read, " begin" )
2098- write (stdin_write, " local test_var_for_highlighting = 42\n " )
2099- s = readuntil (stdout_read, " 42 " , keep= true )
2098+ write (stdin_write, " local test_var_for_highlighting = 42 # SENTINEL3 \n " )
2099+ s = readuntil (stdout_read, " # SENTINEL3 " , keep= true )
21002100 # Should contain highlighting - the "local" keyword should be styled
21012101 @test occursin (r" \e\[ [0-9;]*m.*local" , s)
21022102 write (stdin_write, " \x 03" ) # Ctrl-C to cancel before executing
21032103 # Don't execute to avoid polluting Main module
21042104
21052105 # Test 4: Bracket highlighting (paren matching)
21062106 readuntil (stdout_read, " julia> " )
2107- write (stdin_write, " (1 + (2 * 3))" )
2107+ write (stdin_write, " (1 + (2 * 3)) # SENTINEL4 " )
21082108 # Move cursor to be inside the inner parens: between 2 and *
2109- # Current position is at end: (1 + (2 * 3))|
2110- # Move left 5 times to get to: (1 + (2| * 3))
2111- for _ in 1 : 5
2109+ # Current position is at end: (1 + (2 * 3)) # SENTINEL4|
2110+ # Move left to get to: (1 + (2| * 3)) # SENTINEL4
2111+ # We need to move past " # SENTINEL4" which is 13 characters
2112+ for _ in 1 : 18 # 13 for " # SENTINEL4" + 5 to get between 2 and *
21122113 write (stdin_write, " \e [D" ) # Left arrow
21132114 end
21142115 # Give it a moment to process and re-render
21152116 sleep (0.1 )
2116- # Now write a character to trigger re-render and capture output
2117+ # Now write a space to trigger re-render and capture output
21172118 write (stdin_write, " " )
2118- s = readuntil (stdout_read, " " , keep= true )
2119+ s = readuntil (stdout_read, " # SENTINEL4 " , keep= true )
21192120 # The enclosing parens around "2 * 3" should be highlighted with bold/underline
21202121 # We can't easily test the exact positioning, but we can verify that
21212122 # there are ANSI codes for bold (\e[1m) or underline (\e[4m) present
@@ -2135,8 +2136,8 @@ end
21352136 end
21362137
21372138 # Even though the prompt has styling passes, they shouldn't be applied
2138- write (stdin_write, " function" )
2139- s = readuntil (stdout_read, " function " , keep= true )
2139+ write (stdin_write, " function # SENTINEL5 " )
2140+ s = readuntil (stdout_read, " # SENTINEL5 " , keep= true )
21402141 # With style_input=false, there should be no color codes from syntax highlighting
21412142 # (there may still be prompt color codes, but not within the input text)
21422143 lines = split (s, ' \n ' )
0 commit comments