[interchange-cvs] interchange - jon modified eg/te

interchange-core@interchange.redhat.com interchange-core@interchange.redhat.com
Wed Oct 3 15:34:00 2001


User:      jon
Date:      2001-10-03 19:33:50 GMT
Modified:  eg       Tag: STABLE_4_8-branch te
Log:
Add support for gvim. Somehow I missed the obvious foreground option -f
before.

Revision  Changes    Path
No                   revision



No                   revision



2.1.2.1   +10 -5     interchange/eg/te


rev 2.1.2.1, prev_rev 2.1
Index: te
===================================================================
RCS file: /var/cvs/interchange/eg/te,v
retrieving revision 2.1
retrieving revision 2.1.2.1
diff -u -u -r2.1 -r2.1.2.1
--- te	2001/08/01 01:19:26	2.1
+++ te	2001/10/03 19:33:49	2.1.2.1
@@ -60,11 +60,6 @@
 There is currently no way to add or delete entire columns from the
 file. I recommend using B<cut>(1) for this.
 
-B<te> won't work if your editor immediately returns control to the caller,
-as is common with some X editors, such as B<gvim>. Unless you can figure
-out how to get the editor to wait until the end of the editing session to
-return control to the caller, you can't use that editor with B<te>.
-
 =head1 AUTHOR
 
 Jon Jensen <jon@redhat.com>
@@ -83,6 +78,10 @@
 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
 at http://www.fsf.org/copyleft/gpl.html for more details.
 
+=head1 VERSION
+
+$Id $
+
 =head1 CHANGELOG
 
 2001-04-26. Initial release.
@@ -97,6 +96,8 @@
 options there or in EDITOR if given. Take advantage of Digest::MD5's
 native file reading instead of doing it ourselves.
 
+2001-10-03. Added gvim support by forcing foreground option -f.
+
 =cut
 
 use strict;
@@ -106,6 +107,10 @@
 die "Usage: $0 tablefile1 [tablefile2 ...]\n" unless @ARGV;
 
 my $editor = $ENV{VISUAL} || $ENV{EDITOR} || 'vi';
+
+# run gvim in foreground mode, since it otherwise immediately returns
+# control to us and we never get the user's changes
+$editor .= ' -f' if $editor =~ /\bgvim\b/ and $editor !~ /\s-f\b/;
 
 for my $filename (@ARGV) {
 	my (@fieldnames, $fieldcount, @fields);