[Context] I'm developing a little app, as a hobby to learn ncurses, that catalogs and lists and searches within a set of documents (for now, they are the HOWTOs from TLDP).
The most tricky part of the app is, I believe, the file reader (show the contents of a file nicely). To really be able to provide a good enough user experience, given that the HOWTOs are somewhat long, it would be a valuable feature if I can "save" the line where the user stopped reading, and start on that same line the next time the user opens up that same HOWTO [/context]
So to the real question: is there a command-line reader that can not only get a line X as a parameter and position the cursor at that line, but also tell me the line that was last shown? I understand that an app can't "return" that value, given that returns are either 0 or an ERROR#, so maybe some kind of system variable or shared memory or... ?
Given that I'll be doing the call from a C app, maybe a different solution that's not an external app will also serve me just right, I'm open to suggestions.
view(part of vim) saves the file position in the viminfo file. At least, it does depending on your viminfo setting. – derobert Jan 8 at 19:30viewis certainly something I will look into if unable to find a different solution. Also, I just tested it andviewnot only writes the markers to .viminfo but also opens the file in the mark already, so that would be one less concern... I think I'll end up using that if nothing similar appears. Thank you! – beder Jan 8 at 19:38viewis not only part ofvim, it isvim. In Ubuntu, at least, both are symbolic links which resolve to/usr/bin/vim.gnome– Peter.O Jan 9 at 5:08