Hi Bram and list,

2016-8-10(Wed) 11:37:24 UTC+9 h_east:
> Hi Bram,
> 
> 2016-8-10(Wed) 5:58:46 UTC+9 Bram Moolenaar:
> > Hirohito Higashi wrote:
> > 
> > > How to reproduce:
> > > $ cd src
> > > $ make distclean
> > > $ ./configure --enable-fail-if-missing --enable-gui=gnome2
> > > $ make
> > > $ make test_startup
> > > 
> > > Get stuck with the following output in terminal.
> > > -------8<--------
> > > VIMRUNTIME=../../runtime; export VIMRUNTIME;  ../vim -f  -u unix.vim -U 
> > > NONE --noplugin --not-a-term -U NONE -S runtest.vim test_startup.vim
> > > 3 files to edit
> > > 2 files to edit
> > > 4 files to edit
> > > E233: cannot open display
> > > Press ENTER or type command to continue
> > > -------8<--------
> > > 
> > > Problem occurs in this environment.
> > > 
> > >   has('gui') && !has('gui_running')
> > > 
> > > 
> > > I wrote a patch.
> > > include this please!
> > 
> > Is this with Gnome?  I did see the test fail with Gnome, because it has
> > a second --version line.  I'll fix that.
> > 
> > I don't understand your condition, it appears to skip the test when not
> > build with the GUI.  For me the test is not needed.
> 
> I use fedora 23 that remote logined from Windows via PuTTY.
> 
> $ env | grep TERM
> TERM=putty-256color      <-- Same behavior of xterm-256color.
> 
> $ env | grep DISPLAY
> $                       <-- undefined
> 
> 
> My reported issue is not resolved in patch 7.4.2190

I got it.
When the following conditions are all true, `vim --help` does not exit after 
outputting the help.
- Configured with GTK
- Start CUI Vim with arg `--help` on terminal emulator.
    e.g. PuTTY for Windows
    not have GUI  i.e. env `$DISPLAY` undefined.

Because `gnome_program_init()` is not called.

I wrote a patch.
Please check an attached one.
--
Best regards,
Hirohito Higashi (a.k.a. h_east)

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.
diff --git a/src/gui.c b/src/gui.c
index 88b5d7b..0d858ec 100644
--- a/src/gui.c
+++ b/src/gui.c
@@ -447,7 +447,7 @@ gui_init_check(void)
      * See gui_do_fork().
      * Use a simpler check if the GUI window can probably be opened.
      */
-    result = gui.dofork ? gui_mch_early_init_check() : gui_mch_init_check();
+    result = gui.dofork ? gui_mch_early_init_check(TRUE) : gui_mch_init_check();
 # else
     result = gui_mch_init_check();
 # endif
diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c
index 939ecde..699c71f 100644
--- a/src/gui_gtk_x11.c
+++ b/src/gui_gtk_x11.c
@@ -543,7 +543,8 @@ gui_mch_prepare(int *argc, char **argv)
 
 	/* These arguments make gnome_program_init() print a message and exit.
 	 * Must start the GUI for this, otherwise ":gui" will exit later! */
-	if (option->flags & ARG_NEEDS_GUI)
+	if ((option->flags & ARG_NEEDS_GUI)
+				    && gui_mch_early_init_check(FALSE) == OK)
 	    gui.starting = TRUE;
 
 	if (option->flags & ARG_KEEP)
@@ -1663,7 +1664,7 @@ selection_get_cb(GtkWidget	    *widget UNUSED,
  * Return OK or FAIL.
  */
     int
-gui_mch_early_init_check(void)
+gui_mch_early_init_check(int outmsg)
 {
     char_u *p;
 
@@ -1672,7 +1673,8 @@ gui_mch_early_init_check(void)
     if (p == NULL || *p == NUL)
     {
 	gui.dying = TRUE;
-	EMSG(_((char *)e_opendisp));
+	if (outmsg)
+	    EMSG(_((char *)e_opendisp));
 	return FAIL;
     }
     return OK;
diff --git a/src/proto/gui_gtk_x11.pro b/src/proto/gui_gtk_x11.pro
index b79feb8..d6ba5c4 100644
--- a/src/proto/gui_gtk_x11.pro
+++ b/src/proto/gui_gtk_x11.pro
@@ -6,7 +6,7 @@ int gui_mch_is_blink_off(void);
 void gui_mch_set_blinking(long waittime, long on, long off);
 void gui_mch_stop_blink(void);
 void gui_mch_start_blink(void);
-int gui_mch_early_init_check(void);
+int gui_mch_early_init_check(int outmsg);
 int gui_mch_init_check(void);
 void gui_mch_show_tabline(int showit);
 int gui_mch_showing_tabline(void);

Raspunde prin e-mail lui