FarGroup / FarManager

File and Archive Manager
https://farmanager.com
BSD 3-Clause "New" or "Revised" License
1.77k stars 194 forks source link

Increasing the Far3 window size creates panel artifacts in the console window #772

Open yulian5 opened 7 months ago

yulian5 commented 7 months ago

Far Manager version

3.0.6249.0

OS version

Windows 7, 10, 11

Other software

No response

Steps to reproduce

Increase windows size, mostly width, by dragging by the corner or border, or increase width through Windows Properties->Layout->Windows Size->Width. Switch to Console window (Ctrl+O).

It maybe related to similar issues #765 and #257

Expected behavior

Clean Console window.

When having a few monitors with different resolutions (like laptop with external monitors) it's quite frequently requited to resize windows including Far3.

Actual behavior

Multiple artifacts from Panels drawing:

When dragging for the corner:

Far3 6249 resizing

When using Properties->Layout->Windows Size->Width:

Far3 6249 properties_width_change

Problem exists with Legacy console too. Loos like Far 2.0 doesn't have that problem.

Zeroes1 commented 7 months ago

Do you have a portable Far3 for WT portable mode?

@yulian5 yep, i use far + wt portable my e-mail: zeroes1@gmail.com

FAR portable: Far.exe.ini UseSystemProfiles=0 UserProfileDir=%FARHOME%\Profile UserLocalProfileDir=%FARHOME%\Profile

WT portable: canary build or relis/preview ZIP version download inside dir need exist file: .portable after this settings store at: Terminal home dir\settings\

yulian5 commented 7 months ago

There are at least 2 Far2 Linux ports: far2l (popular enough) and far2m (less known).

Hi @shmuz , yes, I tried far2l a few years ago. I didn't know about far2m. Thanks!

far2l(m) is using Wine, it's not a native port, I talked about. To port Far3 to Linux will be the titanic work.

I also tried Midnight Commander, Krusader, Double Commander. I don't use any of them: the common problems are missing functionality, freezes or crashes, slow rendering.

Best results I had recently on Linux with Far3 under Wine on a few different distros but I also had a lot of problems with settings, colors, desktop shortcut link and dropped it. Linux shells or native file managers still look better for me.

Maybe I need to try far2l/far2m again. What are the main differences between them?

yulian5 commented 7 months ago

Hi @alabuzhev,

Heavy rain all Saturday helps me to debug this problem. It looks like I found the root cause.

At least with small change in Far code it's possible to remove all visual artifacts. I used today's code from github to build Far. Here is result of multiple resizing with original github code:

Far org

Here is the same console with applied code change after much more heavy resizing:

Far mod

The change is in file "far\savescr.cpp", line 180, to disable code after comment "// achtung, experimental":

SyncWithConsole = false;

179    }
180    SyncWithConsole = false;  // New code, disable conditioned code
181    // achtung, experimental
182    if (SyncWithConsole)
183    {

The issue is introduced a long time ago. I see nothing wrong with that code, except it may need some synchronization with other related code as Conhost is running in separate thread and resizing happens in a few overlapping steps usually.

But when this code read console buffer in lines 197 or 226

console.ReadOutput(Tmp, ReadRegion)

console output is already broken. Setting this flag SyncWithConsole to false, which is essentially (Global->Opt->WindowMode != 0), to disable code in lines 183-248 help to remove all visual artifacts with absolutely clean console output (except truncated lines, which we'll address separately).

shmuz commented 7 months ago

@yulian5 far2l and far2m contain some Wine code inside them but they do not have dependency on Wine - they do not run under Wine and they may be considered as native Linux/BSD/Mac applications.

far2m differs from far2l mainly by its macro-system (which is almost identical to that of Far3) and (while preserving the Far2 plugins API) it has some API extensions (mostly borrowed from Far3).

alabuzhev commented 7 months ago

The change is in file "far\savescr.cpp"

Thanks for having a look. The idea of this code is to preserve the text in the shaded area as we make the window larger or smaller:

image

It did work more or less reliably back in the day. There were quite a few changes in conhost in the recent years and something might have stopped working at some point.

yulian5 commented 7 months ago

@Zeroes1

yep, i use far + wt portable

Thanks for the info!

and @trexinc

Far installer has options to install it for the current user and for all users. What do you think: Does it make sense to add option "Install in Portable Mode"? It will be convenient.

yulian5 commented 7 months ago

@shmuz

far2m differs from far2l mainly by its macro-system (which is almost identical to that of Far3) and (while preserving the Far2 plugins API) it has some API extensions (mostly borrowed from Far3).

Looks very interesting. Thanks! I'll check it out.

HamRusTal commented 7 months ago

Does it make sense to add option "Install in Portable Mode"?

This is strictly off-topic in this issue, especially in addition to its almost 60 comments already. Please create a new Discussion for this.