#StackBounty: #evil #window #scrolling centered cursor with evil-window-bottom and evil-window-top

Bounty: 50

I’m trying to achieve both:

  • persistent centered cursor (cursor stays in center of a window except when near the line 0 and count-lines-page
  • augment the way evil-window-bottom and evil-window-top work so that calling those functions scrolls to the corresponding position, then subsequently "re-centers" the cursor. This would be similar to a full page down, divided by 2

How can I do this?

I’m on Emacs version 26.3, and evil-mode version evil-git-af6ca28, although I don’t think these matter much.

I found a centered cursor implementation which works well enough for me (with the exception that it entirely breaks evil-window-bottom and evil-window-top):

(setq scroll-preserve-screen-position t
      scroll-conservatively 0
      maximum-scroll-margin 0.5
      scroll-margin 99999)

evil-window-bottom (keybind L) and evil-window-top (keybind H) no longer work because they depend on scroll-margin. I’d like to create new functions (and bind them to the same keys, L and H) such that (move-to-window-line -1) (for window bottom) or (move-to-window-line 0) (for window top) moves to the cursor position (centered in the window).

I’ve tried modifying scroll-margin, but I don’t think this can be done interactively, and doubt this is the best approach anyway. Next I’m literally looking at just overriding / replacing the definitions for the evil-window-bottom and evil-window-top functions. How should I do that? I could almost just override the functions, hardcoding scroll-margin with 0, but this wouldn’t handle the cursor position (I think). What is the recommended approach?


Get this bounty!!!

#StackBounty: #debian #tty #keyboard-layout #console #scrolling Scrolling TTY without dedicated PgUp and PgDown

Bounty: 200

My keyboard does not have separate PgUp and PgDown keys.
They are in the numpad, sharing their position with KP_9 and KP_3.

Keypad picture

Scrolling terminals with Shift+Pg{Up,Down} was not possible either with
Numlock on or off.

Since I don’t care for the keypad numbers but do care a lot for scrolling,
I have successfully remapped them in X11 to "Prior" and "Next" regardless
of Numlock state, and now Shift+{PgUp,Down} both work in Xterm.

However, I can’t achieve the same in the TTY.

Original keycodes

As of showkeys:

KP_3/KP_PgUp   = 73
KP_9/KP_PgDown = 81
Slash          = 89
Right Shift    = 54

As of dumpkeys:

PgUp   = 104
PgDown = 109

Slash and Right Shift were also listed because I will also swap them just
for testing.

Attempts

  • Modified /etc/console-setup/remap.inc to exactly this:
    keycode 73 = Prior
      shift keycode 73 = Scroll_Backward
      shift shiftl  keycode 73 = Scroll_Backward
      shift shiftr  keycode 73 = Scroll_Backward
      shift shiftl  shiftr  keycode 73 = Scroll_Backward
      shift ctrll keycode 73 = Scroll_Backward
      shift shiftl  ctrll keycode 73 = Scroll_Backward
      shift shiftr  ctrll keycode 73 = Scroll_Backward
      shift shiftl  shiftr  ctrll keycode 73 = Scroll_Backward 
    keycode 81 = Next
      shift keycode 81 = Scroll_Forward
      shift shiftl  keycode 81 = Scroll_Forward
      shift shiftr  keycode 81 = Scroll_Forward
      shift shiftl  shiftr  keycode 81 = Scroll_Forward
      shift ctrll keycode 81 = Scroll_Forward
      shift shiftl  ctrll keycode 81 = Scroll_Forward
      shift shiftr  ctrll keycode 81 = Scroll_Forward
      shift shiftl  shiftr  ctrll keycode 81 = Scroll_Forward  
    keycode  89 = Shift
    keycode  54 = slash
      shift keycode  54 = question
      altgr keycode  54 = degree
      shift altgr keycode  54 = questiondown
    
  • Followed the instructions of How to change console keymap in Linux?.
    dumpkeys > pageupdown
    

    Then swapped

    keycode 73  keycode 104
    keycode 81  keycode 109
    keycode 54  keycode 89
    

    in that file and issued loadkeys -s pageupdown.

Results

In both experiments,

  • Although the two keypad keys don’t print numbers anymore and PgUp still
    works (it scrolls in less) as desired, Shift+PgUp does not scroll the TTY.
  • Right Shift and Slash have been correctly swapped.

Additional notes

  • Toggling Numlock does not help in any of the configurations. The Fn key
    also does not have any effect in those keys.
  • I have also tried mapping more
    ordinary keys, namely l and p, to the Page actions, without success.
  • If it helps in any way, this is the XKB map that works in the X session:
    partial keypad_keys
    xkb_symbols "noKPNumbers" {
        key  <KP9> {  [  Prior,   Prior   ]   };
        key  <KP3> {  [  Next,    Next    ]   };
    };
    

How can I map the keypad PgUp and PgDown keys in such a way that Shift+Pg{Up,Down}
scroll the TTY buffer? Is it possible at all?


Get this bounty!!!

#StackBounty: #gnu-screen #remote #terminal-emulator #scrolling How to scroll screen within screen with the outer screen keybindings?

Bounty: 150

I run a screen session locally on my laptop. Within that screen session, I connect via ssh to a server on which I do most of my work. Since that connection gets reset sometimes (e.g. VPN timing out), I run a screen session on the server as well so that I can reconnect to it and have my shell exactly as it was.

So my workflow is: wake laptop, switch to terminal, find local screen session running but a message showing connection timed out, ssh to my server, run screen -x to reconnect to the screen session on the server, and do my work.

The ~/.screenrc file on the server just contains one line, altscreen on. Otherwise all my custom screen stuff (including customizing the meta-character to be Ctrl-Space, and having a status bar with window names) is on my laptop only. (I also have altscreen on in my laptop’s .screenrc file.)

The upshot of this is that I can control the remote screen session using Ctrl-A (the default) and I can control the local screen session using Ctrl-Space. I don’t normally control the remote screen session or do anything with it except connect to it—but that’s where my question comes in.

Currently, if I try to scroll back on the remote server using Ctrl-Space+[, it doesn’t work correctly. I may see the contents of previous Vim buffers I had open, or other stuff. To scroll back on the remote server, I have to use Ctrl-A+[.

How can I make it so I can scroll normally, i.e. using Ctrl-Space+[, and see the proper scrollback history for my shell on the remote server? In other words, I want to pretend that screen doesn’t even exist on the remote server, since I want to use it ONLY for purposes of resuming my work where I left off before the connection was interrupted.


Get this bounty!!!

#StackBounty: #scrolling #redraw Flicker during scroll in single window?

Bounty: 100

enter image description here

If I run vim without tmux in urxvt v9.22 or xterm 330, it flicks after a full screen scroll.

$ seq 1000 >test
$ vim --clean test

execute G or /13$ and nnnnnnn, you should see it flickers. If you split your window with <c-w>v, the flicker vanishes away. If you maximize current window with <c-w>|, it still doesn’t flicker. Looks like it only flicks when there is only 1 window.

gnome-terminal don’t have this problem.

All test done in 256color terminfo, ubuntu18.04, vim8.2 1-803

How to deal with it?

Update

FWIW, scroll in terminal doesn’t flicker, scroll in neovim doesn’t flicker, only scroll in vim flicker.

I have tried apt version vim, and compiled vim7.4, 8.1, 8.2, and tried a version from some ppa, no luck.

I have tried to compile urxvt from here, no luck.

This is my rxvt, it’s the only xresource.

This is my current vim

Have tried to turn off buggy options:

*.jumpScroll: false
*.borderLess: false
*.transparent: false

still no luck.

Update

Just learned to record terminal session by script, the result for urxvt and tmux inside urxvt (top one is urxvt):

113^M^[[?25l^[[27m^[[23m^[[29m^[[m^[[H^[[2J^[[1;1H102
113^M^[[?25l^[[27m^[[24m^[[23m^[[0m^[[H^[[J^[[1;1H103

113<cr> search 113, it cause a fullscreen scroll , then vim hide cursor, turn off invers, italic, cross-out, reset sgr ( the ^[[m or ^[[0m ), place cursor at 1,1, clear screen, place cursor at 1,1 ,start display new content (102 or 103 in the trail) . The biggest difference is the clear_screen (t_cl in termcap) escape sequence, urxvt use ^[[H^[[2J, tmux use ^[[H^[[J, I tried to use tmux t_cl in urxvt , but still no luck.

I don’t use xterm, you can post answer that only work for urxvt, any help is appreciated.


Get this bounty!!!

#StackBounty: #18.04 #mouse #scrolling #mouse-scroll Why is there nothing related to scrolling speed in xinput for Microsoft Comfort Mo…

Bounty: 50

Before I go randomly installing any additional software, I’d like to understand how xinput works and why there’s nothing related to scrolling speed for my mouse.

Could you please enlighten me?

Ubuntu 18.04.1 LTS x64, GNOME 3.28.2 (not sure if it matters). Up to date.

$ xinput list
⎡ Virtual core pointer                      id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ ETPS/2 Elantech Touchpad                  id=11   [slave  pointer  (2)]
⎜   ↳ Microsoft Microsoft® Comfort Mouse 4500   id=14   [slave  pointer  (2)]
⎣ Virtual core keyboard                     id=3    [master keyboard (2)]
    ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
    ↳ Power Button                              id=6    [slave  keyboard (3)]
    ↳ Video Bus                                 id=7    [slave  keyboard (3)]
    ↳ HP TrueVision HD Camera: HP Tru           id=8    [slave  keyboard (3)]
    ↳ Intel Virtual Button driver               id=9    [slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard              id=10   [slave  keyboard (3)]
    ↳ HP Wireless hotkeys                       id=12   [slave  keyboard (3)]
    ↳ HP WMI hotkeys                            id=13   [slave  keyboard (3)]
    ↳ Microsoft Microsoft® Comfort Mouse 4500   id=15   [slave  keyboard (3)]
    ↳ Chicony USB Keyboard                      id=16   [slave  keyboard (3)]
    ↳ Chicony USB Keyboard                      id=17   [slave  keyboard (3)]

Details of the mouse under “pointers”:

$ xinput list-props 14
Device 'Microsoft Microsoft® Comfort Mouse 4500':
    Device Enabled (142):   1
    Coordinate Transformation Matrix (144): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
    libinput Natural Scrolling Enabled (289):   0
    libinput Natural Scrolling Enabled Default (290):   0
    libinput Scroll Methods Available (293):    0, 0, 1
    libinput Scroll Method Enabled (294):   0, 0, 0
    libinput Scroll Method Enabled Default (295):   0, 0, 0
    libinput Button Scrolling Button (727): 2
    libinput Button Scrolling Button Default (728): 2
    libinput Middle Emulation Enabled (729):    0
    libinput Middle Emulation Enabled Default (730):    0
    libinput Accel Speed (296): -0.258993
    libinput Accel Speed Default (297): 0.000000
    libinput Accel Profiles Available (731):    1, 1
    libinput Accel Profile Enabled (732):   1, 0
    libinput Accel Profile Enabled Default (733):   1, 0
    libinput Left Handed Enabled (298): 0
    libinput Left Handed Enabled Default (299): 0
    libinput Send Events Modes Available (266): 1, 0
    libinput Send Events Mode Enabled (267):    0, 0
    libinput Send Events Mode Enabled Default (268):    0, 0
    Device Node (269):  "/dev/input/event16"
    Device Product ID (270):    1118, 1900
    libinput Drag Lock Buttons (300):   <no items>
    libinput Horizontal Scroll Enabled (301):   1

Only parts related to scrolling:

$ xinput list-props 14 | grep -i 'scroll'
    libinput Natural Scrolling Enabled (289):   0
    libinput Natural Scrolling Enabled Default (290):   0
    libinput Scroll Methods Available (293):    0, 0, 1
    libinput Scroll Method Enabled (294):   0, 0, 0
    libinput Scroll Method Enabled Default (295):   0, 0, 0
    libinput Button Scrolling Button (727): 2
    libinput Button Scrolling Button Default (728): 2
    libinput Horizontal Scroll Enabled (301):   1

Details of the mouse under “keyboard”:

$ xinput list-props 15
Device 'Microsoft Microsoft® Comfort Mouse 4500':
    Device Enabled (142):   1
    Coordinate Transformation Matrix (144): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
    libinput Send Events Modes Available (266): 1, 0
    libinput Send Events Mode Enabled (267):    0, 0
    libinput Send Events Mode Enabled Default (268):    0, 0
    Device Node (269):  "/dev/input/event16"
    Device Product ID (270):    1118, 1900


Get this bounty!!!

#StackBounty: #neovim #scrolling #terminal-buffer How to follow the output of a command in a terminal window

Bounty: 200

I recently decided to give a try at neovim and one thing is bothering me:

I use a terminal window to run my code watcher i.e. a never ending command which outputs new lines each time I write a buffer.

If I put my cursor on this window and use G the window will keep track of the output and I will always see the last lines of the output as long as I don’t switch of window.

If I change of tab or of window, the window containing the terminal buffer stops scrolling and I have to go back to this window and use G again to see the end of my output.

If feel like I’m missing something but I wasn’t able to find a solution to this problem. I guess I could have an autocommand on TabEnter and for example which would find a terminal buffer in the new tab and use norm! G in it but that feel kind of overkill (plus that wouldn’t solve the problem if I have two split buffer and I work on the one next to the terminal buffer). Is there a simple solution to this problem?

EDIT Here are the steps to reproduce my issue:

Create a file and continuously write in it from the shell:

  • touch foo
  • while; do; echo 'a' >> foo; sleep 1; done

Start neovim without any config:

  • nvim -u NONE -U NONE

In neovim:

  • :term tail -f foo To open a terminal with a continuous output
  • Go to insert mode and add an empty line to follow the output then go to normal mode and G
  • :tabnew

Wait a few seconds

When going to the first tab, the empty line should have changed of place, for me it doesn’t.


Get this bounty!!!

#StackBounty: #xorg #resolution #scrolling #virtual-desktop How to disable fullscreen mouse scrolling?

Bounty: 50

On programs that run in “fullscreen” mode, when I change the “fullscreen” resolution to something that is lower than what my desktop resolution is, I can scroll past the edges of the program by moving my mouse to the edge of the screen and see my desktop. This is really buggy and actually crashed my system, on top of being incredibly annoying.

How do you disable this? I don’t even know what it is called, and I can’t find ANYTHING except for this, really, unanswered question from 2003: https://www.linuxquestions.org/questions/linux-software-2/disabling-virtual-screen-mouse-scrolling-in-x-111237/

If anybody wants to see an example, then you can probably do it yourself by installing SuperTux 2, changing the fullscreen resolution to something like 640×480, then checking the fullscreen box, and moving your mouse to the edge of the screen.


Get this bounty!!!