Announcement

Collapse
No announcement yet.

gpm mouse support for vim in the linux console

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [SOLVED] gpm mouse support for vim in the linux console

    I participate a little, on and off, in the vim project, mostly via the vim_dev group on Google groups, and the vim/vim project on Github. I'm looking into an issue reported there with the mouse support for vim in the linux console (what you get by typing Ctrl-Alt-F2, F3, F4, F5 and F6; get back to X with Ctrl-Alt-F1, or Ctrl-Alt-F7 on older versions of Kubuntu). On my Disco it's very broken, driving vim to 100% CPU and processing one mouse event every key press. Trying to find what code change caused this I booted some old isos:
    Code:
    OS                gpm      kernel    vim      result
    Ubuntu 16.04.5    1.20.4   4.15.0    7.4.1689  fail
    Ubuntu 18.04      1.20.7   4.15.0    8.0.1453  fail
    Gentoo            1.20.7   4.14.70   8.0.1298  pass
    
    (The Gentoo was from systemrescuecd 5.3.1.)
    This suggests gpm support in vim has been broken for years on Ubuntu, which doesn't make sense, surely someone would have reported it. Maybe it's only on my hardware, but why then does it work on systemrescuecd? Mouse support in nano has no trouble.

    I'd appreciate it if anyone here could try it out and report whether it works on their systems, whatever version of Linux they run. Neither vim with mouse support nor gpm are installed by default on Ubuntu, just vim-tiny which does not have mouse support. So if you want to check it out, install "vim" or "vim-gtk" or "vim-gnome", and gpm, and login to a Linux console, start vim and type
    Code:
    :set mouse=a
    :help
    and see if you can position the cursor and select text with the mouse. Type :qa! to exit vim.
    Regards, John Little

    #2
    On Neon unstable (18.04) I can highlight text with the mouse, but it doesn't select it.
    So I can't copy it.
    Right-click does nothing. Shift-Ctrl-C does nothing. Shift-Ctrl-V pastes my current clipboard.
    The "Copy" option in the window menu is greyed out.
    The "Paste" one is not.

    I can click on green links to go to sections of help.
    If I highlight a portion of a line that contains a green link, the link itself moves one space to the right.
    I de-highlight it, it goes back.
    Last edited by Don B. Cilly; Aug 21, 2019, 11:28 PM.

    Comment


      #3
      Originally posted by Don B. Cilly View Post
      On Neon unstable (18.04) I can highlight text with the mouse, but it doesn't select it.
      So I can't copy it.
      Right-click does nothing. Shift-Ctrl-C does nothing. Shift-Ctrl-V pastes my current clipboard.
      The "Copy" option in the window menu is greyed out.
      The "Paste" one is not.
      Are you sure you're running a real text console (tty) and not just a console window in your GUI interface?

      @jlittle
      Primary selection-paste works fine here in vim in a text console...left-click hold to select, middle-click to paste.
      I didn't check the resource load, but I can if you wish.

      Comment


        #4
        I wasn't. Because I got no mouse at all if I typed :set mouse=a.
        I had totally missed the "install gpm" bit :·)

        With gpm, in a full text console, I get a square cursor. It does nothing except move around, and after a few tries, it makes the arrow keys go wild, and if I go back to KDE, I see one CPU core of four at 100%.
        Exiting vim (quite a colourful experience ;·) stops it.

        Comment


          #5
          Thing is, it may be a gpm issue rather than a vim one.
          If I use nano -m, I get a square cursor that does nothing except move around, and makes the arrow keys go wild...

          Comment


            #6
            Originally posted by kubicle View Post
            Primary selection-paste works fine here in vim in a text console...left-click hold to select, middle-click to paste.
            Paste, and select by left-click hold and drag, doesn't require vim to interact with the mouse. This works without giving vim the the :set mouse=a command, or if vim does not have gpm mouse support compiled in. With a simple left-click, does vim's cursor move (assuming there's text for the cursor to move to)?
            Regards, John Little

            Comment


              #7
              Originally posted by Don B. Cilly View Post
              With gpm, in a full text console, I get a square cursor. It does nothing except move around, and after a few tries, it makes the arrow keys go wild, and if I go back to KDE, I see one CPU core of four at 100%.
              Exiting vim (quite a colourful experience ;·) stops it.
              Thank you, this is the failure I'm investigating. What version of Kubuntu was that with?
              Regards, John Little

              Comment


                #8
                Neon unstable (which is basically18.04 with Plasma 5.16.80). 5.0.0-25 kernel.
                VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Jun 06 2019 17:31:41) Included patches: 1-1453
                gpm 1.20.7
                Last edited by Don B. Cilly; Aug 22, 2019, 07:56 AM.

                Comment


                  #9
                  Originally posted by Don B. Cilly View Post
                  Thing is, it may be a gpm issue rather than a vim one.
                  If I use nano -m, I get a square cursor that does nothing except move around, and makes the arrow keys go wild...
                  nano -m works for me as I think it is supposed to, in that a single click moves the cursor. Clicking and dragging does not do what I expect, but I think it's what nano does. In the Linux console nano -m works for me the same way that in does in a konsole, equally hard to understand, so I think it is working with gpm.
                  Regards, John Little

                  Comment


                    #10
                    Originally posted by jlittle View Post
                    Paste, and select by left-click hold and drag, doesn't require vim to interact with the mouse. This works without giving vim the the :set mouse=a command, or if vim does not have gpm mouse support compiled in. With a simple left-click, does vim's cursor move (assuming there's text for the cursor to move to)?
                    Well, you're right, the cursor doesn't move. Never noticed it because I don't really use the mouse in vim (especially in a text console).

                    In nano mouse seems consistent between tty and GUI (in the limited way you can use the mouse in nano).

                    However, I did not experience any resource hogging when using vim+mouse in the tty (I had htop running on another tmux session to monitor).

                    Comment


                      #11
                      Well, in nano all the mouse does for me is "set marks".
                      Both in tty and Konsole.
                      But it doesn't do the CPU thing.

                      Comment


                        #12
                        Someone did some hard work debugging this, and it's been fixed, in vim 8.1.1948. My thanks to the respondents here.

                        To check out the gentoo situation, I did a gentoo install. We really have it easy with Kubuntu, and Ubuntu and debian generally. I should have done it in a VM, or with another system along side; I had to write down pages of instructions. And that was with doing lots of stuff from Kubuntu, like editing files, and with my understanding of things like /etc/fstab and grub.
                        Regards, John Little

                        Comment


                          #13
                          Osboxes have a ready-made Gentoo Virtualbox image with KDE and all.
                          It's big (4Gb), but it's all set up
                          The CLI one is "only" 1.2 Gb.

                          Comment

                          Working...
                          X