Respect TERM=dumb for cursor position queries - #1183
Conversation
|
I wonder if it's worth centralizing all interactions with the env in calls like |
|
That makes sense to me. I checked the current codebase and found only three direct process environment-variable reads: I pushed a follow-up commit that routes those reads through a single One nuance is that the wrapper itself does not make concurrent external environment mutation thread-safe. The benefit is that Reedline now has one place where a future synchronization or snapshot policy can be implemented instead of having environment-variable reads scattered around the crate. The full library tests and clippy are still green after the refactor. |
yup, that's exactly what I was asking. Thanks for the update. We'll wait to see what @kronberger-droid thinks. I'm not sure it's a regression so I doubt this will be for the upcoming patch. |
|
Definitely not a regression, thats a longstanding issue. I will take a closer look tomorrow. |
|
Thanks! |
|
Well I think it would make sense to thread in the ansi-coloring removal here to. |
37c5ce4 to
6b65dac
Compare
|
Thanks, I threaded The configured I also rebased onto current I added coverage for |
Summary
Respect
TERM=dumbwhen Reedline queries the terminal for the cursor position.TERM=dumbdoes not provide cursor-position reporting, butPaintercurrently callscrossterm::cursor::position()from several paths. In particular,initialize_prompt_position()propagates a failed query directly.This PR centralizes cursor-position queries behind a small wrapper:
TERM=dumb, skipcursor::position()and return no measured positionTERMfor each query rather than caching it, so runtime changes toTERMare respectedTERM=dumbalso disables ANSI coloring while preserving the configuredwith_ansi_colorsvalue.TERMis read dynamically, so runtime changes are respected for both cursor-position queries and ANSI output.Testing
TERM=dumbcursor-position pathTERM=dumb, regular terminals, and an unsetTERMcargo clippy --locked --all-targets --all-features -- -D warningsgit diff --checkFixes #1009