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 |
kronberger-droid
left a comment
There was a problem hiding this comment.
Just those two comments and a rebase and then I think we are ready.
0a3e516 to
bb0ba71
Compare
|
Thanks! I addressed both comments and rebased the branch onto the current |
|
Hey there, sorry that I come back with other requests. Blank line before every prompt.
That is four |
|
Thanks for catching these. I've pushed a follow-up addressing all three points.
Both buffer paint paths now skip
I added output-capture regressions for the extra blank line and the remaining save/restore escapes. The full all-features suite passes under both I also updated the PR description to reflect the cached Painter policy. |
|
Nice thanks a lot. |
The engine read `TERM` on every paint while the painter answers from a flag cached at construction and on resize, so after a mid-session change the colors and the skipped escapes could disagree. ANSI coloring now follows that cache too, thus it no longer tracks `TERM` between resizes. Follow-up to #1183.
Summary
Respect
TERM=dumbin Reedline's cursor-position queries and prompt painting.Paintercaches whetherTERM=dumbat construction and refreshes the flag on resize. Cursor-position queries, right-prompt layout, and buffer cursor save/restore use this cached flag rather than reading the environment on each paint.When cursor-position queries are deliberately skipped,
anchor_promptkeeps a stale bottom-row anchor without printing an extra newline. Actual query errors retain #1202's newline recovery and stale bottom-row fallback.Right prompts are suppressed for
TERM=dumb. Both small- and large-buffer painting skipSavePosition, and cursor placement skips restoring or repositioning the cursor, leaving it where the lastPrintput it.TERM=dumbalso disables ANSI coloring without changing the configuredwith_ansi_colorsvalue. ANSI coloring continues to use the engine's existing TERM-aware policy.Testing
ESC 7/ESC 8in small- and large-buffer painting.TERM=xterm-256colorandTERM=dumb, using--test-threads=1: 1794 passed, 1 ignored, and 30 doctests passed in each run.cargo clippy --locked --all-targets --all-features -- -D warningscargo fmt --all -- --checkgit diff --checkFixes #1009