Hi all,
I have seen quite a few comments on how annoying the "File changed"
dialog can be when many files have been modified outside Vim.
Currently there is no way to simply say "Load All" files (short of
setting 'autoread' but maybe you don't always want this on), instead
there is one dialog for each modified file and clicking through more
than one of these is just too much.
The nicest solutions to this problem I can think of are:
1. Check how many files have been modified and put up a dialog saying
something like "Several files were modified outside Vim" and then give
the option of reloading/ignoring all, or to go in and choose what to
do with each file.
2. Have a checkbox in the current dialog saying "Apply to all files"
so if you tick the checkbox and then click "Load File" all files will
be reloaded automatically.
Both seem too difficult to implement: 1 doesn't fit with how the
source code works and would require a big change, 2 would be even more
problematic since there is no support for adding check boxes to
dialogs.
So, instead I simply added two more buttons to the current dialog: a
"Load &All" button and a "&Ignore All" button. This is a bit weird
when only one file has changed but at least now you don't have to see
this dialog more than once unless you choose to.
I realize Bram won't be reading this post for a while, but I thought
I'd put this patch out there anyway for the rest of you to look at.
Björn
*** src/fileio.c 2008-10-18 20:32:08.000000000 +0200
--- mysrc/fileio.c 2008-10-18 20:32:06.000000000 +0200
***************
*** 6232,6237 ****
--- 6232,6240 ----
}
static int already_warned = FALSE;
+ #if defined(FEAT_CON_DIALOG) || defined(FEAT_GUI_DIALOG)
+ static int default_reload_choice = 0;
+ #endif
/*
* Check if any not hidden buffer has been changed.
***************
*** 6274,6279 ****
--- 6277,6285 ----
++no_wait_return;
did_check_timestamps = TRUE;
already_warned = FALSE;
+ #if defined(FEAT_CON_DIALOG) || defined(FEAT_GUI_DIALOG)
+ default_reload_choice = 0;
+ #endif
for (buf = firstbuf; buf != NULL; )
{
/* Only check buffers in a window. */
***************
*** 6292,6297 ****
--- 6298,6306 ----
}
buf = buf->b_next;
}
+ #if defined(FEAT_CON_DIALOG) || defined(FEAT_GUI_DIALOG)
+ default_reload_choice = 0;
+ #endif
--no_wait_return;
need_check_timestamps = FALSE;
if (need_wait_return && didit == 2)
***************
*** 6551,6559 ****
STRCAT(tbuf, "\n");
STRCAT(tbuf, mesg2);
}
! if (do_dialog(VIM_WARNING, (char_u *)_("Warning"), tbuf,
! (char_u *)_("&OK\n&Load File"), 1, NULL) == 2)
! reload = TRUE;
}
else
#endif
--- 6560,6586 ----
STRCAT(tbuf, "\n");
STRCAT(tbuf, mesg2);
}
! if (default_reload_choice > 0)
! {
! if (default_reload_choice == 2)
! reload = TRUE;
! }
! else
! {
! switch (do_dialog(VIM_WARNING, (char_u *)_("Warning"), tbuf,
! (char_u *)_("&OK\n&Load File\nLoad
&All\n&Ignore All"),
! 1, NULL))
! {
! case 3:
! default_reload_choice = 2;
! case 2:
! reload = TRUE;
! break;
! case 4:
! default_reload_choice = 1;
! break;
! }
! }
}
else
#endif
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---