This is a read-only archive. Find the latest Linux articles, documentation, and answers at the new Linux.com!

Linux.com

Feature: Tools & Utilities

Trowser: A graphical less command that is more

By Bruce Byfield on October 15, 2007 (4:00:00 PM)

Share    Print    Comments   

Translating a command line tool to a graphical interface usually means a loss of functionality. However, in the case of the newly released trowser text browser, while I wouldn't swear that the transition has retained all the functionality of the less command that it is intended to replace, I doubt that anyone short of an expert is likely to notice the difference. Not only does trowser offer a comparable wealth of key bindings for moving about displayed text files, but it also adds such features as custom highlighting, a search history, and bookmarks as well. The result is an easy-to-use tool for developers who browse code listings, or anyone who browses log files, HTML pages, or other plain text files.

Trowser is currently available as a compressed tar file, with no installation script. Instead, users need to check that they have Tcl/Tk 8.4.0 installed on their system, then copy the executable to /usr/bin and the man page file to /usr/share/man. The first time you use trowser, the program creates a .trowserc file in your home directory. This arrangement may lack sophistication, but has the advantage of making the program easy to remove after a trial.

Trowser starts from the shell, with the command followed by the plain text file you want to edit. If you choose, you can use the -t or -h option to set the number of bytes to display, measured from either the start or the end of the file. You also have the option at any time of discarding all of the file above or below the current cursor position.

Your chosen file displays in a window that, as might be expected from the widget set, is quick to appear but blocky and antiquated by the standards of users accustomed to Qt or Gtk2. Fonts are decidedly unaliased, although you have the option of using any font installed on the system; for maximum readability, I recommend a bold sans serif font, set to 12 points instead of the default 9. Similarly, lines are not wrapped to the window, which can necessitate plenty of horizontal scrolling, and, in the middle of a search, sometimes causes the window's content to look as though it is having a fit of epilepsy. Nor are the top menu items -- Control, Search, and Bookmark -- exactly conventional, although they are easy enough to figure out in context.

However, if you can overlook such limitations (and I suspect that many of the developers at whom the program is aimed at probably can), trowser offers a convenient, easy-to-use set of tools. You enter search items in the bottom of the main window, using regular expressions if you choose, and specify whether to search for the last, previous, or all instances of the search text, and whether to match letter case. All lines containing the search term are highlighted, and you can abstract them to a separate window by selecting Search -> List search matches so that you can compare them more easily. You can also highlight a line and add it to the Search Matches window without going through a search.

After a successful search, you can open Search -> Edit highlight patterns to add the search to the Color highlights list. There, you can right-click and select Edit markup from the popup menu to assign unique colors or shadings for the background and foreground of the currently selected search. In addition, you can give the results of a search one of half a dozen types of borders, and set the distance between search results and the lines above or below them -- all of which allows you to create complex visual identities for as many search results as you choose, making them easy to identify in the main window.

At any time, too, you can open the Search history from the Search menu to repeat a search. This feature is especially welcome when using regular expressions, the more complex of which can be difficult to type.

In addition to searching, trowser supports adding bookmarks, which are indicated by a blue dot at the start of a line. As with search results, you can view bookmarks in a list in a separate window. You may also choose to save them to a file with a .bok extension for later use.

As you scroll through a selected file, you can use the scroll bars or the arrow keys if you prefer, but trowser also supports a wide variety of Vim-inspired keyboard shortcuts. According to the project's home page, trowser is "designed to allow browsing via the keyboard at least to the same extent as less," and it certainly appears to succeed.

Trowser does depart from Vim's bindings in several places, such as using i to insert the current line into the Search Matches window. Other differences, such as standardizing that n searches backward and N searches forward, rather than using N to reverse the search direction as in Vim, may be harder to remember for advanced Vim users, even if they are more rational. However, such differences are relatively few, and are more than offset by the much larger number of similarities in keybindings.

The choice of widgets aside, my only real objection to trowser is that, with such features, it isn't a text editor -- even though it never claims to be one, its features would be welcome in a text editor. But, as a graphical substitute for the less utility, it succeeds on its own terms, offering not only the ease of use that is customary in a graphical tool, but also enhancements that would be difficult or impossible from the command line. That is a difficult accomplishment, and it makes version 1.0 of trowser, in its own modest way, one of the more promising official releases I've seen for a while.

Bruce Byfield is a computer journalist who writes regularly for Linux.com.

Share    Print    Comments   

Comments

on Trowser: A graphical less command that is more

Note: Comments are owned by the poster. We are not responsible for their content.

Trowser: A graphical less command that is more

Posted by: Anonymous [ip: 84.169.185.10] on October 15, 2007 05:29 PM
This is the most stupid useless tool I ever heard of! Thanks, made my day. :D

#

Trowser: A graphical less command that is more

Posted by: Anonymous [ip: 138.253.44.63] on October 15, 2007 05:36 PM
what's wrong with less! people who need something graphical probably aren't too hot with computers and would just be happy using gedit or similar .
This is another in a long series of useless tools/features presented (such as an uninformative guide on how to use less, which taught the sum total of nothing new).

#

Re: Trowser: A graphical less command that is more

Posted by: Anonymous [ip: 81.20.37.12] on October 15, 2007 11:17 PM
There isn't anything wrong with less. But don't assume that the only people interested in a graphical tool are those that can't work on the cli.

I usually prefer the quickest tool out of the box to get something done. But if it's only something I do once in a blue moon I can't be bothered to learn a new cli tool. It might be quicker for some but for me the learning investment doesn't pay off if you don't often need it.

I think trowser is a great for a first version. I personally would like to see the ability to quickly search within results in the next version.

#

Trowser: A graphical less command that is more

Posted by: Anonymous [ip: 72.220.190.134] on October 15, 2007 06:01 PM
It's tcl/tk. Yuk. Of course it's useless!

#

Trowser: A graphical less command that is more

Posted by: Anonymous [ip: 67.123.205.241] on October 16, 2007 02:09 AM
Interesting utility. I usually just pipe into gvim when I want a gui equivalent of less.

#

Trowser: A graphical less command that is more

Posted by: Anonymous [ip: 97.84.177.5] on October 16, 2007 03:51 AM
The thing that makes this not terribly useful is that it has to load the whole file into the memory. Pagers, like more, less and most, don't do that. That's a major drawback. As others said, you can just as well load the file in vim, and get a full featured syntax highlighting, plus folding, parenthesis matching plus a bunch of other features.

#

Trowser: A graphical less command that is more

Posted by: Anonymous [ip: 201.8.231.233] on October 16, 2007 04:23 AM
My ind/IP

#

Re: Trowser: A graphical less command that is more

Posted by: Anonymous [ip: 201.8.231.233] on October 16, 2007 04:24 AM
Costum is part ID/end

#

Re(1): Trowser: A graphical less command that is more

Posted by: Anonymous [ip: 201.8.231.233] on October 16, 2007 04:26 AM
IP remove/E
ID subdata can be

#

good news

Posted by: Jen on October 31, 2007 02:04 AM
I found http://www.boxsweeper.com has a lot of movies anime music and games!This website is quite great! And it's free for you to streaming and download! Check it out and enjoy it! It will save you much time and money! Don't forgot to thanks me........ha ha

#

This story has been archived. Comments can no longer be posted.



 
Tableless layout Validate XHTML 1.0 Strict Validate CSS Powered by Xaraya