juliusHuelsmann / st

Repatch repository of developed 'Vim Browse' and 'Alpha Focus Highlight' patches for simple terminal (st).
https://st.suckless.org/patches/alpha_focus_highlight/
MIT License
28 stars 11 forks source link

Vim-browse patch: Moving through history while a program prints to the screen #29

Closed szatanjl closed 4 years ago

szatanjl commented 4 years ago

Hi,

On release page I can read this: "The following two 'Bugs' will be resolved by removing the dependency on the Scrollback patch which is currently work in progress: (...)".

My questions are:

juliusHuelsmann commented 4 years ago

Hi!

Problem description The problem I list as bug basically breaks down to the fact, that moving through history when a program currently writes output into the terminal is not possible; it overrides the wrong position in the terminal. You can observe this behavior for instance, if you

ping www.google.de

, then enter Normal mode, and try to move through the history while this command executes.

Cause of the problem This is caused by the fact, that the scrollback patch only models one current position, which is used to insert 'new content' (like the output of a program which is currently running). In order to move through the history while a program is running, it is necessary to have two distinct positions (one which indicates the currently inspected position in the history, and a second one which is used to insert new content). In order to 'fix' this issue, and to solve a few other ones (keep content in lines after resizing, variable length lines ...) I started implementing my own history patch as a replacement of the scrollback patch, which I planned to use in vim-browse.

So I use the word 'bug' only in the sense of 'behavior which I would like to change', not in the sense of a really harmful bug, like segfaults.

Timeline

Do you have an idea on when the dependency on scrollback patch will be removed and those bugs fixed?

I started writing my own "history" patch in order to replace the scrollback patch, but did not finish writing it (and won't do so in the foreseeable future due to lack of time). One issue with my current attempt to writing a scrollback patch replacement is, that I try to fix multiple problems at once, and therefore change a lot of the original st code, which might make it more difficult to apply the patch if other patches are already applied.

Current work on this issue

I can see a lot of branches. Is one of them the "work in progress" of vim-browse not based on scrollback?

Not exactly, the only two active patch branches are the plainVimPatchV1 and the plainAlphaPatchV1, the other branches are either feature requests which are too custom to make it into one of the patches, or branches for porting the two patches to a more recent version of st. However, I started writing the scrollback patch replacement on the branch historyPatch some time ago, but I did not finish it.

Current state of the history patch I don't think this branch is of much use, as the current version I highlight the repainted areas in different colors in order to debug edge cases and improve repainting, and if I remember correctly there is at least an issue with ALT screen applications. The branch is by no means stable, but the core issue is fixed, you can repeat the ping experiment from above, and it does not screw up the output. Note however, that the vim patch is not applied, this patch has simple "move through history' features just for testing purpose.

I planned to implement the vim patch which is not based on the scrollback patch plainVimPatchV2, or separate the implementation of the vim patch from the history patch in uses underneath. The sole point of interaction is the API to get the current position, which can be kept similar for both solutions, s.th. it stays possible to maintain the vim patch with both underlying history patches.

The status of the implementation is tracked in the issue #6.

szatanjl commented 4 years ago

I see. Thank you for comprehensive answer.

juliusHuelsmann commented 4 years ago

I released the history-patch and thus removed the scrollback-patch dependency in the new version of the vim patch. The updated patch is available here or can be extracted from the history-patch dev repo.

szatanjl commented 4 years ago

Awesome. I will take a look at it once I find some time. Thank you.