From 51b3eec536eab440903aed1fd8d511f0692632c0 Mon Sep 17 00:00:00 2001 From: Chris Allegretta Date: Mon, 18 Dec 2000 02:23:50 +0000 Subject: [PATCH] Added -b, -e and -f compatibility flags, updated man pages, added Alt-Alt-x functionality git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@411 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 12 +++++++++++- faq.html | 2 +- nano.1 | 7 ++++++- nano.1.html | 10 ++++++++-- nano.c | 36 +++++++++++++++++++++++++++++------- 5 files changed, 55 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 68de2c2a..79c51c55 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,9 +6,11 @@ General HURD. Changes in files.c:write_file(), new function nano.c:clear_filename(), many changed in main(), a few other places. Please test this! + - Added -b, -e, and -f flags, which we ignore as nano provides + their functionality already. - cut.c: do_uncut_text() - - Fix renumbering bug when uncutting marked test at filebot. + - Fix renumbering bug when uncutting marked text at filebot. - Fix screen not being displayed when we are uncutting marked text at editbot (Bug discovered by Ken Tyler). - Fix magic line not getting created when (you guessed it) @@ -26,6 +28,14 @@ General - nano.c: renumber() - Dont stupidly assign the value of prev->lineno if prev == NULL! + main() + - Added code to check for Alt-Alt (27-27) keystrokes and set the + next keystroke as a control sequence. New variable + modify_control_key. Removed #ifdef _POSIX_VDISABLE check + around Control-S,Q,Z handlers because we need it now for + the Alt-Alt-x code. +- nano.1, nano.1.html: + - Updated man page for -b, -e, -f and expanded explanation for -p. - utils.c: new_magicline() - Increment totsize!! We decrement it when we've read a file, diff --git a/faq.html b/faq.html index 088ec32d..233be9b2 100644 --- a/faq.html +++ b/faq.html @@ -21,7 +21,7 @@ nano?
1.5. Why the name change from TIP? -
1.6 What is the current version +
1.6. What is the current version of nano?
1.7. I want to read the man page without having to download the program! diff --git a/nano.1 b/nano.1 index e308df75..9d9541ae 100644 --- a/nano.1 +++ b/nano.1 @@ -64,7 +64,9 @@ a new file, do not follow it. Good for editing files in /tmp perhaps? Enable mouse support (if available for your system). .TP .B \-p (\-\-pico) -Emulate Pico as closely as possible. +Emulate Pico as closely as possible. This affects both the "shortcut list" +at the bottom of the screen, as well as the display and entry of previous +search and replace strings. .TP .B \-s (\-\-speller) Enable alternative spell checker command. @@ -84,6 +86,9 @@ Disable help screen at bottom of editor. .B \-z (\-\-suspend) Enable suspend ability. .TP +.B \-b, \-e, \-f +Ignored, for compatibility with Pico. +.TP .B \+LINE Places cursor at LINE on startup. .SH NOTES diff --git a/nano.1.html b/nano.1.html index 1234256d..d035155b 100644 --- a/nano.1.html +++ b/nano.1.html @@ -86,7 +86,9 @@ Enable mouse support (if available for your system).
-p (--pico)
-Emulate Pico as closely as possible. +Emulate Pico as closely as possible. This affects both the "shortcut list" +at the bottom of the screen, as well as the display and entry of previous +search and replace strings.
-s (--speller)
@@ -111,6 +113,10 @@ Disable help screen at bottom of editor.
Enable suspend ability. +
-b, -e, -f + +
+Ignored, for compatibility with Pico.
+LINE
@@ -171,6 +177,6 @@ used by others). This document was created by man2html, using the manual pages.
-Time: 04:21:24 GMT, December 03, 2000 +Time: 02:16:52 GMT, December 18, 2000 diff --git a/nano.c b/nano.c index 12e3ba4c..890293bc 100644 --- a/nano.c +++ b/nano.c @@ -2034,7 +2034,7 @@ int main(int argc, char *argv[]) int kbinput; /* Input from keyboard */ long startline = 0; /* Line to try and start at */ int keyhandled = 0; /* Have we handled the keystroke yet? */ - int i; + int i, modify_control_seq = 0; char *argv0; #ifdef _POSIX_VDISABLE struct termios term; @@ -2077,10 +2077,10 @@ int main(int argc, char *argv[]) #endif #ifdef HAVE_GETOPT_LONG - while ((optchr = getopt_long(argc, argv, "?T:RVchiklmpr:s:tvwxz", + while ((optchr = getopt_long(argc, argv, "?T:RVbcefhiklmpr:s:tvwxz", long_options, &option_index)) != EOF) { #else - while ((optchr = getopt(argc, argv, "h?T:RVciklmpr:s:tvwxz")) != EOF) { + while ((optchr = getopt(argc, argv, "h?T:RVbcefiklmpr:s:tvwxz")) != EOF) { #endif switch (optchr) { @@ -2099,6 +2099,11 @@ int main(int argc, char *argv[]) case 'V': version(); exit(0); + case 'b': + case 'e': + case 'f': + /* Pico compatibility flags */ + break; case 'c': SET(CONSTUPDATE); break; @@ -2275,6 +2280,12 @@ int main(int argc, char *argv[]) } #endif break; + case 27: + /* If we get Alt-Alt, the next keystroke should be the same as a + control sequence */ + modify_control_seq = 1; + keyhandled = 1; + break; case 91: switch (kbinput = wgetch(edit)) { @@ -2404,6 +2415,18 @@ int main(int argc, char *argv[]) break; } } + /* If the modify_control_seq is set, we received an Alt-Alt + sequence before this, so we make this key a control sequence + by subtracting 64 or 96, depending on its value. */ + if (!keyhandled && modify_control_seq) { + if (kbinput >= 'A' && kbinput < 'a') + kbinput -= 64; + else if (kbinput >= 'a' && kbinput <= 'z') + kbinput -= 96; + + modify_control_seq = 0; + } + /* Look through the main shortcut list to see if we've hit a shortcut key */ for (i = 0; i < MAIN_LIST_LEN && !keyhandled; i++) { @@ -2417,18 +2440,17 @@ int main(int argc, char *argv[]) keyhandled = 1; } } -#ifndef _POSIX_VDISABLE - /* Since we're in raw mode, we have to catch ^Q and ^S */ + /* If we're in raw mode or using Alt-Alt-x, we have to catch + Control-S and Control-Q */ if (kbinput == 17 || kbinput == 19) keyhandled = 1; - /* And catch ^Z by hand when triggered */ + /* Catch ^Z by hand when triggered also */ if (kbinput == 26) { if (ISSET(SUSPEND)) do_suspend(0); keyhandled = 1; } -#endif /* Last gasp, stuff that's not in the main lists */ if (!keyhandled) -- 2.39.5