Fix beginning/end-of-line input function, add beginning/end-of-buffer functions

darcs-hash:20061031220149-ac50b-6e6b8f523642bead730059dd96ee2d1290283b5e.gz
This commit is contained in:
axel 2006-11-01 08:01:49 +10:00
parent 0099c3c420
commit 728a60bd67
4 changed files with 31 additions and 6 deletions

View file

@ -1,4 +1,3 @@
\section introduction Introduction
This is the documentation for \c fish, the friendly interactive
@ -1352,7 +1351,6 @@ g++, javac, java, gcj, lpr, doxygen, whois, find)
- Completion for gcc -\#\#\# option doesn't work.
- Suspending and then resuming pipelines containing a builtin is broken. How should this be handled?
- screen handling code can't handle tabs in input.
- begining-of-line and end-of-line move to begining/end of buffer, and there are no macros for moving to beginning/end of buffer.
If you think you have found a bug not described here, please send a

10
input.c
View file

@ -131,7 +131,9 @@ static const wchar_t *name_arr[] =
L"null",
L"eof",
L"vi-arg-digit",
L"execute"
L"execute",
L"beginning-of-buffer",
L"end-of-buffer"
}
;
@ -209,7 +211,9 @@ static const wchar_t code_arr[] =
R_NULL,
R_EOF,
R_VI_ARG_DIGIT,
R_EXECUTE
R_EXECUTE,
R_BEGINNING_OF_BUFFER,
R_END_OF_BUFFER,
}
;
@ -1321,6 +1325,8 @@ static void add_emacs_bindings()
add_escaped_mapping( L"emacs", (L"\ed"), L"Alt-d", L"forward-kill-word" );
add_terminfo_mapping( L"emacs", (key_ppage), L"Page Up", L"beginning-of-history" );
add_terminfo_mapping( L"emacs", (key_npage), L"Page Down", L"end-of-history" );
add_escaped_mapping( L"emacs", (L"\e<"), L"Alt-<", L"beginning-of-buffer" );
add_escaped_mapping( L"emacs", (L"\e>"), L"Alt->", L"end-of-buffer" );
}
/**

View file

@ -46,7 +46,9 @@ enum
R_SELF_INSERT,
R_VI_ARG_DIGIT,
R_VI_DELETE_TO,
R_EXECUTE
R_EXECUTE,
R_BEGINNING_OF_BUFFER,
R_END_OF_BUFFER
}
;

View file

@ -2058,6 +2058,25 @@ wchar_t *reader_readline()
/* go to beginning of line*/
case R_BEGINNING_OF_LINE:
{
while( data->buff_pos>0 && data->buff[data->buff_pos-1] != L'\n' )
data->buff_pos--;
repaint();
break;
}
case R_END_OF_LINE:
{
while( data->buff[data->buff_pos] && data->buff[data->buff_pos] != L'\n' )
data->buff_pos++;
repaint();
break;
}
case R_BEGINNING_OF_BUFFER:
{
data->buff_pos = 0;
@ -2066,7 +2085,7 @@ wchar_t *reader_readline()
}
/* go to EOL*/
case R_END_OF_LINE:
case R_END_OF_BUFFER:
{
data->buff_pos = data->buff_len;