From: Chris Allegretta Date: Fri, 14 Mar 2008 04:08:51 +0000 (+0000) Subject: - Update man page a little bit more X-Git-Tag: v2.1.0~12 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=10f868d33ca8823b82aeeffc210d2da88d2a4fcb;p=nano.git - Update man page a little bit more - Change do_prompt and get_prompt_line to pass meta_key and func_key so the calling program can DTRT when it calsl get_shortcut. In particular this allows the "new file buffer" toggle on the insert file menu to work, and presumably other rebinding stuff should now work also. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4226 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- diff --git a/BUGS b/BUGS index 92e81b08..5c3b1275 100644 --- a/BUGS +++ b/BUGS @@ -1,10 +1,6 @@ ** Open BUGS ** - Cutting the line at the top of the screen recenters to center (71) - Many menu items are probably missing from the new backend (73) -- Browser and prompt code still implement old switch on raw key input instead - of new if block for subnfunc values (75) -- New backend code probably does not compile under anything but default options, - if that (76) ** Fixed BUGS ** - Marked cutting sometimes leaves a newline in the file unintelligently, @@ -149,6 +145,10 @@ - F-keys do not work with new shortcut backend (72) [FIXED] - Need a 'check-vitals-mapped' function to check that the end used didn't unbind all the keys for exit or cancel before starting up the editor (74) [FIXED] +- Browser and prompt code still implement old switch on raw key input instead + of new if block for subnfunc values (75) [FIXED] +- New backend code probably does not compile under anything but default options, + if that (76) [FIXED] - -enable-tiny does not work with new code (78) [FIXED] - If a user only binds meta sequences to a function like left, right page up/down, insert, and unbinds all other control and F keys for it, diff --git a/doc/man/nanorc.5 b/doc/man/nanorc.5 index ff8de18b..1cb518bb 100644 --- a/doc/man/nanorc.5 +++ b/doc/man/nanorc.5 @@ -258,249 +258,259 @@ Rebinds the key \fIkey\fP to a new function named \fIfunction\fP in the context of menu \fImenu\fP. The format of \fIkey\fP should be one of: .TP .B ^ -followed by an alpha character or the word "Space" +followed by an alpha character or the word "Space". +Example: ^C .TP .B M- -followed by a prinable character or the word "Space" +followed by a prinable character or the word "Space". +Example: M-C .TP -.B F# +.B F followed by a numeric value from 1-16 +Example: F10 .TP Valid function names to be bound include: -.TP +.TP 3 .B help -Invoke the help menu +Invoke the help menu. .TP .B cancel -Cancel the current command +Cancel the current command. .TP .B exit -Exit from the program +Exit from the program. .TP .B writeout -Write the current buffer to disk +Write the current buffer to disk. .TP .B justify -Justify text +Justify the current text. .TP .B insert -Insert a file into the current buffer (or a new buffer with multi-buffer enbled) +Insert a file into the current buffer (or a new buffer with multi-buffer enbled). .TP .B whereis -Search for text in the program +Search for text in the program. .TP .B searchagain -Repat the last search command +Repat the last search command. .TP .B up -Move up in the editor or browser +Move up in the editor or browser. .TP .B down -Move down in the editor or browser +Move down in the editor or browser. .TP .B left -Move left in the editor or browser +Move left in the editor or browser. .TP .B right -Move right in the editor or browser +Move right in the editor or browser. .TP .B cut -Cut the current line of text and store it +Cut the current line of text and store it. .TP .B uncut -Copy the currently stored text into the current file location +Copy the currently stored text into the current file location. .TP .B curpos -Show the current line, column, word positions in the file +Show the current line, column, word positions in the file. .TP .B firstline Move to the first line of the file .TP .B lastline -Move to the last line of the file +Move to the last line of the file. .TP .B gotoline -Move to a specific line (and column if specified) +Move to a specific line (and column if specified). .TP .B replace -Interactively replace text within the editor +Interactively replace text within the editor. .TP .B mark -Begin selecting text for cutting or pasting at the current position +Begin selecting text for cutting or pasting at the current position. .TP .B copytext -Copy the currently marked text without deleting it +Copy the currently marked text without deleting it. .TP .B indent -Indent the currently marked text (shift to the right) +Indent the currently marked text (shift to the right). .TP .B unindent -Un-indent the currently marked text (shift to the left) +Un-indent the currently marked text (shift to the left). .TP .B nextword -Move the cursor to the beginning of the next word +Move the cursor to the beginning of the next word. .TP .B prevword -Move the cursor to the beginning of the previous word +Move the cursor to the beginning of the previous word. .TP .B home -Move the cursor to the beginning of the current line +Move the cursor to the beginning of the current line. .TP .B end -Move the cursor to the end of the current line +Move the cursor to the end of the current line. .TP .B beginpara Move the cursor to the beginning of the current paragraph .TP .B endpara -Move the cursor to the beginning of the current paragraph +Move the cursor to the beginning of the current paragraph. .TP .B findbracket -Move the cursor to the matching bracket (brace, etc) of the one under the cursor +Move the cursor to the matching bracket (brace, etc) of the one under the cursor. .TP .B scrollup -Scroll up one line of text from the current position +Scroll up one line of text from the current position. .TP .B scrolldown -Scroll down one line of text from the current position +Scroll down one line of text from the current position. .TP .B prevbuf -Switch to editing/viewing the previous buffer when using multibuffer mode +Switch to editing/viewing the previous buffer when using multibuffer mode. .TP .B nextbuf -Switch to editing/viewing the next buffer when using multibuffer mode +Switch to editing/viewing the next buffer when using multibuffer mode. .TP .B verbatim -Insert the next character verbatim into the file +Insert the next character verbatim into the file. .TP .B tab -Insert a tab at the current cursor location +Insert a tab at the current cursor location. .TP .B enter -Insert a new line below the current one +Insert a new line below the current one. .TP .B delete -Delete the character under the cursor +Delete the character under the cursor. .TP .B fulljustify -Justify the entire current file +Justify the entire current file. .TP .B wordcount -Count the number of words in the current buffer +Count the number of words in the current buffer. .TP .B refresh Refresh the screen .TP +.B suspend +Suspend the editor (if the suspend functino is enabled, see the +"suspendenable" entry below. +.TP .B casesens -Toggle case sensitivity in searching (search/replace menus only) +Toggle case sensitivity in searching (search/replace menus only). .TP .B regexp -Toggle whether searches/replaces are based on literal strings or regular expressions +Toggle whether searches/replaces are based on literal strings or regular expressions. .TP .B prevhistory -Show the previous history entry in the prompt menus (e.g. search) +Show the previous history entry in the prompt menus (e.g. search). .TP .B nexthistory -Show the next history entry in the prompt menus (e.g. search) +Show the next history entry in the prompt menus (e.g. search). .TP .B dontreplace -Switch back to searching instead of replacing +Switch back to searching instead of replacing. .TP .B gototext Search for files matching a string in the file browser (reading or writing files) .TP .B dosformat -When writing a file, switch to writing a DOS format (CR/LF) +When writing a file, switch to writing a DOS format (CR/LF). .TP .B macformat -When writing a file, switch to writing a Mac format +When writing a file, switch to writing a Mac format. .TP .B append -When writing a file, append to the end instead of overwriting +When writing a file, append to the end instead of overwriting. .TP .B prepend -When writing a file, 'prepend' (write at the beginning) instead of overwriting +When writing a file, 'prepend' (write at the beginning) instead of overwriting. .TP .B backup -When writing a file, create a backup of the current file +When writing a file, create a backup of the current file. .TP .B firstfile -Move to the first file when using the file browser (reading or writing files) +Move to the first file when using the file browser (reading or writing files). .TP .B lastfile -Move to the last file when using the file browser (reading or writing files) +Move to the last file when using the file browser (reading or writing files). .TP .B nohelp -Toggle showing/hiding the two line list of key bindings at the bottom of the screen +Toggle showing/hiding the two line list of key bindings at the bottom of the screen. .TP .B constupdate -Constantly display the current line, column, etc position +Constantly display the current line, column, etc position. .TP .B morespace -Toggle showing/hiding the blank space which 'seperates' the 'title' from the file text +Toggle showing/hiding the blank space which 'seperates' the 'title' from the file text. .TP .B smoothscroll -Toggle smooth scrolling when moving via the arrow keys +Toggle smooth scrolling when moving via the arrow keys. .TP .B whitesplacedisplay .TP .B smarthome -Toggle whether the smart home key function is enabled +Toggle whether the smart home key function is enabled. .TP .B autoindent -Toggle whether new lines will conain the same amount of whitespace as the line above +Toggle whether new lines will conain the same amount of whitespace as the line above. .TP .B cuttoend -Toggle whether cutting text will cut the whole line or just from the current cursor +Toggle whether cutting text will cut the whole line or just from the current cursor. position to the end of the line .TP .B nowrap Toggle whether long lines will be wrapped to the next line. .TP +.B suspendenable +Toggle whether the suspend sequence (normally ^Z) will suspend the editor window. +.TP Valid menu sections are: .TP .B main -The main editor window where text is entered +The main editor window where text is entered. .TP .B search -The search menu (AKA whereis) +The search menu (AKA whereis). .TP .B replace -The 'search to replace' menu +The 'search to replace' menu. .TP .B replacewith -The 'replace with' menu, which comes up after 'search to replace' +The 'replace with' menu, which comes up after 'search to replace'. .TP .B gotoline -The 'goto line (and column) menu +The 'goto line (and column)' menu. .TP .B writeout -The 'write file' menu +The 'write file' menu. .TP .B insert -The 'insert file' menu +The 'insert file' menu. .TP .B extcmd -The menu for inserting output from an external comman, reached from the insert menu +The menu for inserting output from an external comman, reached from the insert menu. .TP .B help -The help menu +The help menu. .TP .B spell -The interactive spell checker Yes/no menu +The interactive spell checker Yes/no menu. .TP .B browser -The file browser for inserting or writing a file +The file browser for inserting or writing a file. .TP .B whereisfile -The 'search for a file' menu in the file browser +The 'search for a file' menu in the file browser. .TP .B gotodir The 'go to directory' menu .TP .B all -Special symbol for all menus (except the help menu) +Special name meaning apply to all menus where this function exists. .SH FILES .TP .I SYSCONFDIR/nanorc diff --git a/src/browser.c b/src/browser.c index 78c0d915..b7521472 100644 --- a/src/browser.c +++ b/src/browser.c @@ -213,6 +213,7 @@ char *do_browser(char *path, DIR *dir) FALSE, #endif MGOTODIR, ans, + &meta_key, &func_key, #ifndef NANO_TINY NULL, #endif @@ -791,6 +792,7 @@ int filesearch_init(void) TRUE, #endif MWHEREISFILE, backupstring, + &meta_key, &func_key, #ifndef NANO_TINY &search_history, #endif diff --git a/src/files.c b/src/files.c index 88ba0fc4..74ce1725 100644 --- a/src/files.c +++ b/src/files.c @@ -706,6 +706,8 @@ void do_insertfile( bool right_side_up = FALSE, single_line = FALSE; #endif + currmenu = MINSERTFILE; + while (TRUE) { #ifndef NANO_TINY if (execute) { @@ -735,11 +737,12 @@ void do_insertfile( execute ? MEXTCMD : #endif MINSERTFILE, ans, + &meta_key, &func_key, +#ifndef DISABLE_OPERATINGDIR #ifndef NANO_TINY NULL, #endif edit_refresh, msg, -#ifndef DISABLE_OPERATINGDIR operating_dir != NULL && strcmp(operating_dir, ".") != 0 ? operating_dir : #endif @@ -765,7 +768,7 @@ void do_insertfile( #ifdef ENABLE_MULTIBUFFER s = get_shortcut(currmenu, &i, &meta_key, &func_key); - if (s && s->scfunc == (void *) do_toggle && s->toggle == MULTIBUFFER) { + if (s && s->scfunc == (void *) new_buffer_msg) { /* Don't allow toggling if we're in view mode. */ if (!ISSET(VIEW_MODE)) TOGGLE(MULTIBUFFER); @@ -1871,6 +1874,7 @@ bool do_writeout(bool exiting) TRUE, #endif MWRITEFILE, ans, + &meta_key, &func_key, #ifndef NANO_TINY NULL, #endif diff --git a/src/global.c b/src/global.c index 5d1e367e..39e5a3df 100644 --- a/src/global.c +++ b/src/global.c @@ -925,7 +925,7 @@ void shortcut_init(bool unjustify) no_replace_msg, IFSCHELP(nano_whereis_msg), FALSE, VIEW); add_to_funcs((void *) gototext_msg, MGOTOLINE, - gototext_msg, IFSCHELP(nano_whereis_msg), FALSE, VIEW); + gototext_msg, IFSCHELP(nano_whereis_msg), TRUE, VIEW); #ifndef DISABLE_BROWSER if (!ISSET(RESTRICTED)) @@ -973,7 +973,7 @@ void shortcut_init(bool unjustify) /* If we're using restricted mode, the multibuffer toggle is * disabled. It's useless since inserting files is disabled. */ if (!ISSET(RESTRICTED)) - add_to_funcs((void *) new_buffer_msg, MWRITEFILE, + add_to_funcs((void *) new_buffer_msg, MINSERTFILE, new_buffer_msg, nano_multibuffer_msg, FALSE, NOVIEW); #endif @@ -1127,17 +1127,10 @@ void shortcut_init(bool unjustify) add_to_sclist(MMAIN, "M-.", switch_to_next_buffer_void, 0, TRUE); #endif add_to_sclist(MMAIN, "M-V", do_verbatim_input, 0, TRUE); - add_to_sclist(MALL, "^I", do_tab, 0, TRUE); - add_to_sclist(MALL, "^M", do_enter, 0, TRUE); - add_to_sclist(MALL, "kenter", do_enter, 0, TRUE); - add_to_sclist(MALL, "^D", do_delete, 0, TRUE); - add_to_sclist(MALL, "kdel", do_delete, 0, TRUE); - add_to_sclist(MALL, "^H", do_backspace, 0, TRUE); - add_to_sclist(MALL, "kbsp", do_backspace, 0, TRUE); #ifndef NANO_TINY add_to_sclist(MALL, "M-T", do_cut_till_end, 0, TRUE); add_to_sclist(MALL, "M-J", do_full_justify, 0, TRUE); - add_to_sclist(MALL, "M-D", do_wordlinechar_count, 0, TRUE); + add_to_sclist(MMAIN, "M-D", do_wordlinechar_count, 0, TRUE); add_to_sclist(MMAIN, "M-X", do_toggle, NO_HELP, TRUE); add_to_sclist(MMAIN, "M-C", do_toggle, CONST_UPDATE, TRUE); add_to_sclist(MMAIN, "M-O", do_toggle, MORE_SPACE, TRUE); @@ -1155,6 +1148,8 @@ void shortcut_init(bool unjustify) add_to_sclist(MMAIN, "M-N", do_toggle, NO_CONVERT, TRUE); add_to_sclist(MMAIN, "M-Z", do_toggle, SUSPEND, TRUE); #endif + add_to_sclist(MGOTOLINE, "^T", (void *) gototext_msg, 0, FALSE); + add_to_sclist(MINSERTFILE|MEXTCMD, "M-F", (void *) new_buffer_msg, 0, FALSE); add_to_sclist((MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE|MWRITEFILE|MINSERTFILE|MEXTCMD|MSPELL|MWHEREISFILE|MGOTODIR), "^C", (void *) cancel_msg, 0, FALSE); add_to_sclist(MHELP, "^X", do_exit, 0, TRUE); @@ -1169,6 +1164,13 @@ void shortcut_init(bool unjustify) add_to_sclist(MINSERTFILE, "^X", (void *) ext_cmd_msg, 0, FALSE); add_to_sclist(MMAIN, "^Z", do_suspend_void, 0, FALSE); add_to_sclist(MMAIN, "^L", total_refresh, 0, TRUE); + add_to_sclist(MALL, "^I", do_tab, 0, TRUE); + add_to_sclist(MALL, "^M", do_enter, 0, TRUE); + add_to_sclist(MALL, "kenter", do_enter, 0, TRUE); + add_to_sclist(MALL, "^D", do_delete, 0, TRUE); + add_to_sclist(MALL, "kdel", do_delete, 0, TRUE); + add_to_sclist(MALL, "^H", do_backspace, 0, TRUE); + add_to_sclist(MALL, "kbsp", do_backspace, 0, TRUE); #ifdef DEBUG print_sclist(); diff --git a/src/prompt.c b/src/prompt.c index f214f795..f92b7259 100644 --- a/src/prompt.c +++ b/src/prompt.c @@ -899,6 +899,7 @@ const sc *get_prompt_string(int *actual, bool allow_tabs, bool allow_files, #endif const char *curranswer, + bool *meta_key, bool *func_key, #ifndef NANO_TINY filestruct **history_list, #endif @@ -909,7 +910,7 @@ const sc *get_prompt_string(int *actual, bool allow_tabs, ) { int kbinput = ERR; - bool meta_key, func_key, have_shortcut, ran_func, finished; + bool have_shortcut, ran_func, finished; size_t curranswer_len; const sc *s; #ifndef DISABLE_TABCOMP @@ -971,11 +972,11 @@ fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %d\n", answer * this case, disable all keys that would change the text if the * filename isn't blank and we're at the "Write File" prompt. */ while (1) { - kbinput = do_statusbar_input(&meta_key, &func_key, &have_shortcut, + kbinput = do_statusbar_input(meta_key, func_key, &have_shortcut, &ran_func, &finished, TRUE, refresh_func); assert(statusbar_x <= strlen(answer)); - s = get_shortcut(currmenu, &kbinput, &meta_key, &func_key); + s = get_shortcut(currmenu, &kbinput, meta_key, func_key); if (s) if (s->scfunc == (void *) cancel_msg || s->scfunc == do_enter) @@ -1150,6 +1151,7 @@ int do_prompt(bool allow_tabs, bool allow_files, #endif int menu, const char *curranswer, + bool *meta_key, bool *func_key, #ifndef NANO_TINY filestruct **history_list, #endif @@ -1181,6 +1183,7 @@ int do_prompt(bool allow_tabs, allow_files, #endif curranswer, + meta_key, func_key, #ifndef NANO_TINY history_list, #endif diff --git a/src/proto.h b/src/proto.h index 27ea8abd..d068ee4c 100644 --- a/src/proto.h +++ b/src/proto.h @@ -509,6 +509,7 @@ const sc *get_prompt_string(int *value, bool allow_tabs, bool allow_files, #endif const char *curranswer, + bool *meta_key, bool *func_key, #ifndef NANO_TINY filestruct **history_list, #endif @@ -522,6 +523,7 @@ int do_prompt(bool allow_tabs, bool allow_files, #endif int menu, const char *curranswer, + bool *meta_key, bool *func_key, #ifndef NANO_TINY filestruct **history_list, #endif @@ -806,7 +808,8 @@ const char *mac_format_msg; const char *append_msg; const char *prepend_msg; const char *backup_file_msg; - +const char *gototext_msg; +const char *new_buffer_msg; #ifdef HAVE_REGEX_H const char *regexp_msg; diff --git a/src/search.c b/src/search.c index e7e52cdd..cee7ac1f 100644 --- a/src/search.c +++ b/src/search.c @@ -138,6 +138,7 @@ int search_init(bool replacing, bool use_answer) char *buf; sc *s; void *func = NULL; + bool meta_key = FALSE, func_key = FALSE; static char *backupstring = NULL; /* The search string we'll be using. */ @@ -176,6 +177,7 @@ int search_init(bool replacing, bool use_answer) TRUE, #endif replacing ? MREPLACE : MWHEREIS, backupstring, + &meta_key, &func_key, #ifndef NANO_TINY &search_history, #endif @@ -883,6 +885,7 @@ void do_replace(void) { filestruct *edittop_save, *begin; size_t begin_x, pww_save; + bool meta_key = FALSE, func_key = FALSE; ssize_t numreplaced; int i; @@ -925,6 +928,7 @@ void do_replace(void) TRUE, #endif MREPLACE2, last_replace, + &meta_key, &func_key, #ifndef NANO_TINY &replace_history, #endif @@ -984,7 +988,7 @@ void do_replace(void) void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer, bool interactive, bool save_pos, bool allow_update) { - bool meta_key, func_key; + bool meta_key = FALSE, func_key = FALSE; const sc *s; if (interactive) { @@ -996,6 +1000,7 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer, TRUE, #endif MGOTOLINE, use_answer ? ans : "", + &meta_key, &func_key, #ifndef NANO_TINY NULL, #endif @@ -1012,7 +1017,7 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer, s = get_shortcut(currmenu, &i, &meta_key, &func_key); - if (s && s->scfunc == do_search) { + if (s && s->scfunc == (void *) gototext_msg) { /* Keep answer up on the statusbar. */ search_init(TRUE, TRUE); diff --git a/src/text.c b/src/text.c index b544ad02..93277e94 100644 --- a/src/text.c +++ b/src/text.c @@ -1770,6 +1770,7 @@ bool do_int_spell_fix(const char *word) char *save_search, *save_replace; size_t match_len, current_x_save = openfile->current_x; size_t pww_save = openfile->placewewant; + bool meta_key = FALSE, func_key = FALSE; filestruct *edittop_save = openfile->edittop; filestruct *current_save = openfile->current; /* Save where we are. */ @@ -1857,6 +1858,7 @@ bool do_int_spell_fix(const char *word) TRUE, #endif MSPELL, word, + &meta_key, &func_key, #ifndef NANO_TINY NULL, #endif