1
1

implement verbatim input for the statusbar prompt

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2215 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Этот коммит содержится в:
David Lawrence Ramsey 2005-01-02 21:26:53 +00:00
родитель b8a2a6d7e5
Коммит 11c83d3ed3
5 изменённых файлов: 36 добавлений и 5 удалений

Просмотреть файл

@ -83,6 +83,9 @@ CVS code -
is disabled when NANO_SMALL is defined. (DLR, based on ideas
from a patch for Pico by Eduardo Chappa, suggested by Ryan
Dlugosz and Paul Adams)
- Implement verbatim input for the statusbar prompt. Changes to
do_statusbar_input(); new function
do_statusbar_verbatim_input(). (DLR)
- cut.c:
do_cut_text()
- If keep_cutbuffer is FALSE, only blow away the text in the
@ -184,6 +187,9 @@ CVS code -
obsolete and it defines a struct termio that we don't use
anywhere. (DLR)
- Typo fixes. (DLR)
- doc/faq.html:
- Remove now-inaccurate note about verbatim input's not working
at prompts. (DLR)
- doc/nanorc.sample:
- Add return to the "c-file" regexes. (DLR)

3
TODO
Просмотреть файл

@ -8,8 +8,7 @@ For version 1.4:
- Support for filename searches in the file browser.
- Undo/Redo key?
- Rebindable keys?
- Keystroke to implement "Add next sequence as raw" like vi's ^V.
[DONE for edit window, needs to be done for statusbar prompt]
- Keystroke to implement "Add next sequence as raw" like vi's ^V. [DONE]
- Spell check selected text only. [DONE]
- Make "To Line" (^W^T) and "Read from Command" (^R^X) reenter their
parent menu when their keystroke is entered a second time (^W^T^T and

Просмотреть файл

@ -166,8 +166,7 @@
<p>You can move between the buffers you have open with the <b>Meta-&lt;</b> and <b>Meta-&gt;</b> keys, or more easily with <b>Meta-,</b> and <b>Meta-.</b> (clear as mud, right? =-). When you have more than one file buffer open, the ^X shortcut will say &quot;Close&quot;, instead of the normal &quot;Exit&quot; when only one buffer is open.</p></blockquote>
<h2><a name="3.8"></a>3.8. Tell me more about this verbatim input stuff!</h2>
<blockquote><p>To use verbatim input, you must be using nano 1.3.1 or newer. When you want to insert a literal character into the file you're editing, such as a control character that nano usually treats as a command, first press <b>Meta-V</b>. (If you're not at a prompt, you'll get the message &quot;Verbatim input&quot;.) Then press the key(s) that generate the character you want.</p>
<p>Alternatively, you can press <b>Meta-V</b> and then type a three-digit ASCII code from 000 to 255, and the character with that ASCII code will be inserted instead.</p>
<p><b>NOTE:</b> Verbatim input doesn't work at prompts right now. This will be fixed soon.</p></blockquote>
<p>Alternatively, you can press <b>Meta-V</b> and then type a three-digit ASCII code from 000 to 255, and the character with that ASCII code will be inserted instead.</p></blockquote>
<h2><a name="3.9"></a>3.9. How do I make a .nanorc file that nano will read when I start it?</h2>
<blockquote><p>It's not hard at all! But, your version of nano must have been compiled with <b>--enable-nanorc</b>, and again must be version 1.1.12 or newer (use nano -V to check your version and compiled features). Then simply copy the <b>nanorc.sample</b> that came with the nano source or your nano package (most likely in /usr/doc/nano) to .nanorc in your home directory. If you didn't get one, the syntax is simple. Flags are turned on and off by using the word <b>set</b> and the getopt_long flag for the feature, for example &quot;set nowrap&quot; or &quot;set suspend&quot;.</p></blockquote>
<hr width="100%">
@ -245,6 +244,7 @@
<h2><a name="8"></a>8. ChangeLog</h2>
<blockquote>
<p>
2005/01/02 - Remove now-inaccurate note about verbatim input's not working at prompts. (DLR)
2004/11/21 - List sh as an example of a Bourne shell. (DLR)
2004/11/05 - Fixed inaccuracy: Pico compatibility mode was made the default in nano 1.1.99pre1, not 1.2.2. Also added question about how to type F13-F16 on terminals lacking keys past F12 (suggested by Chris), question about how to select text for the clipboard in X terminals with nano's mouse support turned on (answer found by Joseph Birthisel), and misc. fixes and link updates. (DLR)<br>
2004/04/07 - Removed NumLock glitch question, as it's no longer needed. (DLR)<br>

Просмотреть файл

@ -582,6 +582,7 @@ void do_statusbar_left(void);
void do_statusbar_backspace(void);
void do_statusbar_delete(void);
void do_statusbar_cut_text(void);
void do_statusbar_verbatim_input(void);
void do_statusbar_output(int *kbinput, size_t kbinput_len);
size_t xplustabs(void);
size_t actual_x(const char *str, size_t xplus);

Просмотреть файл

@ -1651,7 +1651,8 @@ int do_statusbar_input(bool *meta_key, bool *func_key, bool *s_or_t,
input == NANO_HOME_KEY || input == NANO_END_KEY ||
input == NANO_FORWARD_KEY || input == NANO_BACK_KEY ||
input == NANO_BACKSPACE_KEY || input == NANO_DELETE_KEY ||
input == NANO_CUT_KEY);
input == NANO_CUT_KEY || (*meta_key == TRUE &&
input == NANO_VERBATIM_KEY));
/* Set s_or_t to TRUE if we got a shortcut. */
*s_or_t = have_shortcut;
@ -1728,6 +1729,16 @@ int do_statusbar_input(bool *meta_key, bool *func_key, bool *s_or_t,
currshortcut != writefile_list)
do_statusbar_cut_text();
break;
case NANO_VERBATIM_KEY:
if (*meta_key == TRUE) {
/* If we're using restricted mode, the filename
* isn't blank, and we're at the "Write File"
* prompt, disable verbatim input. */
if (!ISSET(RESTRICTED) || filename[0] == '\0' ||
currshortcut != writefile_list)
do_statusbar_verbatim_input();
break;
}
/* Handle the normal statusbar prompt shortcuts, setting
* finished to TRUE to indicate that we're done after
* running or trying to run their associated
@ -1821,6 +1832,20 @@ void do_statusbar_cut_text(void)
statusbar_xend = 0;
}
void do_statusbar_verbatim_input(void)
{
int *kbinput; /* Used to hold verbatim input. */
size_t kbinput_len; /* Length of verbatim input. */
/* Read in all the verbatim characters. */
kbinput = get_verbatim_kbinput(bottomwin, &kbinput_len);
/* Display all the verbatim characters at once. */
do_statusbar_output(kbinput, kbinput_len);
free(kbinput);
}
void do_statusbar_output(int *kbinput, size_t kbinput_len)
{
size_t i;