LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
LinkBack Search this Thread
Old 03-13-2008, 01:33 PM   #1
deepclutch
Member
 
Registered: Nov 2004
Distribution: Debian Testing+Sid
Posts: 694
Blog Entries: 1

Rep: Reputation: 32
Smile "less" command output-I cannot scroll through it !


Hi all,
well,I am on archlinux with kdemod.
now,in konsole I can scroll through the output and even scroll through file contents in nano or vim
editors.
But,if I use "less" utility,
like "less /var/log/auth.log"
I cannot scroll with mouse wheel!
although,pageup ,pagedown etc works.
what should I look for?my env variables seems fine.and "less" is the latest version/
waiting....pls reply

Thanks
 
Old 03-13-2008, 11:32 PM   #2
deepclutch
Member
 
Registered: Nov 2004
Distribution: Debian Testing+Sid
Posts: 694
Blog Entries: 1

Original Poster
Rep: Reputation: 32
guys,Im clueless.pls help me
 
Old 03-13-2008, 11:59 PM   #3
konsolebox
Senior Member
 
Registered: Oct 2005
Distribution: Gentoo, Slackware, LFS
Posts: 2,242
Blog Entries: 15

Rep: Reputation: 233Reputation: 233Reputation: 233
less simply only accepts standard (keyboard) input.. perhaps it's possible but i'm not sure if less can be configured to accept input from /dev/mouse or the like and let it process the mouse input.

To get things a little bit clearer, konsole only manipulates output that was already written in the screen.. while less reclears and then reprints again data back and forth for every key command like up, down, pageup or pagedown etc. konsole doesn't care what program runs within it as long as it caches every output and that's it. try cat-ing a file in konsole then do 'clear' and then scroll up you'll see that still a remaining of the texts where not cleared. That's because only a little part of the lines where cleared and some of the caches still remains..
 
Old 03-14-2008, 12:13 AM   #4
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 62
Curiously, gnome-terminal will somehow translate mouse wheel events into a form which less can understand. konsole doesn't do this. I never got round to finding out how gnome-terminal does this, or if it's possible to get konsole to do it. I would like to know!
 
Old 03-14-2008, 12:47 AM   #5
konsolebox
Senior Member
 
Registered: Oct 2005
Distribution: Gentoo, Slackware, LFS
Posts: 2,242
Blog Entries: 15

Rep: Reputation: 233Reputation: 233Reputation: 233
Hello matthewg42. I'm interested to make that happen.. can you tell me how gnome-terminal was able to make less understand mouse wheel events? It seems that it doesn't work as default in a gnome terminal of a box near me.
 
Old 03-14-2008, 12:53 AM   #6
deepclutch
Member
 
Registered: Nov 2004
Distribution: Debian Testing+Sid
Posts: 694
Blog Entries: 1

Original Poster
Rep: Reputation: 32
gnome-terminal works fine.
but the weird thing is ,I can scroll through file contents in vim/nano using mouse wheel :? also throught any output in konsole!for eg:cat /etc/issue o/p :|
xterm also does not support the scrolling of "less" contents

and mouse device is (I use a 3 button logitech optical mouse with a wheel+button) /dev/input/mice in my Debian as well as archlinux.
/dev/psaux,/dev/input/mouse0,/dev/input/mouse1 etc exists.



what can be done?Is there some env variable that messes whole thing?
Thank you all!
 
Old 03-14-2008, 01:05 AM   #7
konsolebox
Senior Member
 
Registered: Oct 2005
Distribution: Gentoo, Slackware, LFS
Posts: 2,242
Blog Entries: 15

Rep: Reputation: 233Reputation: 233Reputation: 233
Quote:
Originally Posted by deepclutch View Post
gnome-terminal works fine.
but the weird thing is ,I can scroll through file contents in vim/nano using mouse wheel :? also throught any output in konsole!for eg:cat /etc/issue o/p :|
xterm also does not support the scrolling of "less" contents

and mouse device is (I use a 3 button logitech optical mouse with a wheel+button) /dev/input/mice in my Debian as well as archlinux.
/dev/psaux,/dev/input/mouse0,/dev/input/mouse1 etc exists.

what can be done?Is there some env variable that messes whole thing?
Thank you all!
are you sure you're seeing the keyboard cursor in vim move up and down or just the terminal? you can verify this if position number in lower right ofthe screen changes during scroll.
 
Old 03-14-2008, 01:14 AM   #8
deepclutch
Member
 
Registered: Nov 2004
Distribution: Debian Testing+Sid
Posts: 694
Blog Entries: 1

Original Poster
Rep: Reputation: 32
no,cursor and select tool(gpm?) rests where it was at original position.while the terminal scrolls fine up and down directions.

if I press left mouse button somewhere,the cursor and select tool comes there. weird is that "less" is not achieving this!.

out of curiousity,any konsole user can confirm whether "less" allows scrolling in konsole?
 
Old 03-14-2008, 09:52 AM   #9
deepclutch
Member
 
Registered: Nov 2004
Distribution: Debian Testing+Sid
Posts: 694
Blog Entries: 1

Original Poster
Rep: Reputation: 32
pss... help?
 
Old 03-14-2008, 12:04 PM   #10
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 62
Quote:
Originally Posted by konsolebox View Post
Hello matthewg42. I'm interested to make that happen.. can you tell me how gnome-terminal was able to make less understand mouse wheel events? It seems that it doesn't work as default in a gnome terminal of a box near me.
I don't know how it works. Just that it does on Ubuntu 7.10.
 
Old 03-14-2008, 02:02 PM   #11
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 69
Quote:
Originally Posted by matthewg42 View Post
Curiously, gnome-terminal will somehow translate mouse wheel events into a form which less can understand. konsole doesn't do this. I never got round to finding out how gnome-terminal does this, or if it's possible to get konsole to do it.
There is a hackish way to do this externally. Use the imwheel daemon to bind to Konsole windows of a specific window title and translate mouse scroll events as arrow key movements. Then, make an alias to less which changes the window title, runs less with whatever arguments, and then reverts the title.
 
Old 03-14-2008, 02:35 PM   #12
ararus
Member
 
Registered: Mar 2008
Location: UK
Distribution: Slackware
Posts: 56

Rep: Reputation: 15
Quote:
can you tell me how gnome-terminal was able to make less understand mouse wheel events? I
You can't make less understand mouse events. Mouse events are a GUI concept, less is a console application.

You can, however, as matthewg42, stated, have the xterminal program translate mouse events into suitable key presses.

Rxvt (and I guess Xterm) uses the sequences '\e[?1000h' and '\e[?1000l' to turn mouse reporting on/off respectively. I don't use KDE but I would imagine that Konsole supports those sequences too.

Just echo it to the console, make sure you use the -e option to enable escape character processing, i.e.

echo -e '\e[?1000h'

Of course, that just dumps the translated escape sequence to the console, getting a program to understand them is another matter, but as long as the app has configurable key bindings (well, key sequence bindings), it should be easy enough.

Note that you will see just a bunch of crap on the screen because your shell will attempt to interpret the sequence. Use a program that reads from stdin (e.g. tail or hexdump without args) and you will see the actual escape sequence, something like: '^[[M#i'

hexdump might be better than tail, as it will show you the ascii codes of the characters (could be a space in there or something).

With rxvt (I assume xterm etc is the same), the output is in the format:

ESC [ M <b> <x> <y>

b is the button number (0, 1, or 2 for first, second, third button)

Annoyingly though, button releases are not interpreted individually, you just get a button number of 3 on release regardless of which button was released. Still, that shouldn't be a big deal, as most console apps will act on the press (for scrolling etc), not the release.

x y is the character position on screen, of course.

Last edited by ararus; 03-14-2008 at 02:47 PM.
 
Old 03-14-2008, 04:13 PM   #13
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,950
Blog Entries: 11

Rep: Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860
Quote:
Originally Posted by deepclutch View Post
guys,Im clueless.pls help me :)
But that doesn't warrant ignoring our rules.

DON'T bump your posts before 24 hours are up.



Cheers,
Tink
 
Old 03-14-2008, 04:14 PM   #14
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,950
Blog Entries: 11

Rep: Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860
Quote:
Originally Posted by deepclutch View Post
pss... :( help?
And again. Stop that. You've been on LQ for long
enough to know better.



Cheers,
Tink
 
Old 03-14-2008, 11:22 PM   #15
konsolebox
Senior Member
 
Registered: Oct 2005
Distribution: Gentoo, Slackware, LFS
Posts: 2,242
Blog Entries: 15

Rep: Reputation: 233Reputation: 233Reputation: 233
Quote:
Originally Posted by ararus View Post
You can't make less understand mouse events. Mouse events are a GUI concept, less is a console application.

You can, however, as matthewg42, stated, have the xterminal program translate mouse events into suitable key presses.
Sorry i bypassed in my question.. that' what i really mean.. doing some kind of mouse wheel event wrappers that will send messages to less that less can understand. If we make less directly read the mouse, it would require a whole new addition of codes to less.

But nice and cool info. I'll try that when I get back to my linux box. Have a nice weekend.
 
  


Reply

Tags
archlinux, less, scroll


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Standard commands give "-bash: open: command not found" even in "su -" and "su root" mibo12 Linux - General 4 11-11-2007 10:18 PM
change "who" command output khairilthegreat Linux - Newbie 5 07-26-2007 02:36 AM
unknown entry in the output of "df -h " command Balakrishna Linux - Newbie 1 12-19-2006 12:17 AM
how do i remove unwanted charaters at "script" command output? linuxzouk Linux - Newbie 4 05-15-2004 07:58 AM
qmail: strange output of "file" command slowleak Linux - Security 1 08-10-2001 10:40 PM


All times are GMT -5. The time now is 06:38 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration