Hi Jean!
On So, 28 Mär 2010, Jean Johner wrote:
> Please launch gvim Easy on Windows with Start/All programs/Vim 7.2/
> gvim Easy, then open file1.
> Put the cursor at end of line 10 (say column 24)
> Quit
> Reopen file1 in the same way
> Result: the cursor is on line 10, column 23.
>
> It does not seem to be so easy to solve (see thread "How to remember
> end of line when quitting/reopening in insert mode" on vim_use).
As I said in the thread on vim_use, it depends how you quit vim. If you
use <ctrl-O> you will move the cursor. So the cursor will be in column
23 when quitting. If you reopen the file, the cursor will be correctly
positioned on the last column.
If you quit, by clicking the menu, that's basically the same issue. The
menu is constructed by means of :amenu. If you read the help, you'll
see, that for insert mode, amenu will insert <ctrl-o> before any
command, it is executing.
The solution is to use <c-\><c-o> before issuing the command (see :h
i_CTRL-\_CTRL-O). I am not sure, why amenu uses <C-\><C-O> instead of
<C-O>, but I suspect, there is a reason for that. In case it is not, I
quickly hacked together this patch (attached), which seems to work.
regards,
Christian
--
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
To unsubscribe from this group, send email to
vim_dev+unsubscribegooglegroups.com or reply to this email with the words
"REMOVE ME" as the subject.
diff --git a/src/eval.c b/src/eval.c
index ad127b5..d26e0a4 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -5872,8 +5872,7 @@ list_equal(l1, l2, ic)
return item1 == NULL && item2 == NULL;
}
-#if defined(FEAT_RUBY) || defined(FEAT_PYTHON) || defined(FEAT_MZSCHEME) \
- || defined(PROTO)
+#if defined(FEAT_PYTHON) || defined(FEAT_MZSCHEME) || defined(PROTO)
/*
* Return the dictitem that an entry in a hashtable points to.
*/
diff --git a/src/menu.c b/src/menu.c
index 41bebbf..270ca6b 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -490,6 +490,7 @@ add_menu_path(menu_path, menuarg, pri_tab, call_data
char_u *next_name;
int i;
int c;
+ int d;
#ifdef FEAT_GUI
int idx;
int new_idx;
@@ -746,6 +747,7 @@ add_menu_path(menu_path, menuarg, pri_tab, call_data
* Don't do this if adding a tearbar (addtearoff == FALSE).
* Don't do this for "<Nop>". */
c = 0;
+ d = 0;
if (amenu && call_data != NULL && *call_data != NUL
#ifdef FEAT_GUI_W32
&& addtearoff
@@ -761,18 +763,26 @@ add_menu_path(menu_path, menuarg, pri_tab, call_data
c = Ctrl_C;
break;
case MENU_INSERT_MODE:
- c = Ctrl_O;
+ c = Ctrl_BSL;
+ d = Ctrl_O;
break;
}
}
if (c)
{
- menu->strings[i] = alloc((unsigned)(STRLEN(call_data) + 4));
+ menu->strings[i] = alloc((unsigned)(STRLEN(call_data) + 5
));
if (menu->strings[i] != NULL)
{
- menu->strings[i][0] = c;
- STRCPY(menu->strings[i] + 1, call_data);
+
+ menu->strings[i][0] = c;
+ if (!d)
+ STRCPY(menu->strings[i] + 1, call_data);
+ else
+ {
+ menu->strings[i][1] = d;
+ STRCPY(menu->strings[i] + 2, call_data);
+ }
if (c == Ctrl_C)
{
int len = (int)STRLEN(menu->strings[i]);