CVS code -
+- General
+ - Finally wrote function-specific help mode. Changes to
+ nano.c:help_init() and winio.c:do_help(). Changed
+ currshortcut and currslen #ifdefs to depend on both
+ DISABLE_HELP and DISABLE_MOUSE being defined to not
+ include. Changed all the shortcuts and lengths.
+- cut.c:
+ do_cut_text()
+ - Check to see whether marked text is contained within edit
+ window and if so only do an edit_refresh (variable dontupdate
+ replaces cuttingpartialline).
+ do_uncut_text()
+ - Similar display fixes (David Lawrence Ramsey).
- faq.html
- Removed nano-editor.org FTP site address [deprecated] and added
the GNU one.
- files.c:
- Added status messages for converted DOS and Mac files.
- People should know that their file wasnt normally formatted.
+ People should know that their file wasnt normally formatted.
+ load_file()
+ - Status message when trying to load an already loaded file with multiple
+ buffers (David Lawrence Ramsey).
+ read_file()
+ - Get rid of useless linetemp variable and name num_lines int
+ (David Lawrence Ramsey).
- nano.c:
- New function do_prev_word, similar to do_next_word. Hard coded as
Alt-space, as next word is hard coded as control-space.
+- rcfile.c:
+ - Fix incorrect number of rc options (David Lawrence Ramsey).
- po/sv.po:
- Updated Swedish translation (Christian Rose).
- po/sv.po:
if (top->lineno < edittop->lineno)
edit_update(top, CENTER);
}
+
}
#endif
{
filestruct *tmp, *fileptr = current;
#ifndef NANO_SMALL
- int cuttingpartialline = 0;
+ int dontupdate = 0;
int cuttingtoend = 0;
#endif
cuttingtoend = 1;
}
}
+
if (ISSET(MARK_ISSET)) {
if (current->lineno <= mark_beginbuf->lineno) {
- if (current->lineno == mark_beginbuf->lineno)
- cuttingpartialline = 1;
+ /* Don't do_update and move the screen position if the marked
+ area lies entirely within the screen buffer */
+ if (current->lineno == mark_beginbuf->lineno
+ || (current->lineno >= edittop->lineno
+ && mark_beginbuf->lineno <= editbot->lineno))
+ dontupdate = 1;
+
cut_marked_segment(current, current_x, mark_beginbuf,
mark_beginx, 1);
}
- else
+ else {
+ /* Same as above, easier logic since we know it's a multi-line
+ cut and mark_beginbuf is before current */
+ if (mark_beginbuf->lineno >= edittop->lineno
+ && current->lineno <= editbot->lineno)
+ dontupdate = 1;
+
cut_marked_segment(mark_beginbuf, mark_beginx, current,
current_x, 1);
+ }
+
placewewant = xplustabs();
UNSET(MARK_ISSET);
marked_cut = 1;
set_modified();
- if (cuttingpartialline || cuttingtoend)
+ if (dontupdate || cuttingtoend) {
+ fix_editbot();
edit_refresh();
- else
+ } else
edit_update(current, CENTER);
return 1;
i = editbot->lineno;
current = newend;
- if (i <= newend->lineno)
+ if (i < newend->lineno) {
edit_update(current, CENTER);
+ }
+ else {
+ edit_refresh();
+ }
}
/* If marked cut == 2, that means that we're doing a cut to end
i = editbot->lineno;
renumber(newbuf);
- if (i < newend->lineno)
+ if (i < newend->lineno) {
edit_update(fileptr, CENTER);
+ }
+ else {
+ edit_refresh();
+ }
dump_buffer_reverse(fileptr);
duplicate handling) */
if (quiet != 0)
quiet = 1;
- if (add_open_file(quiet, 1 - quiet) == 2)
+ if (add_open_file(quiet, 1 - quiet) == 2) {
load_open_file();
+ statusbar(_("File already loaded"));
+ }
#endif
wmove(edit, current_y, current_x);
int read_file(int fd, char *filename, int quiet)
{
- long size, num_lines = 0, linetemp = 0;
+ long size;
+ int num_lines = 0;
char input[2]; /* buffer */
char *buf;
long i = 0, bufx = 128;
input[1] = 0;
/* Read the entire file into file struct */
while ((size = read_byte(fd, filename, input)) > 0) {
- linetemp = 0;
if (input[0] == '\n') {
fileptr = read_line(buf, fileptr, &line1ins);
wrap_reset();
-#ifndef DISABLE_MOUSE
+#if !defined(DISABLE_BROWSER) || !defined(DISABLE_MOUSE)
currshortcut = insertfile_list;
currslen = INSERTFILE_LIST_LEN;
#endif
if (i == NANO_TOFILES_KEY) {
char *tmp = do_browse_from(realname);
-#ifndef DISABLE_MOUSE
+#if !defined(DISABLE_HELP) || !defined(DISABLE_MOUSE)
currshortcut = insertfile_list;
currslen = INSERTFILE_LIST_LEN;
#endif
/* save current modification status */
open_files->file_modified = ISSET(MODIFIED);
+ /* Unset the marker because nano can't (yet) handle marked text flipping between
+ open files */
+ UNSET(MARK_ISSET);
+
#ifdef DEBUG
fprintf(stderr, _("filename is %s"), open_files->data);
#endif
totlines = open_files->file_totlines;
totsize = open_files->file_totsize;
+ /* Unset the marker because nano can't (yet) handle marked text flipping between
+ open files */
+ UNSET(MARK_ISSET);
+
/* restore full file position: line number, x-coordinate, y-
coordinate, place we want */
do_gotopos(open_files->lineno, open_files->file_current_x, open_files->file_current_y, open_files->file_placewewant);
static int did_cred = 0;
#endif
-#ifndef DISABLE_MOUSE
+#if !defined(DISABLE_BROWSER) || !defined(DISABLE_MOUSE)
currshortcut = writefile_list;
currslen = WRITEFILE_LIST_LEN;
#endif
char *tmp = do_browse_from(answer);
-#ifndef DISABLE_MOUSE
+#if !defined(DISABLE_BROWSER) || !defined(DISABLE_MOUSE)
currshortcut = writefile_list;
currslen = WRITEFILE_LIST_LEN;
#endif
blank_statusbar_refresh();
-#ifndef DISABLE_MOUSE
+#if !defined DISABLE_HELP || !defined(DISABLE_MOUSE)
currshortcut = browser_list;
currslen = BROWSER_LIST_LEN;
#endif
else
selected = numents - 1;
break;
+ case NANO_HELP_KEY:
+ case NANO_HELP_FKEY:
+ do_help();
+ break;
case KEY_ENTER:
case NANO_ENTER_KEY:
case 's': /* More Pico compatibility */
char *answer = NULL; /* Answer str to many questions */
int totlines = 0; /* Total number of lines in the file */
-int totsize = 0; /* Total number of bytes in the file */
+long totsize = 0; /* Total number of bytes in the file */
int placewewant = 0; /* The column we'd like the cursor
to jump to when we go to the
next or previous line */
NANO_BRACKET_KEY, 0, 0, VIEW, do_find_bracket);
#endif
- sc_init_one(&whereis_list[0], NANO_FIRSTLINE_KEY, _("First Line"),
+
+ sc_init_one(&whereis_list[0], NANO_HELP_KEY,
+ _("Get Help"), nano_help_msg, 0, 0, 0, VIEW, do_help);
+
+ sc_init_one(&whereis_list[1], NANO_CANCEL_KEY,
+ _("Cancel"), nano_cancel_msg, 0, 0, 0, VIEW, 0);
+
+ sc_init_one(&whereis_list[2], NANO_FIRSTLINE_KEY, _("First Line"),
nano_firstline_msg, 0, 0, 0, VIEW, do_first_line);
- sc_init_one(&whereis_list[1], NANO_LASTLINE_KEY, _("Last Line"),
+ sc_init_one(&whereis_list[3], NANO_LASTLINE_KEY, _("Last Line"),
nano_lastline_msg, 0, 0, 0, VIEW, do_last_line);
- sc_init_one(&whereis_list[2], NANO_OTHERSEARCH_KEY, _("Replace"),
+ sc_init_one(&whereis_list[4], NANO_OTHERSEARCH_KEY, _("Replace"),
nano_replace_msg, 0, 0, 0, VIEW, do_replace);
- sc_init_one(&whereis_list[3], NANO_FROMSEARCHTOGOTO_KEY,
+ sc_init_one(&whereis_list[5], NANO_FROMSEARCHTOGOTO_KEY,
_("Goto Line"), nano_goto_msg, 0, 0, 0, VIEW,
do_gotoline_void);
#ifndef NANO_SMALL
- sc_init_one(&whereis_list[4], TOGGLE_CASE_KEY, _("Case Sens"),
+ sc_init_one(&whereis_list[6], TOGGLE_CASE_KEY, _("Case Sens"),
nano_case_msg, 0, 0, 0, VIEW, 0);
- sc_init_one(&whereis_list[5], TOGGLE_BACKWARDS_KEY, _("Direction"),
+ sc_init_one(&whereis_list[7], TOGGLE_BACKWARDS_KEY, _("Direction"),
nano_reverse_msg, 0, 0, 0, VIEW, 0);
#ifdef HAVE_REGEX_H
- sc_init_one(&whereis_list[REPLACE_LIST_LEN - 2], TOGGLE_REGEXP_KEY,
+ sc_init_one(&whereis_list[REPLACE_LIST_LEN - 1], TOGGLE_REGEXP_KEY,
_("Regexp"), nano_regexp_msg, 0, 0, 0, VIEW, 0);
#endif
#endif /* NANO_SMALL */
- sc_init_one(&whereis_list[REPLACE_LIST_LEN - 1], NANO_CANCEL_KEY,
- _("Cancel"), nano_cancel_msg, 0, 0, 0, VIEW, 0);
+ sc_init_one(&replace_list[0], NANO_HELP_KEY,
+ _("Get Help"), nano_help_msg, 0, 0, 0, VIEW, do_help);
+
+ sc_init_one(&replace_list[1], NANO_CANCEL_KEY,
+ _("Cancel"), nano_cancel_msg, 0, 0, 0, VIEW, 0);
- sc_init_one(&replace_list[0], NANO_FIRSTLINE_KEY, _("First Line"),
+ sc_init_one(&replace_list[2], NANO_FIRSTLINE_KEY, _("First Line"),
nano_firstline_msg, 0, 0, 0, VIEW, do_first_line);
- sc_init_one(&replace_list[1], NANO_LASTLINE_KEY, _("Last Line"),
+ sc_init_one(&replace_list[3], NANO_LASTLINE_KEY, _("Last Line"),
nano_lastline_msg, 0, 0, 0, VIEW, do_last_line);
- sc_init_one(&replace_list[2], NANO_OTHERSEARCH_KEY, _("No Replace"),
+ sc_init_one(&replace_list[4], NANO_OTHERSEARCH_KEY, _("No Replace"),
nano_whereis_msg, 0, 0, 0, VIEW, do_search);
- sc_init_one(&replace_list[3], NANO_FROMSEARCHTOGOTO_KEY,
+ sc_init_one(&replace_list[5], NANO_FROMSEARCHTOGOTO_KEY,
_("Goto Line"), nano_goto_msg, 0, 0, 0, VIEW,
do_gotoline_void);
#ifndef NANO_SMALL
- sc_init_one(&replace_list[4], TOGGLE_CASE_KEY, _("Case Sens"),
+ sc_init_one(&replace_list[6], TOGGLE_CASE_KEY, _("Case Sens"),
nano_case_msg, 0, 0, 0, VIEW, 0);
- sc_init_one(&replace_list[5], TOGGLE_BACKWARDS_KEY, _("Direction"),
+ sc_init_one(&replace_list[7], TOGGLE_BACKWARDS_KEY, _("Direction"),
nano_reverse_msg, 0, 0, 0, VIEW, 0);
#ifdef HAVE_REGEX_H
- sc_init_one(&replace_list[REPLACE_LIST_LEN - 2], TOGGLE_REGEXP_KEY,
+ sc_init_one(&replace_list[REPLACE_LIST_LEN - 1], TOGGLE_REGEXP_KEY,
_("Regexp"), nano_regexp_msg, 0, 0, 0, VIEW, 0);
#endif
#endif /* NANO_SMALL */
- sc_init_one(&replace_list[REPLACE_LIST_LEN - 1], NANO_CANCEL_KEY,
- _("Cancel"), nano_cancel_msg, 0, 0, 0, VIEW, 0);
+ sc_init_one(&replace_list_2[0], NANO_HELP_KEY,
+ _("Get Help"), nano_help_msg, 0, 0, 0, VIEW, do_help);
+
+ sc_init_one(&replace_list_2[1], NANO_CANCEL_KEY,
+ _("Cancel"), nano_cancel_msg, 0, 0, 0, VIEW, 0);
- sc_init_one(&replace_list_2[0], NANO_FIRSTLINE_KEY, _("First Line"),
+ sc_init_one(&replace_list_2[2], NANO_FIRSTLINE_KEY, _("First Line"),
nano_firstline_msg, 0, 0, 0, VIEW, do_first_line);
- sc_init_one(&replace_list_2[1], NANO_LASTLINE_KEY, _("Last Line"),
+ sc_init_one(&replace_list_2[3], NANO_LASTLINE_KEY, _("Last Line"),
nano_lastline_msg, 0, 0, 0, VIEW, do_last_line);
- sc_init_one(&replace_list_2[2], NANO_CANCEL_KEY, _("Cancel"),
- nano_cancel_msg, 0, 0, 0, VIEW, 0);
+ sc_init_one(&goto_list[0], NANO_HELP_KEY,
+ _("Get Help"), nano_help_msg, 0, 0, 0, VIEW, do_help);
+
+ sc_init_one(&goto_list[1], NANO_CANCEL_KEY, _("Cancel"),
+ nano_cancel_msg, 0, 0, 0, VIEW, 0);
- sc_init_one(&goto_list[0], NANO_FIRSTLINE_KEY, _("First Line"),
+ sc_init_one(&goto_list[2], NANO_FIRSTLINE_KEY, _("First Line"),
nano_firstline_msg, 0, 0, 0, VIEW, &do_first_line);
- sc_init_one(&goto_list[1], NANO_LASTLINE_KEY, _("Last Line"),
+ sc_init_one(&goto_list[3], NANO_LASTLINE_KEY, _("Last Line"),
nano_lastline_msg, 0, 0, 0, VIEW, &do_last_line);
- sc_init_one(&goto_list[2], NANO_CANCEL_KEY, _("Cancel"),
- nano_cancel_msg, 0, 0, 0, VIEW, 0);
-
sc_init_one(&help_list[0], NANO_PREVPAGE_KEY, _("Prev Page"),
nano_prevpage_msg,
nano_exit_msg, 0, NANO_EXIT_FKEY, 0, VIEW, do_exit);
+ sc_init_one(&writefile_list[0], NANO_HELP_KEY,
+ _("Get Help"), nano_help_msg, 0, 0, 0, VIEW, do_help);
+
+ sc_init_one(&writefile_list[1], NANO_CANCEL_KEY, _("Cancel"),
+ nano_cancel_msg, 0, 0, 0, VIEW, 0);
+
#ifndef DISABLE_BROWSER
- sc_init_one(&writefile_list[0], NANO_TOFILES_KEY, _("To Files"),
+ sc_init_one(&writefile_list[2], NANO_TOFILES_KEY, _("To Files"),
nano_tofiles_msg, 0, 0, 0, NOVIEW, 0);
#endif
- sc_init_one(&writefile_list[WRITEFILE_LIST_LEN - 2], NANO_APPEND_KEY, _("Append"),
+ sc_init_one(&writefile_list[WRITEFILE_LIST_LEN - 1], NANO_APPEND_KEY, _("Append"),
nano_append_msg, 0, 0, 0, NOVIEW, 0);
- sc_init_one(&writefile_list[WRITEFILE_LIST_LEN - 1], NANO_CANCEL_KEY, _("Cancel"),
+ sc_init_one(&insertfile_list[0], NANO_HELP_KEY,
+ _("Get Help"), nano_help_msg, 0, 0, 0, VIEW, do_help);
+
+ sc_init_one(&insertfile_list[1], NANO_CANCEL_KEY, _("Cancel"),
nano_cancel_msg, 0, 0, 0, VIEW, 0);
#ifndef DISABLE_BROWSER
- sc_init_one(&insertfile_list[0], NANO_TOFILES_KEY, _("To Files"),
+ sc_init_one(&insertfile_list[2], NANO_TOFILES_KEY, _("To Files"),
nano_tofiles_msg, 0, 0, 0, NOVIEW, 0);
#endif
- sc_init_one(&insertfile_list[INSERTFILE_LIST_LEN - 1], NANO_CANCEL_KEY, _("Cancel"),
- nano_cancel_msg, 0, 0, 0, VIEW, 0);
+ sc_init_one(&spell_list[0], NANO_HELP_KEY,
+ _("Get Help"), nano_help_msg, 0, 0, 0, VIEW, do_help);
- sc_init_one(&spell_list[0], NANO_CANCEL_KEY, _("Cancel"),
+ sc_init_one(&spell_list[1], NANO_CANCEL_KEY, _("Cancel"),
nano_cancel_msg, 0, 0, 0, VIEW, 0);
+
#ifndef DISABLE_BROWSER
- sc_init_one(&browser_list[0], NANO_PREVPAGE_KEY, _("Prev Page"),
+ sc_init_one(&browser_list[0], NANO_HELP_KEY,
+ _("Get Help"), nano_help_msg, 0, 0, 0, VIEW, do_help);
+
+ sc_init_one(&browser_list[1], NANO_EXIT_KEY, _("Exit"),
+ nano_exit_msg, 0, NANO_EXIT_FKEY, 0, VIEW, 0);
+
+ sc_init_one(&browser_list[2], NANO_PREVPAGE_KEY, _("Prev Page"),
nano_prevpage_msg,
0, NANO_PREVPAGE_FKEY, KEY_PPAGE, VIEW, 0);
- sc_init_one(&browser_list[1], NANO_NEXTPAGE_KEY, _("Next Page"),
+ sc_init_one(&browser_list[3], NANO_NEXTPAGE_KEY, _("Next Page"),
nano_nextpage_msg,
0, NANO_NEXTPAGE_FKEY, KEY_NPAGE, VIEW, 0);
- sc_init_one(&browser_list[2], NANO_GOTO_KEY, _("Goto"),
+ sc_init_one(&browser_list[4], NANO_GOTO_KEY, _("Goto"),
nano_gotodir_msg, 0, NANO_GOTO_FKEY, 0, VIEW, 0);
- sc_init_one(&browser_list[3], NANO_EXIT_KEY, _("Exit"),
- nano_exit_msg, 0, NANO_EXIT_FKEY, 0, VIEW, 0);
+ sc_init_one(&gotodir_list[0], NANO_HELP_KEY,
+ _("Get Help"), nano_help_msg, 0, 0, 0, VIEW, do_help);
- sc_init_one(&gotodir_list[0], NANO_CANCEL_KEY, _("Cancel"),
+ sc_init_one(&gotodir_list[1], NANO_CANCEL_KEY, _("Cancel"),
nano_cancel_msg, 0, 0, 0, VIEW, 0);
#endif
"Esc, Alt or Meta key depending on your keyboard setup. The "
"following keystrokes are available in the main editor window. "
"Optional keys are shown in parentheses:\n\n");
-
}
#endif
/* External spell checking */
int do_alt_speller(char *file_name)
{
- int alt_spell_status, x_cur = current_x, y_cur = current_y, pww_cur = placewewant;
+ int alt_spell_status, lineno_cur = current->lineno;
+ int x_cur = current_x, y_cur = current_y, pww_cur = placewewant;
+
pid_t pid_spell;
char *ptr;
- long lineno_cur = current->lineno;
static int arglen = 3;
static char **spellargs = (char **) NULL;
{
int i, sofar = 0;
long allocsize = 1; /* How much space we're gonna need for the help text */
- char buf[BUFSIZ] = "";
+ char buf[BUFSIZ] = "", *ptr = NULL;
+
+ /* First set up the initial help text for the current function */
+ if (currshortcut == whereis_list || currshortcut == replace_list
+ || currshortcut == replace_list_2)
+ ptr = _("Search Command Help Text\n\n "
+ "Enter the words or characters you would like to search "
+ "for, then hit enter. If there is a match for the text you "
+ "entered, the screen will be updated to the location of the "
+ " nearest match for the search string.\n\n "
+ "If using Pico Mode via the -p or --pico flags or using the "
+ "Meta-P toggle, the previous search string will be shown in "
+ "brackets after the Search: prompt. Hitting enter without "
+ "entering any text will preform the previous search. "
+ "Otherwise, the previous string will be placed in front of "
+ "the cursor, and can be edited or deleted before hitting "
+ "enter.\n\n The following functions keys are available in "
+ "Search mode:\n\n");
+ else if (currshortcut == goto_list)
+ ptr = _("Goto Line Help Text\n\n "
+ "Enter the line number that you wish to go to and hit "
+ "Enter. If thre are fewer lines of text than the "
+ "number you entered, you will be brought to the last line "
+ "of the file.\n\n The following functions keys are "
+ "available in Goto Line mode:\n\n");
+ else if (currshortcut == insertfile_list)
+ ptr = _("Insert File Help Text\n\n "
+ "Type in the name of a file to be inserted into the current "
+ "file buffer at the current cursor location.\n\n "
+ "If you have compiled nano with multiple file buffer "
+ "support, and enable multiple buffers with the -F "
+ "or --multibuffer command line flags or the Meta-F "
+ "toggle, inserting a file will cause it to be loaded into "
+ "a separate buffer (use Ctrl-< and > to switch between "
+ "file buffers).\n\n The following function keys are "
+ "available in Insert File mode:\n\n");
+ else if (currshortcut == writefile_list)
+ ptr = _("Write File Help Text\n\n "
+ "Type the name that you wish to save the current file "
+ "as and hit enter to save the file.\n\n "
+ "If you are using the marker code with Ctrl-^ and have "
+ "selected text, you will be prompted to save only the "
+ "selected portion to a separate file. To reduce the "
+ "chance of overwriting the current file with just a portion "
+ "of it, the current filename is not the default in this "
+ "mode.\n\n The following function keys are available in "
+ "Write File mode:\n\n");
+#ifndef DISABLE_BROWSER
+ else if (currshortcut == browser_list)
+ ptr = _("File Browser Help Text\n\n "
+ "The file browser is used to visually browse the "
+ "directory structure to select a file for reading "
+ "or writing. You may use the arrow keys or Page Up/"
+ "Down to browse through the files, and S or Enter to "
+ "choose the selected file or enter the selected "
+ "directory. To move up one level, select the directory "
+ "called \"..\" at the top of the file list.\n\n The "
+ "following functions keys are available in the file "
+ "browser:\n\n");
+ else if (currshortcut == gotodir_list)
+ ptr = _("Browser Goto Directory Help Text\n\n "
+ "Enter the name of the directory you would like to "
+ "browse to.\n\n If tab completion has not been disabled, "
+ "you can use the TAB key to (attempt to) automatically "
+ "complete the directory name. The following function "
+ "keys are available in Browser GotoDir mode:\n\n");
+#endif
+ else if (currshortcut == spell_list)
+ ptr = _("Spell Check Help Text\n\n "
+ "The spell checker checks the spelling of all text "
+ "in the current file. When an unknown word is "
+ "encountered, it is highlighted and a replacement can "
+ "be edited. It will then prompt to replace every "
+ "instance of the given misspelled word in the "
+ "current file.\n\n The following other functions are "
+ "available in Spell Check mode:\n\n");
+ else /* Default to the main help list */
+ ptr = help_text_init;
/* Compute the space needed for the shortcut lists - we add 15 to
have room for the shortcut abbrev and its possible alternate keys */
- for (i = 0; i <= MAIN_LIST_LEN - 1; i++)
- if (main_list[i].help != NULL)
- allocsize += strlen(main_list[i].help) + 15;
+ for (i = 0; i <= currslen - 1; i++)
+ if (currshortcut[i].help != NULL)
+ allocsize += strlen(currshortcut[i].help) + 15;
+
+ /* If we're on the main list, we also allocate space for toggle help text. */
+ if (currshortcut == main_list) {
+ for (i = 0; i <= TOGGLE_LEN - 1; i++)
+ if (toggles[i].desc != NULL)
+ allocsize += strlen(toggles[i].desc) + 30;
+
+ }
- /* And for the toggle list, we also allocate space for extra text. */
- for (i = 0; i <= TOGGLE_LEN - 1; i++)
- if (toggles[i].desc != NULL)
- allocsize += strlen(toggles[i].desc) + 30;
+ allocsize += strlen(ptr);
- allocsize += strlen(help_text_init);
if (help_text != NULL)
free(help_text);
help_text = charalloc(allocsize);
/* Now add the text we want */
- strcpy(help_text, help_text_init);
+ strcpy(help_text, ptr);
/* Now add our shortcut info */
- for (i = 0; i <= MAIN_LIST_LEN - 1; i++) {
- if (main_list[i].val > 0)
- sofar = snprintf(buf, BUFSIZ, "^%c ", main_list[i].val + 64);
+ for (i = 0; i <= currslen - 1; i++) {
+ if (currshortcut[i].val > 0 && currshortcut[i].val < 'a')
+ sofar = snprintf(buf, BUFSIZ, "^%c ", currshortcut[i].val + 64);
else
sofar = snprintf(buf, BUFSIZ, " ");
- if (main_list[i].misc1 > KEY_F0 && main_list[i].misc1 <= KEY_F(64))
+ if (currshortcut[i].misc1 > KEY_F0 && currshortcut[i].misc1 <= KEY_F(64))
sofar += snprintf(&buf[sofar], BUFSIZ - sofar, "(F%d) ",
- main_list[i].misc1 - KEY_F0);
+ currshortcut[i].misc1 - KEY_F0);
else
sofar += snprintf(&buf[sofar], BUFSIZ - sofar, " ");
- if (main_list[i].altval > 0 && main_list[i].altval < 91)
+ if (currshortcut[i].altval > 0 && currshortcut[i].altval < 91)
sofar += snprintf(&buf[sofar], BUFSIZ - sofar, "(M-%c) ",
- main_list[i].altval - 32);
- else if (main_list[i].altval > 0)
+ currshortcut[i].altval - 32);
+ else if (currshortcut[i].altval > 0)
sofar += snprintf(&buf[sofar], BUFSIZ - sofar, "(M-%c) ",
- main_list[i].altval);
+ currshortcut[i].altval);
+ /* Hack */
+ else if (currshortcut[i].val >= 'a')
+ sofar += snprintf(&buf[sofar], BUFSIZ - sofar, "(M-%c) ",
+ currshortcut[i].val - 32);
else
sofar += snprintf(&buf[sofar], BUFSIZ - sofar, " ");
- if (main_list[i].help != NULL)
- snprintf(&buf[sofar], BUFSIZ - sofar, "%s", main_list[i].help);
+ if (currshortcut[i].help != NULL)
+ snprintf(&buf[sofar], BUFSIZ - sofar, "%s", currshortcut[i].help);
strcat(help_text, buf);
}
/* And the toggles... */
- for (i = 0; i <= TOGGLE_LEN - 1; i++) {
- if (toggles[i].override_ch != 0)
- sofar = snprintf(buf, BUFSIZ,
+ if (currshortcut == main_list)
+ for (i = 0; i <= TOGGLE_LEN - 1; i++) {
+ if (toggles[i].override_ch != 0)
+ sofar = snprintf(buf, BUFSIZ,
"M-%c ", toggles[i].override_ch);
- else
- sofar = snprintf(buf, BUFSIZ,
+ else
+ sofar = snprintf(buf, BUFSIZ,
"M-%c ", toggles[i].val - 32);
- if (toggles[i].desc != NULL) {
- if (toggles[i].flag != 0)
- snprintf(&buf[sofar], BUFSIZ - sofar, _("%s enable/disable"),
+ if (toggles[i].desc != NULL) {
+ if (toggles[i].flag != 0)
+ snprintf(&buf[sofar], BUFSIZ - sofar, _("%s enable/disable"),
toggles[i].desc);
- else
- snprintf(&buf[sofar], BUFSIZ - sofar, "%s",
+ else
+ snprintf(&buf[sofar], BUFSIZ - sofar, "%s",
toggles[i].desc);
}
reset_cursor();
while (1) {
- constcheck = current->lineno + current_x + totsize;
+ constcheck = current->lineno + current_x + current_y + totsize;
#ifndef DISABLE_MOUSE
currshortcut = main_list;
case -1: /* Stuff that we don't want to do squat */
case 410: /* Must ignore this, it gets sent when we resize */
+ case 29: /* Ctrl-] */
#ifdef PDCURSES
case 541: /* ???? */
case 542: /* Control and alt in Windows *shrug* */
if (ISSET(DISABLE_CURPOS))
UNSET(DISABLE_CURPOS);
else if (ISSET(CONSTUPDATE))
- if (constcheck != current->lineno + current_x + totsize)
+ if (constcheck != current->lineno + current_x + current_y + totsize)
do_cursorpos();
reset_cursor();
char *file_path; /* Current file's full path location */
int file_placewewant; /* Current file's place we want */
int file_totlines; /* Current file's total number of lines */
- int file_totsize; /* Current file's total size */
+ long file_totsize; /* Current file's total size */
#endif
- long lineno; /* The line number */
+ int lineno; /* The line number */
} filestruct;
typedef struct shortcut {
#define MULTI_TOGGLES 0
#endif
-#define WHEREIS_LIST_LEN (8 - NO_REGEX - NO_TOGGLES)
-#define REPLACE_LIST_LEN (8 - NO_REGEX - NO_TOGGLES)
+#define WHEREIS_LIST_LEN (9 - NO_REGEX - NO_TOGGLES)
+#define REPLACE_LIST_LEN (9 - NO_REGEX - NO_TOGGLES)
#define TOGGLE_LEN (14 - NO_REGEX + MULTI_TOGGLES)
-#define WRITEFILE_LIST_LEN (3 - NO_BROWSER)
-#define INSERTFILE_LIST_LEN (2 - NO_BROWSER)
-#define BROWSER_LIST_LEN 4
+#define WRITEFILE_LIST_LEN (4 - NO_BROWSER)
+#define INSERTFILE_LIST_LEN (3 - NO_BROWSER)
+#define BROWSER_LIST_LEN 5
#define MAIN_LIST_LEN (27 - NO_REGEX)
#define MAIN_VISIBLE 12
-#define REPLACE_LIST_2_LEN 3
-#define GOTO_LIST_LEN 3
-#define GOTODIR_LIST_LEN 1
+#define REPLACE_LIST_2_LEN 4
+#define GOTO_LIST_LEN 4
+#define GOTODIR_LIST_LEN 2
#define HELP_LIST_LEN 3
-#define SPELL_LIST_LEN 1
-
-
+#define SPELL_LIST_LEN 2
#define VIEW 1
#: winio.c:1436
#, c-format
-msgid "line %d of %d (%.0f%%), character %d of %d (%.0f%%)"
-msgstr "línia %d de %d (%.0f%%), caràcter %d de %d (%.0f%%)"
+msgid "line %d of %d (%.0f%%), character %ld of %ld (%.0f%%)"
+msgstr "línia %d de %d (%.0f%%), caràcter %ld de %ld (%.0f%%)"
#: winio.c:1580
msgid "Dumping file buffer to stderr...\n"
#: winio.c:1436
#, c-format
-msgid "line %d of %d (%.0f%%), character %d of %d (%.0f%%)"
-msgstr "øádka %d z %d (%.0f%%), znak %d z %d (%.0f%%)"
+msgid "line %d of %d (%.0f%%), character %ld of %ld (%.0f%%)"
+msgstr "øádka %d z %d (%.0f%%), znak %ld z %ld (%.0f%%)"
#: winio.c:1580
msgid "Dumping file buffer to stderr...\n"
#: winio.c:1436
#, c-format
-msgid "line %d of %d (%.0f%%), character %d of %d (%.0f%%)"
-msgstr "linje %d af %d (%.0f%%), tegn %d af %d (%.0f%%)"
+msgid "line %d of %d (%.0f%%), character %ld of %ld (%.0f%%)"
+msgstr "linje %d af %d (%.0f%%), tegn %ld af %ld (%.0f%%)"
#: winio.c:1580
msgid "Dumping file buffer to stderr...\n"
#: winio.c:1436
#, c-format
-msgid "line %d of %d (%.0f%%), character %d of %d (%.0f%%)"
-msgstr "Zeile %d von %d (%.0f%%), Zeichen %d von %d (%.0f%%)"
+msgid "line %d of %d (%.0f%%), character %ld of %ld (%.0f%%)"
+msgstr "Zeile %d von %d (%.0f%%), Zeichen %ld von %ld (%.0f%%)"
#: winio.c:1580
msgid "Dumping file buffer to stderr...\n"
#: winio.c:1436
#, c-format
-msgid "line %d of %d (%.0f%%), character %d of %d (%.0f%%)"
-msgstr "línea %d de %d (%.0f%%), carácter %d de %d (%.0f%%)"
+msgid "line %d of %d (%.0f%%), character %ld of %ld (%.0f%%)"
+msgstr "línea %d de %d (%.0f%%), carácter %ld de %ld (%.0f%%)"
#: winio.c:1580
msgid "Dumping file buffer to stderr...\n"
#: winio.c:1436
#, c-format
-msgid "line %d of %d (%.0f%%), character %d of %d (%.0f%%)"
-msgstr "rivi %d/%d (%.0f%%), merkki %d/%d (%.0f%%)"
+msgid "line %d of %d (%.0f%%), character %ld of %ld (%.0f%%)"
+msgstr "rivi %d/%d (%.0f%%), merkki %ld/%ld (%.0f%%)"
#: winio.c:1580
msgid "Dumping file buffer to stderr...\n"
#: winio.c:1436
#, c-format
-msgid "line %d of %d (%.0f%%), character %d of %d (%.0f%%)"
-msgstr "ligne %d sur %d (%.0f%%), caractère %d sur %d (%.0f%%)"
+msgid "line %d of %d (%.0f%%), character %ld of %ld (%.0f%%)"
+msgstr "ligne %d sur %d (%.0f%%), caractère %ld sur %ld (%.0f%%)"
#: winio.c:1580
msgid "Dumping file buffer to stderr...\n"
#: winio.c:1436
#, c-format
-msgid "line %d of %d (%.0f%%), character %d of %d (%.0f%%)"
-msgstr "liña %d de %d (%.0f%%), carácter %d de %d (%.0f%%)"
+msgid "line %d of %d (%.0f%%), character %ld of %ld (%.0f%%)"
+msgstr "liña %d de %d (%.0f%%), carácter %ld de %ld (%.0f%%)"
#: winio.c:1580
msgid "Dumping file buffer to stderr...\n"
#: winio.c:1436
#, c-format
-msgid "line %d of %d (%.0f%%), character %d of %d (%.0f%%)"
-msgstr "%d(/%d). sor (%.0f%%) és a(z) %d(/%d). karakter (%.0f%%)"
+msgid "line %d of %d (%.0f%%), character %ld of %ld (%.0f%%)"
+msgstr "%d(/%d). sor (%.0f%%) és a(z) %ld(/%ld). karakter (%.0f%%)"
#: winio.c:1580
msgid "Dumping file buffer to stderr...\n"
#: winio.c:1436
#, c-format
-msgid "line %d of %d (%.0f%%), character %d of %d (%.0f%%)"
-msgstr "baris %d dari %d (%f.0f%%), karakter %d dari %d (%.0f%%)"
+msgid "line %d of %d (%.0f%%), character %ld of %ld (%.0f%%)"
+msgstr "baris %d dari %d (%f.0f%%), karakter %ld dari %ld (%.0f%%)"
#: winio.c:1580
msgid "Dumping file buffer to stderr...\n"
#: winio.c:1436
#, c-format
-msgid "line %d of %d (%.0f%%), character %d of %d (%.0f%%)"
-msgstr "Riga %d di %d (%.0f%%), carattere %d di %d (%.0f%%)"
+msgid "line %d of %d (%.0f%%), character %ld of %ld (%.0f%%)"
+msgstr "Riga %d di %d (%.0f%%), carattere %ld di %ld (%.0f%%)"
#: winio.c:1580
msgid "Dumping file buffer to stderr...\n"
#: winio.c:1436
#, c-format
-msgid "line %d of %d (%.0f%%), character %d of %d (%.0f%%)"
-msgstr "regel %d van %d (%.0f%%), karakter %d van %d (%.0f%%)"
+msgid "line %d of %d (%.0f%%), character %ld of %ld (%.0f%%)"
+msgstr "regel %d van %d (%.0f%%), karakter %ld van %ld (%.0f%%)"
#: winio.c:1580
msgid "Dumping file buffer to stderr...\n"
#: winio.c:1436
#, c-format
-msgid "line %d of %d (%.0f%%), character %d of %d (%.0f%%)"
-msgstr "linje %d av %d (%.0f%%), tegn %d av %d (%.0f%%)"
+msgid "line %d of %d (%.0f%%), character %ld of %ld (%.0f%%)"
+msgstr "linje %d av %d (%.0f%%), tegn %ld av %ld (%.0f%%)"
#: winio.c:1580
msgid "Dumping file buffer to stderr...\n"
#: winio.c:1436
#, c-format
-msgid "line %d of %d (%.0f%%), character %d of %d (%.0f%%)"
-msgstr "ÓÔÒÏËÁ %d ÉÚ %d (%.0f%%), ÓÉÍ×ÏÌ %d ÉÚ %d (%.0f%%)"
+msgid "line %d of %d (%.0f%%), character %ld of %ld (%.0f%%)"
+msgstr "ÓÔÒÏËÁ %d ÉÚ %d (%.0f%%), ÓÉÍ×ÏÌ %ld ÉÚ %ld (%.0f%%)"
#: winio.c:1580
msgid "Dumping file buffer to stderr...\n"
#: winio.c:1436
#, c-format
-msgid "line %d of %d (%.0f%%), character %d of %d (%.0f%%)"
-msgstr "rad %d av %d (%.0f%%), tecken %d av %d (%.0f%%)"
+msgid "line %d of %d (%.0f%%), character %ld of %ld (%.0f%%)"
+msgstr "rad %d av %d (%.0f%%), tecken %ld av %ld (%.0f%%)"
#: winio.c:1580
msgid "Dumping file buffer to stderr...\n"
#: winio.c:1436
#, c-format
-msgid "line %d of %d (%.0f%%), character %d of %d (%.0f%%)"
-msgstr "ÒÑÄÏË %d Ú %d (%.0f%%), ̦ÔÅÒÁ %d Ú %d (%.0f%%)"
+msgid "line %d of %d (%.0f%%), character %ld of %ld (%.0f%%)"
+msgstr "ÒÑÄÏË %d Ú %d (%.0f%%), ̦ÔÅÒÁ %ld Ú %ld (%.0f%%)"
#: winio.c:1580
msgid "Dumping file buffer to stderr...\n"
extern int current_x, current_y, posible_max, totlines;
extern int placewewant;
extern int mark_beginx, samelinewrap;
-extern int totsize, temp_opt;
+extern long totsize;
+extern int temp_opt;
extern int fill, wrap_at, flags,tabsize;
extern int search_last_line;
extern int currslen;
#ifdef ENABLE_MULTIBUFFER
filestruct *open_file_dup_search(int update);
#endif
+
+#ifndef DISABLE_HELP
+void help_init(void);
+#endif
#define _(string) (string)
#endif
-#define NUM_RCOPTS 18
+#ifndef DISABLE_WRAPJUSTIFY
+ #define NUM_RCOPTS 18
+#else
+ #define NUM_RCOPTS 17
+#endif
+
/* Static stuff for the nanorc file */
rcoption rcopts[NUM_RCOPTS] =
{
#ifdef ENABLE_COLOR
color_on(bottomwin, COLOR_STATUSBAR);
+#else
+ wattron(bottomwin, A_REVERSE);
#endif
blank_statusbar();
#ifdef ENABLE_COLOR
color_off(bottomwin, COLOR_STATUSBAR);
+#else
+ wattroff(bottomwin, A_REVERSE);
#endif
}
x_left = strlen(buf);
x = strlen(def) + x_left;
-#ifndef DISABLE_MOUSE
+#if !defined(DISABLE_HELP) || !defined(DISABLE_MOUSE)
currshortcut = s;
currslen = slen;
#endif
if (kbinput == s[j].val && kbinput < 32) {
+#ifndef DISABLE_HELP
+ /* Have to do this here, it would be too late to do it in statusq */
+ if (kbinput == NANO_HELP_KEY
+ || kbinput == NANO_HELP_FKEY) {
+ do_help();
+ break;
+ }
+#endif
+
/* We shouldn't discard the answer it gave, just because
we hit a keystroke, GEEZ! */
answer = mallocstrcpy(answer, inputbuf);
editbot = hold;
else
editbot = temp;
+
+ /* What the hell are we expecting to update the screen if this isn't
+ here? luck?? */
+ wrefresh(edit);
}
/*
{
filestruct *fileptr;
float linepct = 0.0, bytepct = 0.0;
- int i = 0;
+ long i = 0;
if (current == NULL || fileage == NULL)
return 0;
linepct, bytepct);
#endif
- statusbar(_("line %d of %d (%.0f%%), character %d of %d (%.0f%%)"),
+ statusbar(_("line %d of %d (%.0f%%), character %ld of %ld (%.0f%%)"),
current->lineno, totlines, linepct, i, totsize, bytepct);
reset_cursor();
return 1;
int do_help(void)
{
#ifndef DISABLE_HELP
- char *ptr = help_text, *end;
+ char *ptr, *end;
int i, j, row = 0, page = 1, kbinput = 0, no_more = 0, kp, kp2;
int no_help_flag = 0;
+ shortcut *oldshortcut;
+ int oldslen;
blank_edit();
curs_set(0);
+ wattroff(bottomwin, A_REVERSE);
blank_statusbar();
-#ifndef DISABLE_MOUSE
+ help_init();
+ ptr = help_text;
+
+ oldshortcut = currshortcut;
+ oldslen = currslen;
+
currshortcut = help_list;
currslen = HELP_LIST_LEN;
-#endif
kp = keypad_on(edit, 1);
kp2 = keypad_on(bottomwin, 1);
} while ((kbinput = wgetch(edit)) != NANO_EXIT_KEY &&
kbinput != NANO_EXIT_FKEY);
+ currshortcut = oldshortcut;
+ currslen = oldslen;
+
if (no_help_flag) {
blank_bottombars();
wrefresh(bottomwin);
SET(NO_HELP);
window_init();
}
- display_main_list();
+ else
+ bottombars(currshortcut, currslen);
curs_set(1);
edit_refresh();
fileptr = inptr;
while (fileptr != NULL) {
- fprintf(stderr, "(%ld) %s\n", fileptr->lineno, fileptr->data);
+ fprintf(stderr, "(%d) %s\n", fileptr->lineno, fileptr->data);
fflush(stderr);
fileptr = fileptr->next;
}
fileptr = filebot;
while (fileptr != NULL) {
- fprintf(stderr, "(%ld) %s\n", fileptr->lineno, fileptr->data);
+ fprintf(stderr, "(%d) %s\n", fileptr->lineno, fileptr->data);
fflush(stderr);
fileptr = fileptr->prev;
}