From 627de19ce00e5455856a0084683a18dca144bcbf Mon Sep 17 00:00:00 2001 From: Chris Allegretta Date: Wed, 12 Jul 2000 02:09:17 +0000 Subject: [PATCH] Added Pico's -k option (in 5 lines of code :-) git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@99 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 2 + cut.c | 5 ++ nano.c | 11 ++- nano.h | 1 + po/cat-id-tbl.c | 180 ++++++++++++++++++++++++------------------------ po/nano.pot | 144 ++++++++++++++++++++------------------ 6 files changed, 184 insertions(+), 159 deletions(-) diff --git a/ChangeLog b/ChangeLog index d1e3b76c..5a4a6992 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,6 @@ Current CVS: +- Implemented Pico's -k mode. New flag CUT_TO_END, option (-k, --cut), + affects do_cut_text in cut.c. - nano.c: main(): - TABSIZE now set before first call to edit_refresh (Bill Soudan) diff --git a/cut.c b/cut.c index a746a744..76bcf024 100644 --- a/cut.c +++ b/cut.c @@ -149,6 +149,11 @@ int do_cut_text(void) #endif } #ifndef NANO_SMALL + if (ISSET(CUT_TO_END)) { + SET(MARK_ISSET); + mark_beginbuf = current; + mark_beginx = strlen(current->data); + } if (ISSET(MARK_ISSET)) { if (current->lineno == mark_beginbuf->lineno) { tmp = copy_node(current); diff --git a/nano.c b/nano.c index 1d401b25..55838131 100644 --- a/nano.c +++ b/nano.c @@ -323,6 +323,8 @@ void usage(void) (" -c --const Constantly show cursor position\n")); printf(_ (" -h --help Show this message\n")); + printf(_ + (" -k --cut Let ^K cut from cursor to end of line\n")); printf(_ (" -i --autoindent Automatically indent new lines\n")); printf(_ @@ -361,6 +363,7 @@ void usage(void) printf(_(" -V Print version information and exit\n")); printf(_(" -c Constantly show cursor position\n")); printf(_(" -h Show this message\n")); + printf(_(" -k Let ^K cut from cursor to end of line\n")); printf(_(" -i Automatically indent new lines\n")); printf(_ (" -l Don't follow symbolic links, overwrite.\n")); @@ -1542,6 +1545,7 @@ int main(int argc, char *argv[]) {"nowrap", 0, 0, 'w'}, {"nohelp", 0, 0, 'x'}, {"help", 0, 0, 'h'}, + {"cut", 0, 0, 'k'}, {"autoindent", 0, 0, 'i'}, {"tempfile", 0, 0, 't'}, {"speller", 1, 0, 's'}, @@ -1566,10 +1570,10 @@ int main(int argc, char *argv[]) #endif #ifdef HAVE_GETOPT_LONG - while ((optchr = getopt_long(argc, argv, "?T:RVchilmpr:s:tvwxz", + while ((optchr = getopt_long(argc, argv, "?T:RVchiklmpr:s:tvwxz", long_options, &option_index)) != EOF) { #else - while ((optchr = getopt(argc, argv, "h?T:RVcilmpr:s:tvwxz")) != EOF) { + while ((optchr = getopt(argc, argv, "h?T:RVciklmpr:s:tvwxz")) != EOF) { #endif switch (optchr) { @@ -1604,6 +1608,9 @@ int main(int argc, char *argv[]) case 'i': SET(AUTOINDENT); break; + case 'k': + SET(CUT_TO_END); + break; case 'l': UNSET(FOLLOW_SYMLINKS); break; diff --git a/nano.h b/nano.h index 802f97d8..14fa75c7 100644 --- a/nano.h +++ b/nano.h @@ -104,6 +104,7 @@ typedef struct shortcut { #define USE_MOUSE (1<<13) #define USE_REGEXP (1<<14) #define REGEXP_COMPILED (1<<15) +#define CUT_TO_END (1<<16) /* Control key sequences, chaning these would be very very bad */ diff --git a/po/cat-id-tbl.c b/po/cat-id-tbl.c index 66409ce8..183b0c1a 100644 --- a/po/cat-id-tbl.c +++ b/po/cat-id-tbl.c @@ -120,97 +120,99 @@ Usage: nano [GNU long option] [option] +LINE \n\ {" -V \t\t--version\t\tPrint version information and exit\n", 92}, {" -c \t\t--const\t\t\tConstantly show cursor position\n", 93}, {" -h \t\t--help\t\t\tShow this message\n", 94}, - {" -i \t\t--autoindent\t\tAutomatically indent new lines\n", 95}, - {" -l \t\t--nofollow\t\tDon't follow symbolic links, overwrite.\n", 96}, - {" -m \t\t--mouse\t\t\tEnable mouse\n", 97}, + {" -k \t\t--cut\t\t\tLet ^K cut from cursor to end of line\n", 95}, + {" -i \t\t--autoindent\t\tAutomatically indent new lines\n", 96}, + {" -l \t\t--nofollow\t\tDon't follow symbolic links, overwrite.\n", 97}, + {" -m \t\t--mouse\t\t\tEnable mouse\n", 98}, {"\ - -r [#cols] \t--fill=[#cols]\t\tSet fill cols to (wrap lines at) #cols\n", 98}, - {" -p\t \t--pico\t\t\tMake bottom 2 lines more Pico-like\n", 99}, - {" -s [prog] \t--speller=[prog]\tEnable alternate speller\n", 100}, - {" -t \t\t--tempfile\t\tAuto save on exit, don't prompt\n", 101}, - {" -v \t\t--view\t\t\tView (read only) mode\n", 102}, - {" -w \t\t--nowrap\t\tDon't wrap long lines\n", 103}, - {" -x \t\t--nohelp\t\tDon't show help window\n", 104}, - {" -z \t\t--suspend\t\tEnable suspend\n", 105}, - {" +LINE\t\t\t\t\tStart at line number LINE\n", 106}, + -r [#cols] \t--fill=[#cols]\t\tSet fill cols to (wrap lines at) #cols\n", 99}, + {" -p\t \t--pico\t\t\tMake bottom 2 lines more Pico-like\n", 100}, + {" -s [prog] \t--speller=[prog]\tEnable alternate speller\n", 101}, + {" -t \t\t--tempfile\t\tAuto save on exit, don't prompt\n", 102}, + {" -v \t\t--view\t\t\tView (read only) mode\n", 103}, + {" -w \t\t--nowrap\t\tDon't wrap long lines\n", 104}, + {" -x \t\t--nohelp\t\tDon't show help window\n", 105}, + {" -z \t\t--suspend\t\tEnable suspend\n", 106}, + {" +LINE\t\t\t\t\tStart at line number LINE\n", 107}, {"\ Usage: nano [option] +LINE \n\ -\n", 107}, - {"Option\t\tMeaning\n", 108}, - {" -T [num]\tSet width of a tab to num\n", 109}, - {" -R\t\tUse regular expressions for search\n", 110}, - {" -V \t\tPrint version information and exit\n", 111}, - {" -c \t\tConstantly show cursor position\n", 112}, - {" -h \t\tShow this message\n", 113}, - {" -i \t\tAutomatically indent new lines\n", 114}, - {" -l \t\tDon't follow symbolic links, overwrite.\n", 115}, - {" -m \t\tEnable mouse\n", 116}, - {" -r [#cols] \tSet fill cols to (wrap lines at) #cols\n", 117}, - {" -s [prog] \tEnable alternate speller\n", 118}, - {" -p \t\tMake bottom 2 lines more Pico-like\n", 119}, - {" -t \t\tAuto save on exit, don't prompt\n", 120}, - {" -v \t\tView (read only) mode\n", 121}, - {" -w \t\tDon't wrap long lines\n", 122}, - {" -x \t\tDon't show help window\n", 123}, - {" -z \t\tEnable suspend\n", 124}, - {" +LINE\t\tStart at line number LINE\n", 125}, - {" nano version %s by Chris Allegretta (compiled %s, %s)\n", 126}, - {" Email: nano@asty.org\tWeb: http://www.asty.org/nano\n", 127}, - {"Mark Set", 128}, - {"Mark UNset", 129}, - {"check_wrap called with inptr->data=\"%s\"\n", 130}, - {"current->data now = \"%s\"\n", 131}, - {"After, data = \"%s\"\n", 132}, - {"Error deleting tempfile, ack!", 133}, - {"Could not create a temporary filename: %s", 134}, - {"Could not invoke spell program \"%s\"", 135}, - {"Could not invoke \"ispell\"", 136}, - {"Finished checking spelling", 137}, - {"Save modified buffer (ANSWERING \"No\" WILL DESTROY CHANGES) ? ", 138}, - {"Cannot resize top win", 139}, - {"Cannot move top win", 140}, - {"Cannot resize edit win", 141}, - {"Cannot move edit win", 142}, - {"Cannot resize bottom win", 143}, - {"Cannot move bottom win", 144}, - {"Main: set up windows\n", 145}, - {"Main: bottom win\n", 146}, - {"Main: open file\n", 147}, - {"I got Alt-[-%c! (%d)\n", 148}, - {"I got Alt-%c! (%d)\n", 149}, - {"Case Sensitive Regexp Search%s%s", 150}, - {"Regexp Search%s%s", 151}, - {"Case Sensitive Search%s%s", 152}, - {"Search%s%s", 153}, - {" (to replace)", 154}, - {"Search Cancelled", 155}, - {"Search Wrapped", 156}, - {"Replaced %d occurences", 157}, - {"Replaced 1 occurence", 158}, - {"Replace Cancelled", 159}, - {"Replace with [%s]", 160}, - {"Replace with", 161}, - {"Replace this instance?", 162}, - {"Enter line number", 163}, - {"Aborted", 164}, - {"Come on, be reasonable", 165}, - {"Only %d lines available, skipping to last line", 166}, - {"actual_x_from_start for xplus=%d returned %d\n", 167}, - {"input '%c' (%d)\n", 168}, - {"New Buffer", 169}, - {" File: ...", 170}, - {"Modified", 171}, - {"Moved to (%d, %d) in edit buffer\n", 172}, - {"current->data = \"%s\"\n", 173}, - {"I got \"%s\"\n", 174}, - {"Yes", 175}, - {"All", 176}, - {"No", 177}, - {"do_cursorpos: linepct = %f, bytepct = %f\n", 178}, - {"line %d of %d (%.0f%%), character %d of %d (%.0f%%)", 179}, - {"Dumping file buffer to stderr...\n", 180}, - {"Dumping cutbuffer to stderr...\n", 181}, - {"Dumping a buffer to stderr...\n", 182}, +\n", 108}, + {"Option\t\tMeaning\n", 109}, + {" -T [num]\tSet width of a tab to num\n", 110}, + {" -R\t\tUse regular expressions for search\n", 111}, + {" -V \t\tPrint version information and exit\n", 112}, + {" -c \t\tConstantly show cursor position\n", 113}, + {" -h \t\tShow this message\n", 114}, + {" -k \t\tLet ^K cut from cursor to end of line\n", 115}, + {" -i \t\tAutomatically indent new lines\n", 116}, + {" -l \t\tDon't follow symbolic links, overwrite.\n", 117}, + {" -m \t\tEnable mouse\n", 118}, + {" -r [#cols] \tSet fill cols to (wrap lines at) #cols\n", 119}, + {" -s [prog] \tEnable alternate speller\n", 120}, + {" -p \t\tMake bottom 2 lines more Pico-like\n", 121}, + {" -t \t\tAuto save on exit, don't prompt\n", 122}, + {" -v \t\tView (read only) mode\n", 123}, + {" -w \t\tDon't wrap long lines\n", 124}, + {" -x \t\tDon't show help window\n", 125}, + {" -z \t\tEnable suspend\n", 126}, + {" +LINE\t\tStart at line number LINE\n", 127}, + {" nano version %s by Chris Allegretta (compiled %s, %s)\n", 128}, + {" Email: nano@asty.org\tWeb: http://www.asty.org/nano\n", 129}, + {"Mark Set", 130}, + {"Mark UNset", 131}, + {"check_wrap called with inptr->data=\"%s\"\n", 132}, + {"current->data now = \"%s\"\n", 133}, + {"After, data = \"%s\"\n", 134}, + {"Error deleting tempfile, ack!", 135}, + {"Could not create a temporary filename: %s", 136}, + {"Could not invoke spell program \"%s\"", 137}, + {"Could not invoke \"ispell\"", 138}, + {"Finished checking spelling", 139}, + {"Save modified buffer (ANSWERING \"No\" WILL DESTROY CHANGES) ? ", 140}, + {"Cannot resize top win", 141}, + {"Cannot move top win", 142}, + {"Cannot resize edit win", 143}, + {"Cannot move edit win", 144}, + {"Cannot resize bottom win", 145}, + {"Cannot move bottom win", 146}, + {"Main: set up windows\n", 147}, + {"Main: bottom win\n", 148}, + {"Main: open file\n", 149}, + {"I got Alt-[-%c! (%d)\n", 150}, + {"I got Alt-%c! (%d)\n", 151}, + {"Case Sensitive Regexp Search%s%s", 152}, + {"Regexp Search%s%s", 153}, + {"Case Sensitive Search%s%s", 154}, + {"Search%s%s", 155}, + {" (to replace)", 156}, + {"Search Cancelled", 157}, + {"Search Wrapped", 158}, + {"Replaced %d occurences", 159}, + {"Replaced 1 occurence", 160}, + {"Replace Cancelled", 161}, + {"Replace with [%s]", 162}, + {"Replace with", 163}, + {"Replace this instance?", 164}, + {"Enter line number", 165}, + {"Aborted", 166}, + {"Come on, be reasonable", 167}, + {"Only %d lines available, skipping to last line", 168}, + {"actual_x_from_start for xplus=%d returned %d\n", 169}, + {"input '%c' (%d)\n", 170}, + {"New Buffer", 171}, + {" File: ...", 172}, + {"Modified", 173}, + {"Moved to (%d, %d) in edit buffer\n", 174}, + {"current->data = \"%s\"\n", 175}, + {"I got \"%s\"\n", 176}, + {"Yes", 177}, + {"All", 178}, + {"No", 179}, + {"do_cursorpos: linepct = %f, bytepct = %f\n", 180}, + {"line %d of %d (%.0f%%), character %d of %d (%.0f%%)", 181}, + {"Dumping file buffer to stderr...\n", 182}, + {"Dumping cutbuffer to stderr...\n", 183}, + {"Dumping a buffer to stderr...\n", 184}, }; -int _msg_tbl_length = 182; +int _msg_tbl_length = 184; diff --git a/po/nano.pot b/po/nano.pot index 2ea8c1a1..158e3a26 100644 --- a/po/nano.pot +++ b/po/nano.pot @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2000-07-08 23:23-0400\n" +"POT-Creation-Date: 2000-07-11 22:00-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -32,7 +32,7 @@ msgstr "" msgid "Read %d lines" msgstr "" -#: files.c:215 search.c:172 search.c:191 +#: files.c:215 search.c:172 search.c:190 #, c-format msgid "\"%s\" not found" msgstr "" @@ -55,7 +55,7 @@ msgstr "" msgid "File to insert [from ./] " msgstr "" -#: files.c:271 files.c:295 files.c:462 nano.c:1135 +#: files.c:271 files.c:295 files.c:462 nano.c:1138 msgid "Cancelled" msgstr "" @@ -420,233 +420,241 @@ msgid " -h \t\t--help\t\t\tShow this message\n" msgstr "" #: nano.c:327 -msgid " -i \t\t--autoindent\t\tAutomatically indent new lines\n" +msgid " -k \t\t--cut\t\t\tLet ^K cut from cursor to end of line\n" msgstr "" #: nano.c:329 +msgid " -i \t\t--autoindent\t\tAutomatically indent new lines\n" +msgstr "" + +#: nano.c:331 msgid " -l \t\t--nofollow\t\tDon't follow symbolic links, overwrite.\n" msgstr "" -#: nano.c:332 +#: nano.c:334 msgid " -m \t\t--mouse\t\t\tEnable mouse\n" msgstr "" -#: nano.c:337 +#: nano.c:339 msgid "" " -r [#cols] \t--fill=[#cols]\t\tSet fill cols to (wrap lines at) #cols\n" msgstr "" -#: nano.c:339 +#: nano.c:341 msgid " -p\t \t--pico\t\t\tMake bottom 2 lines more Pico-like\n" msgstr "" -#: nano.c:341 +#: nano.c:343 msgid " -s [prog] \t--speller=[prog]\tEnable alternate speller\n" msgstr "" -#: nano.c:343 +#: nano.c:345 msgid " -t \t\t--tempfile\t\tAuto save on exit, don't prompt\n" msgstr "" -#: nano.c:345 +#: nano.c:347 msgid " -v \t\t--view\t\t\tView (read only) mode\n" msgstr "" -#: nano.c:347 +#: nano.c:349 msgid " -w \t\t--nowrap\t\tDon't wrap long lines\n" msgstr "" -#: nano.c:349 +#: nano.c:351 msgid " -x \t\t--nohelp\t\tDon't show help window\n" msgstr "" -#: nano.c:351 +#: nano.c:353 msgid " -z \t\t--suspend\t\tEnable suspend\n" msgstr "" -#: nano.c:353 +#: nano.c:355 msgid " +LINE\t\t\t\t\tStart at line number LINE\n" msgstr "" -#: nano.c:355 +#: nano.c:357 msgid "" "Usage: nano [option] +LINE \n" "\n" msgstr "" -#: nano.c:356 +#: nano.c:358 msgid "Option\t\tMeaning\n" msgstr "" -#: nano.c:358 +#: nano.c:360 msgid " -T [num]\tSet width of a tab to num\n" msgstr "" -#: nano.c:360 +#: nano.c:362 msgid " -R\t\tUse regular expressions for search\n" msgstr "" -#: nano.c:361 +#: nano.c:363 msgid " -V \t\tPrint version information and exit\n" msgstr "" -#: nano.c:362 +#: nano.c:364 msgid " -c \t\tConstantly show cursor position\n" msgstr "" -#: nano.c:363 +#: nano.c:365 msgid " -h \t\tShow this message\n" msgstr "" -#: nano.c:364 +#: nano.c:366 +msgid " -k \t\tLet ^K cut from cursor to end of line\n" +msgstr "" + +#: nano.c:367 msgid " -i \t\tAutomatically indent new lines\n" msgstr "" -#: nano.c:366 +#: nano.c:369 msgid " -l \t\tDon't follow symbolic links, overwrite.\n" msgstr "" -#: nano.c:369 +#: nano.c:372 msgid " -m \t\tEnable mouse\n" msgstr "" -#: nano.c:373 +#: nano.c:376 msgid " -r [#cols] \tSet fill cols to (wrap lines at) #cols\n" msgstr "" -#: nano.c:374 +#: nano.c:377 msgid " -s [prog] \tEnable alternate speller\n" msgstr "" -#: nano.c:375 +#: nano.c:378 msgid " -p \t\tMake bottom 2 lines more Pico-like\n" msgstr "" -#: nano.c:376 +#: nano.c:379 msgid " -t \t\tAuto save on exit, don't prompt\n" msgstr "" -#: nano.c:377 +#: nano.c:380 msgid " -v \t\tView (read only) mode\n" msgstr "" -#: nano.c:378 +#: nano.c:381 msgid " -w \t\tDon't wrap long lines\n" msgstr "" -#: nano.c:379 +#: nano.c:382 msgid " -x \t\tDon't show help window\n" msgstr "" -#: nano.c:380 +#: nano.c:383 msgid " -z \t\tEnable suspend\n" msgstr "" -#: nano.c:381 +#: nano.c:384 msgid " +LINE\t\tStart at line number LINE\n" msgstr "" -#: nano.c:388 +#: nano.c:391 #, c-format msgid " nano version %s by Chris Allegretta (compiled %s, %s)\n" msgstr "" -#: nano.c:390 +#: nano.c:393 msgid " Email: nano@asty.org\tWeb: http://www.asty.org/nano\n" msgstr "" -#: nano.c:415 +#: nano.c:418 msgid "Mark Set" msgstr "" -#: nano.c:420 +#: nano.c:423 msgid "Mark UNset" msgstr "" -#: nano.c:862 +#: nano.c:865 #, c-format msgid "check_wrap called with inptr->data=\"%s\"\n" msgstr "" -#: nano.c:922 +#: nano.c:925 #, c-format msgid "current->data now = \"%s\"\n" msgstr "" -#: nano.c:975 +#: nano.c:978 #, c-format msgid "After, data = \"%s\"\n" msgstr "" -#: nano.c:1045 +#: nano.c:1048 msgid "Error deleting tempfile, ack!" msgstr "" -#: nano.c:1062 +#: nano.c:1065 #, c-format msgid "Could not create a temporary filename: %s" msgstr "" -#: nano.c:1086 +#: nano.c:1089 #, c-format msgid "Could not invoke spell program \"%s\"" msgstr "" #. Why 32512? I dont know! -#: nano.c:1092 +#: nano.c:1095 msgid "Could not invoke \"ispell\"" msgstr "" -#: nano.c:1104 +#: nano.c:1107 msgid "Finished checking spelling" msgstr "" -#: nano.c:1122 +#: nano.c:1125 msgid "Save modified buffer (ANSWERING \"No\" WILL DESTROY CHANGES) ? " msgstr "" -#: nano.c:1245 +#: nano.c:1248 msgid "Cannot resize top win" msgstr "" -#: nano.c:1247 +#: nano.c:1250 msgid "Cannot move top win" msgstr "" -#: nano.c:1249 +#: nano.c:1252 msgid "Cannot resize edit win" msgstr "" -#: nano.c:1251 +#: nano.c:1254 msgid "Cannot move edit win" msgstr "" -#: nano.c:1253 +#: nano.c:1256 msgid "Cannot resize bottom win" msgstr "" -#: nano.c:1255 +#: nano.c:1258 msgid "Cannot move bottom win" msgstr "" -#: nano.c:1718 +#: nano.c:1725 msgid "Main: set up windows\n" msgstr "" -#: nano.c:1740 +#: nano.c:1747 msgid "Main: bottom win\n" msgstr "" -#: nano.c:1746 +#: nano.c:1753 msgid "Main: open file\n" msgstr "" -#: nano.c:1819 +#: nano.c:1826 #, c-format msgid "I got Alt-[-%c! (%d)\n" msgstr "" -#: nano.c:1835 +#: nano.c:1842 #, c-format msgid "I got Alt-%c! (%d)\n" msgstr "" @@ -679,51 +687,51 @@ msgstr "" msgid "Search Cancelled" msgstr "" -#: search.c:187 +#: search.c:186 msgid "Search Wrapped" msgstr "" -#: search.c:241 +#: search.c:240 #, c-format msgid "Replaced %d occurences" msgstr "" -#: search.c:243 +#: search.c:242 msgid "Replaced 1 occurence" msgstr "" -#: search.c:382 search.c:403 search.c:426 +#: search.c:381 search.c:402 search.c:425 msgid "Replace Cancelled" msgstr "" -#: search.c:399 +#: search.c:398 #, c-format msgid "Replace with [%s]" msgstr "" #. last_search is empty -#: search.c:424 +#: search.c:423 msgid "Replace with" msgstr "" -#: search.c:465 +#: search.c:464 msgid "Replace this instance?" msgstr "" #. Ask for it -#: search.c:516 +#: search.c:515 msgid "Enter line number" msgstr "" -#: search.c:518 +#: search.c:517 msgid "Aborted" msgstr "" -#: search.c:538 +#: search.c:537 msgid "Come on, be reasonable" msgstr "" -#: search.c:543 +#: search.c:542 #, c-format msgid "Only %d lines available, skipping to last line" msgstr "" -- 2.39.5