martanne / abduco

abduco provides session management i.e. it allows programs to be run independently from its controlling terminal. That is programs can be detached - run in the background - and then later reattached. Together with dvtm it provides a simpler and cleaner alternative to tmux or screen.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot scroll

ju-w opened this issue · comments

commented

Hello. I connect to machines with SSH, but sometimes my connection drops.
I like to resume my work after reconnect without loosing my session.

I don't have need for multiplexing or anything fancy, I just want to resume where I left of.
I found dtach and abduco to be fitting for my purpose.

However there is one big showstopper in abduco:
Whenever I am connected to an abduco session, scrolling appears to be disabled.
In dtach, scrolling keeps working.

Is there a workaround or fix for this?

commented

I understand the issue now. Abduco is using The Alternate Screen Buffer of X Term when switching to an abduco session.

However, I don't think this is a good choice. Consider this example

ls -la
# we are using normal buffer and can scroll
abduco -c some bash
# abduco is using alternate buffer, we cannot see previous outputs
ls -la
# output truncated & scrolling disabled
man man
# man is now also using the alternate buffer, effectively overriding abduco
q
# now we return to abduco session from man
# returning from man disables alternate buffer in abduco as well
# we can no longer see previous output from abduco ...
ls -la
# ... but scrolling now works

As demonstrated, every programm that is also using alternative buffer, like less, vi, man, ... breaks abduco's alternateive buffer and forces it to use normal mode, kind of defeating the purpose.

Are you using xterm or a different terminal? I tried your example with rxvt-unicode (urxvt) v9.22 and both scrolling and the alternate buffer worked correctly.

@mrksmrtn could you share your urxvt defaults ?

@malikbenkirane I forgot that I had some custom settings. Probably secondaryScroll is making a difference here.

URxvt*foreground: gray90
URxvt*background: black
URxvt*font: xft:Bitstream Vera Sans Mono-12,xft:Junicode
URxvt*scrollBar: false
URxvt*secondaryScroll: true
URxvt*loginShell: true
URxvt*utmpInhibit: true
URxvt*saveLines: 8192
URxvt*fading: 50
URxvt*visualBell: true
URxvt*cursorBlink: true

Sorry about the slow reply. I've been out of town.

Scrolling up doesn't work in konsole either.

Adding to this - it also does not work in alacritty until I execute a command that requires scrolling, such as man abduco. It works after that for some reason.

workaround is to printf '\033[?1049l' as first thing in the session, or when re-connecting, edit: or just tput rmcup

The core issue is once again #32.

Conceptually it would indeed be cleaner if abduco would solely operate on the I/O level without issuing any terminal escape sequences. Note however, that simply removing the code to enter/leave the alternate screen buffer merely trades one problem for another. If you are running an interactive application in alternate screen mode and then detach it would have to be restored upon reattaching. This really needs some coordination with another utility like dvtm.

I generally have to do a ^L to get a full screen app (mutt) to repaint after I reattach, so at least an -option- to leave me in the same state I'd get via reattach then tput rmcup might be nice ... though it's really not a major obstacle to me, just it surprised me moving from dtach.

Update: 'vi, :q' is now my spirit animal and annoys me so little I really don't care either way at this point.

goes back to enjoying using the code

Haven't battle-tested it, but this function seems to pretty much instantly send the tput rmcup such that often I don't even see any kind of screen flash. This results in IMO better behavior than dtach, because there is no weird prompt-refreshing issues, and no empty commands or lines in my terminal.

function abduco-attach {
    (until abduco | grep -q "\*.*${1}"; do sleep 0.01; done && echo "tput rmcup" | abduco -a "${1}" &); abduco -a "${1}"
}

Where do you put this function? And when do you trigger it?