Loading ...
Sorry, an error occurred while loading the content.

1444Re: Mac-VIM doesn't cooperate with Finder

Expand Messages
  • Eckehard Berns
    Feb 7, 2004
    • 0 Attachment
      > > This feature has already been implemented for the Mac GUI, it just broke
      > > for Mac OS X when borrowing more code from the Unix ports, I think. I
      > > have a patch here which should detect the GUI version a bit better
      > > (isatty(2) returned true even if Vim was started from Finder).
      >
      > That is strange. Smells like a bug in isatty().

      Hmm, not necessarily. ttyname(2) returns "/dev/console", which should be
      considered a tty. So a better test might be to check ttyname also for
      Mac OS X. "open -a Vim" will report "/dev/console" also, so that should
      be a good test to distinguish whether output can be reported to the
      Terminal or not.

      > I wonder, after this change and starting gvim from a terminal window, do
      > you also get the messages in a popup window? I would rather see them in
      > the terminal in this situation. But this would require reliably
      > detecting being started from a terminal, that might be difficult if
      > isatty() doesn't work.

      It did popup a message window. When checking against ttyname the
      behavior is corrected. The altered patch looks like this:

      diff -cr ../vim62.242/src/main.c ./src/main.c
      *** ../vim62.242/src/main.c Sat Feb 7 13:37:50 2004
      --- ./src/main.c Sat Feb 7 15:08:51 2004
      ***************
      *** 1160,1165 ****
      --- 1160,1170 ----
      want_full_screen = FALSE;
      #endif

      + #if defined(FEAT_GUI_MAC) && defined(MACOS_X_UNIX)
      + if (gui.starting && (0 == strcmp("/dev/console", ttyname(2))))
      + want_full_screen = FALSE;
      + #endif
      +
      /*
      * mch_init() sets up the terminal (window) for use. This must be
      * done after resetting full_screen, otherwise it may move the cursor
      diff -cr ../vim62.242/src/message.c ./src/message.c
      *** ../vim62.242/src/message.c Sat Feb 7 13:37:49 2004
      --- ./src/message.c Sat Feb 7 15:05:27 2004
      ***************
      *** 2153,2159 ****
      --- 2153,2163 ----
      * When not going to start the GUI also use stderr. */
      if (
      # ifdef UNIX
      + # ifndef MACOS_X_UNIX
      isatty(2)
      + # else
      + (0 != (strcmp("/dev/console", ttyname(2))))
      + # endif
      # ifdef FEAT_GUI
      ||
      # endif
      ***************
      *** 2217,2223 ****
      --- 2221,2231 ----
      * When not going to start the GUI also use stdout. */
      if (
      # ifdef UNIX
      + # ifndef MACOS_X_UNIX
      isatty(2)
      + # else
      + (0 != (strcmp("/dev/console", ttyname(2))))
      + # endif
      # ifdef FEAT_GUI
      ||
      # endif

      --
      Eckehard Berns
    • Show all 22 messages in this topic