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 |
|
Tested this in Emacs One problem still remains with the right prompt: Reedline parks the cursor with They land in the buffer literally and I would also just skip the right prompt since the terminal can't position it anyways. |
|
Thanks for testing this in Emacs shell-mode. I pushed a follow-up that suppresses the right prompt when TERM=dumb, so the right-prompt paint path no longer emits its cursor save/restore sequence. The TERM read remains dynamic. I added regression coverage for the right-prompt layout; the full suite passes with 1606 tests passed, 1 ignored, plus 30 doctests, and clippy is clean. |
|
Thanks for testing this in Emacs |
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. Right prompts are suppressed forTERM=dumbbecause the terminal cannot save/restore or position the cursor as required to render them.TERMis read dynamically, so runtime changes are respected for cursor-position queries, ANSI output, and right-prompt layout.Testing
TERM=dumbcursor-position pathTERM=dumb, regular terminals, and an unsetTERMcargo clippy --locked --all-targets --all-features -- -D warningsgit diff --checkFixes #1009