Maximus5 / ConEmu

Customizable Windows terminal with tabs, splits, quake-style, hotkeys and more
https://conemu.github.io/
BSD 3-Clause "New" or "Revised" License
8.57k stars 573 forks source link

Refresh/Redraw/Artifacts issue #1747

Open CollinChaffin opened 5 years ago

CollinChaffin commented 5 years ago

Versions

ConEmu build: 180626 x64 OS version: Windows 7 7x64 Used shell version (Far Manager, git-bash, cmd, powershell, cygwin, whatever): ???

Powershell

Problem description

Artifacts of prior screen buffer not being properly redrawn in various actions.

Steps to reproduce

  1. Shown in attached demo video

Actual results

snag-11-6-20183 01 16 am avi

Expected results

Redraw is correct on some operations. Expect it to be correctly redrawn on any new line actions.

I cannot believe more are not reporting this but I guess I have also quietly lived with it for quite some time but would hate to think there was simply a setting I missed that would correct this messy lack of redraw I know Powershell has had some minor redraw issues in the past but I do not seem to get this level of prior buffer artifacts outside of Conemu so I am not sure of the cause or if anyone else knows of a workaround/fix I would really appreciate it!

Maximus5 commented 5 years ago

I don't think it's ConEmu problem. Isn't your shell the PowerShell? It uses WinAPI to output data. But I see "lambda" in your prompt. Isn't it cmder?

Anyway, please read this

Third-party application problems Cmder

CollinChaffin commented 5 years ago

Yes cmder simply executes conemu, in fact that prompt was open in only conemu (but I am customizing my prompt with lambda and powerline etc.). I will continue testing but it sure seems to be in conemu and the weird thing is even in my video you can see sometimes it does properly blank the screen and redraw, then the next history hit it leaves artifacts.

Either way as you can see - it is VERY messy and it's just Powershell in conemu I cannot be the only one having the issue but perhaps I'm just the only one that it so annoyed by it that I asked. :)

Do you have any ideas or are you able to load up Powershell yourself and hit CTRL-R for reverse history search and search for like a "#" like I did and if you paste even a page long script into history it will then recall it and along with one or two single-line "#" comments in history, you should see the same thing.

Either way thanks for looking into it!

Maximus5 commented 5 years ago

Have you checked the same in PowerShell started without ConEmu?

tallanvor commented 5 years ago

I got same issue by using WSL. So, it's NOT powershell problem...

tallanvor commented 5 years ago

BTW, version 180528 haven't this issue

LesterCovax commented 5 years ago

EDIT: I'm an idiot...somehow skipped over the fact that you're using PowerShell and no VIM (aka everything important). It still looks like it's a screen write/buffer issue though. I tried recreating it in ConEmu 180626 running same platform/plugins and couldn't reproduce it.

When I was trying to set up a PS env in Cmder though, I came across a lot of issues. Cmder utilizes ConEmu, but can also introduce issues like this. If you're using the default Powershell tasks, it doesn't simply launch PowerShell as you say...it's doing a lot of other stuff too. Take a look at the vendor\profile.ps1 file in the Cmder directory to take a look. I ended up just bypassing it and specifying my own PS profile after running into an issue similar to this one.

I then came across another issue that resembled what I was experiencing on linux, and they provide a similar fix. The virtual terminal sequences aren't working correctly, supposedly due to cygwin API issues. I'd ensure you have Ansi / xterm / Inject ConEmuHK Injection enabled in ConEmu > settings > features. There's also the option to turn on Log Console Output (*) which will show you all the ANSI sequences being written to your console. That may shed some light on things.

In case it helps, here's the task definition I'm using for an admin PowerShell task. Change -new_console:a:d:%USERPROFILE% to -new_console:d:%USERPROFILE% for a regular session.

chcp 65001 & PowerShell -ExecutionPolicy Bypass -NoLogo -NoExit -NoProfile -Command "Invoke-Expression '%USERPROFILE%\Documents\WindowsPowerShell\Microsoft.Powershell_profile.ps1'" -new_console:a:d:%USERPROFILE%

I also had issues with the first powerline for powershell repo I found, and ended up switching to oh-my-posh (which just worked). I used this guide.

If it's an ANSI issue...There are also some examples for testing ANSI support on this ConEmu page, as well as a PS script in vendor\conemu-maximus5\ConEmu\Addons\AnsiColors24bit.ps1 that should output a color gradient. In Bash, I had to add a script into my boot sequence that cats Ansi escape codes to initialize TrueColor correctly. I used [32766H which resets ANSI support. Here's the powershell equivalent that's in the ConEmu Addons/AnsiColors24bit.ps1 PS script:

# Clean console contents (this will clean TrueColor attributes)
Write-Host (([char]27)+"[32766S")
# Apply default powershell console attributes
cls

Back to bash, I go. I'll leave the stuff below in case it helps someone.





What's $TERM set to? Make sure it's set to xterm|xterm-color|xterm-256color. Looks like it's just not resetting correctly, like this issue in VIM.

                         *'restorescreen'* *'rs'* *'norestorescreen'* *'nors'*
'restorescreen' 'rs'    boolean (default on)                                  
                        global                                                
                        {not in Vi}  {only in Windows 95/NT console version}  
        When set, the screen contents is restored when exiting Vim.  This also
        happens when executing external commands.                             

        For non-Windows Vim: You can set or reset the 't_ti' and 't_te'       
        options in your .vimrc.  To disable restoring:                        
                set t_ti= t_te=                                               
        To enable restoring (for an xterm):                                   
                set t_ti=^[7^[[r^[[?47h t_te=^[[?47l^[8                       
        (Where ^[ is an <Esc>, type CTRL-V <Esc> to insert it)                

I'd also make sure powerline-daemon is running to improve its performance, as well as enabling it in VIM in your environment.

At the end of my .bashrc

POWERLINE_BASH_CONTINUATION=1
POWERLINE_BASH_SELECT=1
powerline-daemon -q
. /home/username/.local/lib/python3.6/site-packages/powerline/bindings/bash/powerline.sh

In my .vimrc

python3 from powerline.vim import setup as powerline_setup
python3 powerline_setup()
python3 del powerline_setup

set laststatus=2
set noshowmode

set termguicolors
" set Vim-specific sequences for RGB colors
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
saas786 commented 7 months ago

I face a similar issue.

Since I first noticed the issue, I have freshly installed Cmder, Cygwin, and Mintty several times over the years, but the issue still persists.

ConEmu64_bVhPlRjY1l