Re: RUN the VI editor from a 4GL program
Posted in 1997
In article <E6yBMM.8FE@nonexistent.com>, Jacob Salomon <jake@apparel.net> writes >Hi Folks, > >I developing an application that involved allowing users to create/edit >a text blob using the vi editor. (I suspect the exact editor is not the >problem here, however.) I piece together the file name at run time and >"locate" the blob variable there with the following snippet of code: > > let curtime = current hour to second > let fname # Piece together a file name > = "/tmp/blob.", login_name clipped, "-", curtime clipped > > locate rp_libdoc_ldesc # Set up to edit/display in this file > in file fname > >I then piece together the vi command line: > > let edit_cmd = "vi ", fname > >So the command line looks something like: > libdoc.4gl:edit_lib_long.edit_cmd = "vi /tmp/blob.jake-17:14:57" > > >Next, I RUN the command: (I am copy/pasting to a debugging session) > run edit_cmd > >This definitely gets me into vi. However, instead of looking like vi, >I see the escape sequences as strings on my screen. If I enter :f >command, I see the result buried in the garbage but I can't get it to >behave like vi! > >Is it my emulator? Is this related to the debugger (or any 4GL >application) running in raw terminal mode already? If the latter, what >can I do to correct for this and get a normal vi session running? I >believe this will happen even if I use emacs; it's the terminal that's >screwed up! > >[3g[44;9HH[44;17HH[44;25HH[44;33HH[44;41HH[44;49HH[44;57HH[44;65HH[44;73HH[44;81 >HH[44;1H[?25h[?1h="/tmp/blob.jake-17:14:57" > >The above is what I see when vi is running. Yucch! > >Any ideas? Thanks. > Classic problem - the terminal is in raw mode when you run a command from with 4GL. Either a) Write some C code to save and restore terminal settings/modes at the write places (termio). b) If using 4GL version 6. Use RUN "vi..." IN FORM MODE. -- David Williams