woods@cbnewsc.ATT.COM (Warren D. Swan) (08/03/89)
The popular vi tag stack that has circulated around the net is a handy tool, but it had a bug in it. I received different versions from Tom Christiansen (of Convex Computer Corporation) and Art Dederick (Olivetti?), to whom I am truly thankful. So pay attention y'all, and fix it. The problem was that the :pop command (which working fine) always ended up with an error message (after switching back to the old file or location): Unknown command character '^?' After extensive use of sdb I found that the problem was in the new tag_pop() routine, in which opeek (the variable to hang on to the current peekc command character) was declared as a character, while peekc was declared as short. ^^^^^^^^^ ^^^^^ The result was that when the :pop command was executed, the last `peekc' command character was EOF (that is, -1). When tag_pop() was storing this value in opeek, then later retrieving it back into peekc, the result was 255 on my machine INSTEAD OF -1. One rule of C programming: Not All Machines Use Signed Characters. 255 minus the top (eighth) bit is 127, which is the delete character, represented by ^?. I personally removed CTRL(p) from being the same as k in edit mode, and I use CTRL(p) to pop me back (like :pop), instead of CTRL(t), which I like to use for something else. I never used CTRL(p) for previous line in edit mode anyway. If anyone is interested, I also added a :List commmand (capital L) to list the line number and file name of saved contexts on the tag stack. Rather than making this an edit character too (like CTRL(p)/:pop), I just bind it to a macro. Now if someone could just find the fix for the CTRL(^) with "No alternate filename" replacing the current line with the last line in the file! (I know already that you can use :e! to recover without loss of edits, but let's get it right!) Thanks to whoever did the fine work of adding the tag stack code. Warren D. Swan (WooDS) Y n n ____ __ You can't tell which way a train AT&T Bell Laboratories -(((((([__]/__] went by looking at the tracks. Naperville, Illinois /o-OOOOO~~ oo att!cblph!woods ##################### FRISCO 1630 Decapod (2-10-0) IRM