shortcut_init()
- Fix erroneous #ifdef so that nano compiles with
--disable-justify again. (DLR; found by Mike Frysinger)
+ - Change the Cancel shortcut in the file browser to an Exit
+ shortcut, to be more compatible with the current version of
+ Pico. (DLR)
thanks_for_all_the_fish()
- Delete topwin, edit, and bottomwin. (David Benbennick)
- nano.c:
do_justify()
- - Add on_next_line flag, used to indicate when we've moved to
+ - Add allow_respacing flag, used to indicate when we've moved to
the next line after justifying the current line, and only run
the respacing routine when it's true. This keeps the
respacing routine from erroneously being run more than once on
the same line. (DLR)
+ - Check for first_par_line's not being NULL and only run the
+ renumbering and cutbuffer-splicing routines depending on that
+ if that's the case. This fixes a segfault occurring when
+ trying to do full justification on a file with no paragraphs
+ (in which case there are no normal lines to renumber and no
+ backed-up lines to be stored in the cutbuffer or spliced back
+ in during unjustify). (DLR)
do_exit()
- Tweak for efficiency. (David Benbennick)
main()
- Move the reset_cursor() call to the beginning of the main
input loop, and remove the apparently unnecessary wrefresh()
call. (David Benbennick)
+- nano.h:
+ - Reassign the key for full justification to Ctrl-U, for
+ compatibility with the current version of Pico. (DLR)
- proto.h:
- Change the variables in the prototypes for do_justify(),
get_verbatim_kbinput(), and get_mouseinput() to match the ones
- Tweak the code to update the edit window just before getting
statusbar input for efficiency, and update bottomwin just
before then too. (David Benbennick)
+ - Don't delete the statusbar line on UnCut, since the current
+ version of Pico doesn't. (DLR)
+ line_len()
+ - Rename to help_line_len() so as not to conflict with the
+ line_len variable used elsewhere, and move inside the
+ DISABLE_HELP #ifdef surrounding do_help() since it's only
+ called in do_help(). (DLR)
+ do_help()
+ - Have help_line_len() properly return an int again, since its
+ value can't be larger than COLS. (DLR)
+ - Allow the user to exit the help browser via Ctrl-C as well as
+ Ctrl-X, for consistency with the file browser. (DLR)
GNU nano 1.3.3 - 2004.06.28
- General:
const char *nano_multibuffer_msg = N_("Insert into new buffer");
#endif
#ifndef DISABLE_BROWSER
- const char *nano_gotodir_msg = N_("Go to directory");
+ const char *nano_exit_browser_msg = N_("Exit from the file browser");
+ const char *nano_goto_dir_msg = N_("Go to directory");
#endif
#endif /* !DISABLE_HELP */
#endif
);
- sc_init_one(&browser_list, NANO_CANCEL_KEY, cancel_msg,
- IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
+ sc_init_one(&browser_list, NANO_EXIT_KEY, exit_msg,
+ IFHELP(nano_exit_browser_msg, NANO_NO_KEY), NANO_EXIT_FKEY,
NANO_NO_KEY, VIEW, 0);
sc_init_one(&browser_list, NANO_PREVPAGE_KEY, prev_page_msg,
/* Translators: try to keep this string under 22 characters long */
sc_init_one(&browser_list, NANO_GOTO_KEY, N_("Go To Dir"),
- IFHELP(nano_gotodir_msg, NANO_ALT_GOTO_KEY), NANO_GOTO_FKEY,
+ IFHELP(nano_goto_dir_msg, NANO_ALT_GOTO_KEY), NANO_GOTO_FKEY,
NANO_NO_KEY, VIEW, 0);
free_shortcutage(&gotodir_list);
/* We are now done justifying the paragraph or the file, so clean
* up. totlines, totsize, and current_y have been maintained above.
* Set last_par_line to the new end of the paragraph, update
- * fileage, and set current_x. Also, edit_refresh() needs the line
- * numbers to be right, so renumber(). */
+ * fileage, and renumber() since edit_refresh() needs the line
+ * numbers to be right (but only do the last two if we actually
+ * justified something). */
last_par_line = current->prev;
- if (first_par_line->prev == NULL)
- fileage = first_par_line;
- renumber(first_par_line);
+ if (first_par_line != NULL) {
+ if (first_par_line->prev == NULL)
+ fileage = first_par_line;
+ renumber(first_par_line);
+ }
edit_refresh();
current_y = current_y_save;
edittop = edittop_save;
- /* Splice the cutbuffer back into the file. */
- cutbottom->next = last_par_line->next;
- cutbottom->next->prev = cutbottom;
+ /* Splice the cutbuffer back into the file, but only if we
+ * actually justified something. */
+ if (first_par_line != NULL) {
+ cutbottom->next = last_par_line->next;
+ cutbottom->next->prev = cutbottom;
/* The line numbers after the end of the paragraph have been
* changed, so we change them back. */
- renumber(cutbottom->next);
- if (first_par_line->prev != NULL) {
- cutbuffer->prev = first_par_line->prev;
- cutbuffer->prev->next = cutbuffer;
- } else
- fileage = cutbuffer;
+ renumber(cutbottom->next);
+ if (first_par_line->prev != NULL) {
+ cutbuffer->prev = first_par_line->prev;
+ cutbuffer->prev->next = cutbuffer;
+ } else
+ fileage = cutbuffer;
- last_par_line->next = NULL;
- free_filestruct(first_par_line);
+ last_par_line->next = NULL;
+ free_filestruct(first_par_line);
+ }
/* Restore global variables from before the justify. */
totsize = totsize_save;
#define NANO_PREVWORD_KEY NANO_ALT_SPACE
#define NANO_PARABEGIN_KEY NANO_CONTROL_W
#define NANO_PARAEND_KEY NANO_CONTROL_O
-#define NANO_FULLJUSTIFY_KEY NANO_CONTROL_J
+#define NANO_FULLJUSTIFY_KEY NANO_CONTROL_U
#define NANO_VERBATIM_KEY NANO_ALT_V
#ifndef NANO_SMALL
void display_main_list(void);
void do_cursorpos(int constant);
void do_cursorpos_void(void);
-size_t line_len(const char *ptr);
+#ifndef DISABLE_HELP
+int help_line_len(const char *ptr);
void do_help(void);
+#endif
void do_replace_highlight(int highlight_flag, const char *word);
#ifdef DEBUG
void dump_buffer(const filestruct *inptr);
}
break;
case NANO_CUT_KEY:
- case NANO_UNCUT_KEY:
/* If we're using restricted mode, the filename isn't blank,
- * and we're at the "Write File" prompt, disable Cut and
- * UnCut. */
+ * and we're at the "Write File" prompt, disable Cut. */
if (!ISSET(RESTRICTED) || filename[0] == '\0' || s != writefile_list) {
null_at(&answer, 0);
xend = 0;
do_cursorpos(FALSE);
}
+#ifndef DISABLE_HELP
/* Calculate the next line of help_text, starting at ptr. */
-size_t line_len(const char *ptr)
+int help_line_len(const char *ptr)
{
- size_t j = 0;
+ int j = 0;
while (*ptr != '\n' && *ptr != '\0' && j < COLS - 5) {
ptr++;
return j;
}
-#ifndef DISABLE_HELP
/* Our dynamic, shortcut-list-compliant help function. */
void do_help(void)
{
/* Calculate where in the text we should be, based on the
* page. */
for (i = 0; i < line; i++) {
- ptr += line_len(ptr);
+ ptr += help_line_len(ptr);
if (*ptr == '\n')
ptr++;
}
for (i = 0; i < editwinrows && *ptr != '\0'; i++) {
- int j = line_len(ptr);
+ int j = help_line_len(ptr);
mvwaddnstr(edit, i, 0, ptr, j);
ptr += j;
skip_redisplay:
kbinput = get_kbinput(edit, &meta_key);
- } while (kbinput != NANO_EXIT_KEY && kbinput != NANO_EXIT_FKEY);
+ } while (kbinput != NANO_CANCEL_KEY && kbinput != NANO_EXIT_KEY &&
+ kbinput != NANO_EXIT_FKEY);
#ifndef DISABLE_MOUSE
currshortcut = oldshortcut;