Commit 155ff3cf authored by TAKAHASHI Tamotsu's avatar TAKAHASHI Tamotsu

Introduce fall-back from complete-query to complete for the edit

menu, so 'bind editor <tab> complete-query' becomes possible.
parent d4cfdbee
......@@ -269,7 +269,7 @@ int _mutt_enter_string (char *buf, size_t buflen, int y, int x,
if (ch != OP_NULL)
{
first = 0;
if (ch != OP_EDITOR_COMPLETE)
if (ch != OP_EDITOR_COMPLETE && ch != OP_EDITOR_COMPLETE_QUERY)
state->tabs = 0;
redraw = M_REDRAW_LINE;
switch (ch)
......@@ -458,6 +458,7 @@ int _mutt_enter_string (char *buf, size_t buflen, int y, int x,
/* fall through to completion routine (M_FILE) */
case OP_EDITOR_COMPLETE:
case OP_EDITOR_COMPLETE_QUERY:
state->tabs++;
if (flags & M_CMD)
{
......@@ -484,7 +485,7 @@ int _mutt_enter_string (char *buf, size_t buflen, int y, int x,
replace_part (state, i, buf);
}
else if (flags & M_ALIAS)
else if (flags & M_ALIAS && ch == OP_EDITOR_COMPLETE)
{
/* invoke the alias-menu to get more addresses */
for (i = state->curpos; i && state->wbuf[i-1] != ',' &&
......@@ -502,6 +503,24 @@ int _mutt_enter_string (char *buf, size_t buflen, int y, int x,
}
break;
}
else if (flags & M_ALIAS && ch == OP_EDITOR_COMPLETE_QUERY)
{
/* invoke the query-menu to get more addresses */
if ((i = state->curpos))
{
for (; i && state->wbuf[i - 1] != ','; i--)
;
for (; i < state->curpos && state->wbuf[i] == ' '; i++)
;
}
my_wcstombs (buf, buflen, state->wbuf + i, state->curpos - i);
mutt_query_complete (buf, buflen);
replace_part (state, i, buf);
rv = 1;
goto bye;
}
else if (flags & M_COMMAND)
{
my_wcstombs (buf, buflen, state->wbuf, state->curpos);
......@@ -553,28 +572,6 @@ int _mutt_enter_string (char *buf, size_t buflen, int y, int x,
goto self_insert;
break;
case OP_EDITOR_COMPLETE_QUERY:
if (flags & M_ALIAS)
{
/* invoke the query-menu to get more addresses */
if ((i = state->curpos))
{
for (; i && state->wbuf[i - 1] != ','; i--)
;
for (; i < state->curpos && state->wbuf[i] == ' '; i++)
;
}
my_wcstombs (buf, buflen, state->wbuf + i, state->curpos - i);
mutt_query_complete (buf, buflen);
replace_part (state, i, buf);
rv = 1;
goto bye;
}
else
goto self_insert;
case OP_EDITOR_QUOTE_CHAR:
{
event_t event;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment