diff --git a/doc_src/index.hdr b/doc_src/index.hdr index f1c15ff2c..8f3c9a1cf 100644 --- a/doc_src/index.hdr +++ b/doc_src/index.hdr @@ -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 diff --git a/input.c b/input.c index 19a4cded1..654b94b52 100644 --- a/input.c +++ b/input.c @@ -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" ); } /** diff --git a/input.h b/input.h index 867099e3e..d3a9d695e 100644 --- a/input.h +++ b/input.h @@ -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 } ; diff --git a/reader.c b/reader.c index 0ee77b68b..431ba0f2d 100644 --- a/reader.c +++ b/reader.c @@ -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;