ne
ne copied to clipboard
Disable standout before clearing lines
This is a long-running problem that I've muddled around in the past.
- Start
nein zutty or termux via SSH, both useTERM=xterm-256color. I'm fairly sure there are other terminals also affected, maybe some of the Javascript terminals? - Press enter to clear welcome message, screen goes white.
- Type
sdfand press Ctrl-l. Screen restored, bar top line. - Press enter, line ends in white highlight, following line also white. Ctrl-l clears
- Type
sdf { hello }, press left so right braces are highlighted, press enter. No highlight problems.
This appears to be caused by standout_mode being enabled when a line is being cleared. Calling turn_off_standout() solves the problem as far as I can see.
Note that standout_mode is a separate state to curr_attr, so generally curr_attr is 0 when pressing enter. However, for the braces above attributes are set on them, so we call set_attr(0) here which also disables the reverse-video. Thus why the final case works fine.
Arguably the terminals are the ones at fault, given they claim they're xterm and this isn't something xterm does, but I don't know if I'd win that argument with the terminal developers :)
Hey @lentinj, Thanks for taking the time to work through these details. My only hesitation in merging this change is that I haven't been able to reproduce it yet. Okay, I also haven't tried the two terminals you cited either; they apparently aren't readily available on the hosts I have access to. From what you describe, though, it must be really annoying to anyone using such a terminal. I'm kind of surprised you stuck with it this far. Still, this solution seems pretty straightforward with probably a minuscule impact on bandwidth.
Even so, I'd like to get Sebastiano's take on it first. He put lots of effort into minimizing data transfers, and his grasp of the inner workings of these terminal controls is much better than mine. In the mean time, I'll attempt to reproduce the problem you've described.
Thanks again for taking an interest in ne!
I'm kind of surprised you stuck with it this far
I ditched zutty and went back to xterm. Not being able to use ne is a deal-breaker for me :)
I'd like to get Sebastiano's take on it first
Certainly, no rush. I was mostly raising this whilst I had concrete examples of 2 terminals that were affected.
Speaking of which, kitty, another new-ish terminal, also has the same problem.
Thanks again for taking an interest in ne!
Thanks for developing ne---I've used it since BeOS was still a thing, I don't think my fingers could use anything else!
I've been corresponding with the author of zutty. He tried to reproduce your issue and doesn't see anything unexpected. So I went back through your initial post to look at your procedure and realized I made some assumptions that may not be true.
- Start ne in zutty […]
This seems innocuous enough, but let's start with ne --no-config to be sure we're starting from the same place.
- Press enter to clear welcome message, screen goes white.
That will also put a blank line at the top of the document, with the cursor on line 2. My screen also goes white (except for the status line at the bottom), which is expected because I've got black text on a white background.
For clarification: are you expecting the screen to go white, or is this part of the problem?
- Type sdf and press Ctrl-l. Screen restored, bar top line.
Now I've got "sdf" on line 2, cursor at L:2 C:4. The screen is "restored" - i.e. no change. What do you mean by "bar top line"? The top bar shouldn't be showing unless you hit escape-escape or F1.
- Press enter, line ends in white highlight, following line also white. Ctrl-l clears
Struggling with the interpretation here. Are you saying the "f" of "sdf" is now white? There's no text on the following line(s). Refresh (^L) shouldn't clear the screen. Is "sdf" invisible at this point?
- Type sdf { hello }, press left so right braces are highlighted, press enter. No highlight problems.
Sorry if I'm being dumb. I'm seeing exactly what you're describing, but I'm not seeing any highlight problems. The procedure you gave seems pretty clear, as does what you're seeing, but where that deviates from expectations is escaping me. Perhaps you can hit me with a bigger clue stick. (?)
which is expected because I've got black text on a white background.
I suspect this is the key, I'm using black-background terminals. For some reason I can't get it to change to a white background, will investigate further later.
I'm also using zutty from debian unstable, termux from F-droid if that's useful information.
I've tried uploading a screen recording going through the above, the only thing that should have a white background is the status bar. Hopefully this works and helps:
https://github.com/vigna/ne/assets/586911/4827c378-289c-4df3-b5eb-193b5ab28821