mirror of
git://git.sv.gnu.org/nano.git
synced 2024-12-26 20:29:46 +03:00
add a bunch of key-related fixes: put Meta-( (Meta-9), Meta-) (Meta-0),
and Meta-J back in the shortcut list since Meta-G is used in the file browser and not as a toggle, tweak nanogetstr() and statusq() so that resetstatuspos can be reduced to a static bool, change the names of some keys to be more consistent, and add the ^R^X^X and ^W^T^T shortcuts (note that the latter doesn't preserve the contents of the statusbar yet when ^T is pressed at the "Go To Line" prompt), and add a few other miscellaneous tweaks git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1954 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
parent
47e82b1752
commit
e5d8f32834
27
ChangeLog
27
ChangeLog
@ -39,11 +39,12 @@ CVS code -
|
||||
edit_update(), rename open_the_file() to open_file() since the
|
||||
latter has been removed, and rename load_a_file() to
|
||||
load_buffer().
|
||||
- Add alternative shortcuts to the main list for moving to the
|
||||
beginning and end of a paragraph and justifying the entire
|
||||
file: Meta-( (Meta-9), Meta-) (Meta-0), and Meta-J,
|
||||
respectively. Do this because Pico's practice of putting these
|
||||
shortcuts in the search menu is rather odd. (DLR)
|
||||
- Add alternative shortcuts to the main and search shortcut
|
||||
lists for moving to the beginning and end of a paragraph and
|
||||
justifying the entire file: Meta-( (Meta-9), Meta-) (Meta-0),
|
||||
and Meta-J, respectively. Do this because Pico's practice of
|
||||
putting these shortcuts only in the search shortcut list is
|
||||
rather odd. (DLR)
|
||||
- Turn off extended input processing (the IEXTEN termios flag)
|
||||
as nano 1.2.x does. New function disable_extended_input();
|
||||
changes to terminal_init(). (DLR)
|
||||
@ -57,11 +58,17 @@ CVS code -
|
||||
- Add a multibuffer mode toggle to the "Execute Command" prompt,
|
||||
for consistency with the "Read File" prompt. Changes to
|
||||
do_insertfile() and shortcut_init(). (DLR)
|
||||
- Add an ^X toggle to the "Execute Command" prompt to go back to
|
||||
the "Insert File" prompt, and add a ^T toggle to the "Go To
|
||||
Line" prompt to go back to the "Where Is" prompt. Changes to
|
||||
do_insertfile(), shortcut_init(), do_gotoline(), etc.
|
||||
- Make sure a few uninitialized static variables are initialized
|
||||
to sane values. (DLR)
|
||||
- files.c:
|
||||
do_insertfile()
|
||||
- Readd the NANO_SMALL #ifdef around the start_again: label to
|
||||
avoid a warning. (DLR)
|
||||
- Simplify by reusing variables where possible. (DLR)
|
||||
- Simplify by reusing variables whereever possible. (DLR)
|
||||
- global.c:
|
||||
shortcut_init()
|
||||
- Remove redundant NANO_SMALL #ifdef. (DLR)
|
||||
@ -127,9 +134,17 @@ CVS code -
|
||||
- If there are more than MAIN_VISIBLE shortcuts available, only
|
||||
register clicks on the first MAIN_VISIBLE shortcuts, since
|
||||
bottombars() only shows that many shortcuts. (DLR)
|
||||
check_statblank()
|
||||
- Rename to check_statusblank(), and rename its associated
|
||||
global int statusblank too. (DLR)
|
||||
nanogetstr()
|
||||
- Refresh the screen when Ctrl-L is pressed at the statusbar
|
||||
prompt, as Pico does. (DLR)
|
||||
- Always return the key pressed by the user. (DLR)
|
||||
statusq()
|
||||
- Rework slightly to reset the cursor position when the user
|
||||
hits Enter as well as Cancel. This means that resetstatuspos
|
||||
no longer needs to be global. (DLR)
|
||||
reset_cursor()
|
||||
- If this is called before any files have been opened, as it can
|
||||
be by statusbar(), put the cursor at the top left corner of
|
||||
|
8
TODO
8
TODO
@ -11,11 +11,11 @@ For version 1.4:
|
||||
- Keystroke to implement "Add next sequence as raw" like vi's ^V.
|
||||
[DONE for edit window, needs to be done for statusbar prompt]
|
||||
- Spell check selected text only. [DONE]
|
||||
- Make "To line" (^W^T) and "Read from Command" (^R^X) re-enter their
|
||||
- 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
|
||||
(^R^X^X)(requires figuring out when to keep cursor pos and when not
|
||||
to).
|
||||
- Fix resetstatuspos global which we shouldn't have.
|
||||
(^R^X^X) (requires figuring out when to keep cursor position and when
|
||||
not to). [DONE]
|
||||
- Fix resetstatuspos global which we shouldn't have. [DONE]
|
||||
- Rewrite the nano FAQ in SGML.
|
||||
|
||||
Old requests:
|
||||
|
@ -34,7 +34,7 @@ static int marked_cut;
|
||||
/* Is the cutbuffer from a mark? 0 means whole-line cut, 1
|
||||
* means mark, and 2 means cut-from-cursor. */
|
||||
#ifndef NANO_SMALL
|
||||
static bool concatenate_cut;
|
||||
static bool concatenate_cut = FALSE;
|
||||
/* Should we add this cut string to the end of the last one? */
|
||||
#endif
|
||||
static filestruct *cutbottom = NULL;
|
||||
@ -205,7 +205,7 @@ void do_cut_text(void)
|
||||
|
||||
assert(current != NULL && current->data != NULL);
|
||||
|
||||
check_statblank();
|
||||
check_statusblank();
|
||||
|
||||
if (!keep_cutbuffer) {
|
||||
free_filestruct(cutbuffer);
|
||||
@ -315,7 +315,7 @@ void do_uncut_text(void)
|
||||
#ifndef DISABLE_WRAPPING
|
||||
wrap_reset();
|
||||
#endif
|
||||
check_statblank();
|
||||
check_statusblank();
|
||||
if (cutbuffer == NULL || current == NULL)
|
||||
return; /* AIEEEEEEEEEEEE */
|
||||
|
||||
|
79
src/files.c
79
src/files.c
@ -481,21 +481,41 @@ void do_insertfile(void)
|
||||
char *ans = mallocstrcpy(NULL, "");
|
||||
/* The last answer the user typed on the statusbar. Saved for if
|
||||
* they do M-F or cancel the file browser. */
|
||||
#ifndef NANO_SMALL
|
||||
bool extcmd = FALSE;
|
||||
#endif
|
||||
|
||||
wrap_reset();
|
||||
|
||||
#if !defined(DISABLE_BROWSER) || (!defined(NANO_SMALL) && defined(ENABLE_MULTIBUFFER))
|
||||
start_again: /* Go here when the user cancels the file browser. */
|
||||
start_again:
|
||||
#endif
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
if (extcmd) {
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
if (ISSET(MULTIBUFFER))
|
||||
msg = N_("File to insert into new buffer [from %s] ");
|
||||
else
|
||||
if (ISSET(MULTIBUFFER))
|
||||
msg = N_("Command to execute in new buffer [from %s] ");
|
||||
else
|
||||
#endif
|
||||
msg = N_("Command to execute [from %s] ");
|
||||
} else {
|
||||
#endif
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
if (ISSET(MULTIBUFFER)) {
|
||||
msg = N_("File to insert into new buffer [from %s] ");
|
||||
} else
|
||||
#endif
|
||||
msg = N_("File to insert [from %s] ");
|
||||
#ifndef NANO_SMALL
|
||||
}
|
||||
#endif
|
||||
msg = N_("File to insert [from %s] ");
|
||||
|
||||
i = statusq(TRUE, insertfile_list, ans,
|
||||
i = statusq(TRUE,
|
||||
#ifndef NANO_SMALL
|
||||
extcmd ? extcmd_list :
|
||||
#endif
|
||||
insertfile_list, ans,
|
||||
#ifndef NANO_SMALL
|
||||
NULL,
|
||||
#endif
|
||||
@ -511,58 +531,33 @@ void do_insertfile(void)
|
||||
|
||||
ans = mallocstrcpy(ans, answer);
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
#if !defined(NANO_SMALL) && defined(ENABLE_MULTIBUFFER)
|
||||
if (i == TOGGLE_MULTIBUFFER_KEY) {
|
||||
/* Don't allow toggling if we're in view mode. */
|
||||
if (!ISSET(VIEW_MODE))
|
||||
TOGGLE(MULTIBUFFER);
|
||||
goto start_again;
|
||||
}
|
||||
#endif /* ENABLE_MULTIBUFFER */
|
||||
if (i == NANO_EXTCMD_KEY) {
|
||||
int j;
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
exec_again: /* Go here when the user toggles multibuffer mode. */
|
||||
|
||||
if (ISSET(MULTIBUFFER))
|
||||
msg = N_("Command to execute in new buffer");
|
||||
else
|
||||
#endif
|
||||
msg = N_("Command to execute");
|
||||
|
||||
j = statusq(TRUE, extcmd_list, ans, NULL, _(msg));
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
if (j == TOGGLE_MULTIBUFFER_KEY) {
|
||||
/* Don't allow toggling if we're in view mode. */
|
||||
if (!ISSET(VIEW_MODE)) {
|
||||
TOGGLE(MULTIBUFFER);
|
||||
ans = mallocstrcpy(NULL, answer);
|
||||
}
|
||||
goto exec_again;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (j == -1 || answer == NULL || answer[0] == '\0')
|
||||
goto start_again;
|
||||
}
|
||||
#endif /* !NANO_SMALL */
|
||||
#ifndef DISABLE_BROWSER
|
||||
if (i == NANO_TOFILES_KEY) {
|
||||
char *tmp = do_browse_from(answer);
|
||||
|
||||
if (tmp == NULL)
|
||||
goto start_again;
|
||||
resetstatuspos = TRUE;
|
||||
free(answer);
|
||||
answer = tmp;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
if (i == NANO_EXTCMD_KEY)
|
||||
if (i == NANO_TOOTHERINSERT_KEY) {
|
||||
extcmd = !extcmd;
|
||||
goto start_again;
|
||||
}
|
||||
|
||||
if (extcmd)
|
||||
execute_command(answer);
|
||||
else {
|
||||
#endif
|
||||
@ -590,7 +585,7 @@ void do_insertfile(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
/* If we've gone off the bottom, recenter; otherwise, just redraw */
|
||||
/* Refresh the screen. */
|
||||
edit_refresh();
|
||||
} else
|
||||
statusbar(_("Cancelled"));
|
||||
@ -2543,7 +2538,7 @@ char *do_browser(const char *inpath)
|
||||
char *new_path;
|
||||
/* Used by the Go To Directory prompt. */
|
||||
|
||||
check_statblank();
|
||||
check_statusblank();
|
||||
|
||||
#if !defined(DISABLE_HELP) || !defined(DISABLE_MOUSE)
|
||||
currshortcut = browser_list;
|
||||
@ -2700,8 +2695,8 @@ char *do_browser(const char *inpath)
|
||||
return do_browser(path);
|
||||
|
||||
/* Go to a specific directory */
|
||||
case NANO_GOTO_KEY:
|
||||
case NANO_GOTO_FKEY:
|
||||
case NANO_GOTOLINE_KEY:
|
||||
case NANO_GOTOLINE_FKEY:
|
||||
case 'G': /* Pico compatibility */
|
||||
case 'g':
|
||||
curs_set(1);
|
||||
|
60
src/global.c
60
src/global.c
@ -93,8 +93,6 @@ size_t quotelen; /* strlen(quotestr) */
|
||||
char *backup_dir = NULL; /* Backup directory. */
|
||||
#endif
|
||||
|
||||
bool resetstatuspos; /* Hack for resetting the status bar
|
||||
cursor position */
|
||||
char *answer = NULL; /* Answer str to many questions */
|
||||
int totlines = 0; /* Total number of lines in the file */
|
||||
long totsize = 0; /* Total number of bytes in the file */
|
||||
@ -130,7 +128,7 @@ shortcut *main_list = NULL;
|
||||
shortcut *whereis_list = NULL;
|
||||
shortcut *replace_list = NULL;
|
||||
shortcut *replace_list_2 = NULL; /* 2nd half of replace dialog */
|
||||
shortcut *goto_list = NULL;
|
||||
shortcut *gotoline_list = NULL;
|
||||
shortcut *writefile_list = NULL;
|
||||
shortcut *insertfile_list = NULL;
|
||||
#ifndef DISABLE_HELP
|
||||
@ -277,7 +275,7 @@ void shortcut_init(int unjustify)
|
||||
N_("Uncut from the cutbuffer into the current line");
|
||||
const char *nano_cursorpos_msg = N_("Show the position of the cursor");
|
||||
const char *nano_spell_msg = N_("Invoke the spell checker, if available");
|
||||
const char *nano_goto_msg = N_("Go to a specific line number");
|
||||
const char *nano_gotoline_msg = N_("Go to a specific line number");
|
||||
const char *nano_replace_msg = N_("Replace text within the editor");
|
||||
const char *nano_prevline_msg = N_("Move to the previous line");
|
||||
const char *nano_nextline_msg = N_("Move to the next line");
|
||||
@ -470,8 +468,8 @@ void shortcut_init(int unjustify)
|
||||
#endif
|
||||
nano_disabled_msg);
|
||||
|
||||
sc_init_one(&main_list, NANO_GOTO_KEY, go_to_line_msg,
|
||||
IFHELP(nano_goto_msg, NANO_ALT_GOTO_KEY), NANO_GOTO_FKEY,
|
||||
sc_init_one(&main_list, NANO_GOTOLINE_KEY, go_to_line_msg,
|
||||
IFHELP(nano_gotoline_msg, NANO_GOTOLINE_ALTKEY), NANO_GOTOLINE_FKEY,
|
||||
NANO_NO_KEY, VIEW, do_gotoline_void);
|
||||
|
||||
sc_init_one(&main_list, NANO_REPLACE_KEY, replace_msg,
|
||||
@ -507,7 +505,7 @@ void shortcut_init(int unjustify)
|
||||
NANO_NO_KEY, VIEW, total_refresh);
|
||||
|
||||
sc_init_one(&main_list, NANO_MARK_KEY, N_("Mark Text"),
|
||||
IFHELP(nano_mark_msg, NANO_ALT_MARK_KEY),
|
||||
IFHELP(nano_mark_msg, NANO_MARK_ALTKEY),
|
||||
NANO_NO_KEY, NANO_NO_KEY, NOVIEW,
|
||||
#ifndef NANO_SMALL
|
||||
do_mark
|
||||
@ -615,29 +613,29 @@ void shortcut_init(int unjustify)
|
||||
NANO_NO_KEY, VIEW, do_last_line);
|
||||
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&whereis_list, NANO_OTHERSEARCH_KEY, replace_msg,
|
||||
sc_init_one(&whereis_list, NANO_TOOTHERSEARCH_KEY, replace_msg,
|
||||
IFHELP(nano_replace_msg, NANO_NO_KEY), NANO_REPLACE_FKEY,
|
||||
NANO_NO_KEY, VIEW, do_replace);
|
||||
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&whereis_list, NANO_FROMSEARCHTOGOTO_KEY, go_to_line_msg,
|
||||
IFHELP(nano_goto_msg, NANO_NO_KEY), NANO_GOTO_FKEY,
|
||||
sc_init_one(&whereis_list, NANO_TOGOTOLINE_KEY, go_to_line_msg,
|
||||
IFHELP(nano_gotoline_msg, NANO_NO_KEY), NANO_GOTOLINE_FKEY,
|
||||
NANO_NO_KEY, VIEW, do_gotoline_void);
|
||||
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&whereis_list, NANO_PARABEGIN_KEY, beg_of_par_msg,
|
||||
IFHELP(nano_parabegin_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, do_para_begin);
|
||||
IFHELP(nano_parabegin_msg, NANO_PARABEGIN_ALTKEY1), NANO_NO_KEY,
|
||||
NANO_PARABEGIN_ALTKEY2, VIEW, do_para_begin);
|
||||
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&whereis_list, NANO_PARAEND_KEY, end_of_par_msg,
|
||||
IFHELP(nano_paraend_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, do_para_end);
|
||||
IFHELP(nano_paraend_msg, NANO_PARAEND_ALTKEY1), NANO_NO_KEY,
|
||||
NANO_PARAEND_ALTKEY2, VIEW, do_para_end);
|
||||
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&whereis_list, NANO_FULLJUSTIFY_KEY, fulljstify_msg,
|
||||
IFHELP(nano_fulljustify_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
IFHELP(nano_fulljustify_msg, NANO_FULLJUSTIFY_ALTKEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, NOVIEW, do_full_justify);
|
||||
#endif
|
||||
|
||||
@ -690,12 +688,12 @@ void shortcut_init(int unjustify)
|
||||
NANO_NO_KEY, VIEW, do_last_line);
|
||||
|
||||
/* Translators: try to keep this string under 12 characters long */
|
||||
sc_init_one(&replace_list, NANO_OTHERSEARCH_KEY, N_("No Replace"),
|
||||
sc_init_one(&replace_list, NANO_TOOTHERSEARCH_KEY, N_("No Replace"),
|
||||
IFHELP(nano_whereis_msg, NANO_NO_KEY), NANO_REPLACE_FKEY,
|
||||
NANO_NO_KEY, VIEW, do_search);
|
||||
|
||||
sc_init_one(&replace_list, NANO_FROMSEARCHTOGOTO_KEY, go_to_line_msg,
|
||||
IFHELP(nano_goto_msg, NANO_NO_KEY), NANO_GOTO_FKEY,
|
||||
sc_init_one(&replace_list, NANO_TOGOTOLINE_KEY, go_to_line_msg,
|
||||
IFHELP(nano_gotoline_msg, NANO_NO_KEY), NANO_GOTOLINE_FKEY,
|
||||
NANO_NO_KEY, VIEW, do_gotoline_void);
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
@ -748,9 +746,9 @@ void shortcut_init(int unjustify)
|
||||
NANO_NO_KEY, VIEW, 0);
|
||||
#endif
|
||||
|
||||
free_shortcutage(&goto_list);
|
||||
free_shortcutage(&gotoline_list);
|
||||
|
||||
sc_init_one(&goto_list, NANO_HELP_KEY, get_help_msg,
|
||||
sc_init_one(&gotoline_list, NANO_HELP_KEY, get_help_msg,
|
||||
IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY,
|
||||
NANO_NO_KEY, VIEW,
|
||||
#ifndef DISABLE_HELP
|
||||
@ -760,18 +758,22 @@ void shortcut_init(int unjustify)
|
||||
#endif
|
||||
);
|
||||
|
||||
sc_init_one(&goto_list, NANO_CANCEL_KEY, cancel_msg,
|
||||
sc_init_one(&gotoline_list, NANO_CANCEL_KEY, cancel_msg,
|
||||
IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, 0);
|
||||
|
||||
sc_init_one(&goto_list, NANO_FIRSTLINE_KEY, first_line_msg,
|
||||
sc_init_one(&gotoline_list, NANO_FIRSTLINE_KEY, first_line_msg,
|
||||
IFHELP(nano_firstline_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, do_first_line);
|
||||
|
||||
sc_init_one(&goto_list, NANO_LASTLINE_KEY, last_line_msg,
|
||||
sc_init_one(&gotoline_list, NANO_LASTLINE_KEY, last_line_msg,
|
||||
IFHELP(nano_lastline_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, do_last_line);
|
||||
|
||||
sc_init_one(&gotoline_list, NANO_TOOTHERWHEREIS_KEY, N_("Go To Text"),
|
||||
IFHELP(nano_whereis_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, do_search);
|
||||
|
||||
#ifndef DISABLE_HELP
|
||||
free_shortcutage(&help_list);
|
||||
|
||||
@ -892,7 +894,7 @@ void shortcut_init(int unjustify)
|
||||
* It's useless since inserting files is disabled. */
|
||||
/* Translators: try to keep this string under 22 characters long */
|
||||
if (!ISSET(RESTRICTED))
|
||||
sc_init_one(&insertfile_list, NANO_EXTCMD_KEY, N_("Execute Command"),
|
||||
sc_init_one(&insertfile_list, NANO_TOOTHERINSERT_KEY, N_("Execute Command"),
|
||||
IFHELP(nano_execute_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, NOVIEW, 0);
|
||||
|
||||
@ -942,6 +944,10 @@ void shortcut_init(int unjustify)
|
||||
IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, 0);
|
||||
|
||||
sc_init_one(&extcmd_list, NANO_TOOTHERINSERT_KEY, N_("Insert File"),
|
||||
IFHELP(nano_insert_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, 0);
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
sc_init_one(&extcmd_list, NANO_NO_KEY, new_buffer_msg,
|
||||
IFHELP(nano_multibuffer_msg, TOGGLE_MULTIBUFFER_KEY), NANO_NO_KEY,
|
||||
@ -975,8 +981,8 @@ void shortcut_init(int unjustify)
|
||||
NANO_NO_KEY, VIEW, 0);
|
||||
|
||||
/* 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,
|
||||
sc_init_one(&browser_list, NANO_GOTOLINE_KEY, N_("Go To Dir"),
|
||||
IFHELP(nano_gotodir_msg, NANO_GOTOLINE_ALTKEY), NANO_GOTOLINE_FKEY,
|
||||
NANO_NO_KEY, VIEW, 0);
|
||||
|
||||
free_shortcutage(&gotodir_list);
|
||||
@ -1161,7 +1167,7 @@ void thanks_for_all_the_fish(void)
|
||||
free_shortcutage(&whereis_list);
|
||||
free_shortcutage(&replace_list);
|
||||
free_shortcutage(&replace_list_2);
|
||||
free_shortcutage(&goto_list);
|
||||
free_shortcutage(&gotoline_list);
|
||||
free_shortcutage(&writefile_list);
|
||||
free_shortcutage(&insertfile_list);
|
||||
#ifndef DISABLE_HELP
|
||||
|
16
src/move.c
16
src/move.c
@ -71,7 +71,7 @@ void do_home(void)
|
||||
#ifndef NANO_SMALL
|
||||
}
|
||||
#endif
|
||||
check_statblank();
|
||||
check_statusblank();
|
||||
if (need_horizontal_update(old_pww))
|
||||
update_line(current, current_x);
|
||||
}
|
||||
@ -81,7 +81,7 @@ void do_end(void)
|
||||
size_t old_pww = placewewant;
|
||||
current_x = strlen(current->data);
|
||||
placewewant = xplustabs();
|
||||
check_statblank();
|
||||
check_statusblank();
|
||||
if (need_horizontal_update(old_pww))
|
||||
update_line(current, current_x);
|
||||
}
|
||||
@ -129,7 +129,7 @@ void do_page_up(void)
|
||||
/* Update all the lines that need to be updated. */
|
||||
edit_redraw(old_current, old_pww);
|
||||
|
||||
check_statblank();
|
||||
check_statusblank();
|
||||
}
|
||||
|
||||
void do_page_down(void)
|
||||
@ -176,7 +176,7 @@ void do_page_down(void)
|
||||
/* Update all the lines that need to be updated. */
|
||||
edit_redraw(old_current, old_pww);
|
||||
|
||||
check_statblank();
|
||||
check_statusblank();
|
||||
}
|
||||
|
||||
void do_up(void)
|
||||
@ -184,7 +184,7 @@ void do_up(void)
|
||||
#ifndef DISABLE_WRAPPING
|
||||
wrap_reset();
|
||||
#endif
|
||||
check_statblank();
|
||||
check_statusblank();
|
||||
|
||||
if (current->prev == NULL)
|
||||
return;
|
||||
@ -217,7 +217,7 @@ void do_down(void)
|
||||
#ifndef DISABLE_WRAPPING
|
||||
wrap_reset();
|
||||
#endif
|
||||
check_statblank();
|
||||
check_statusblank();
|
||||
|
||||
if (current->next == NULL)
|
||||
return;
|
||||
@ -255,7 +255,7 @@ void do_left(int allow_update)
|
||||
current_x = strlen(current->data);
|
||||
}
|
||||
placewewant = xplustabs();
|
||||
check_statblank();
|
||||
check_statusblank();
|
||||
if (allow_update && need_horizontal_update(old_pww))
|
||||
update_line(current, current_x);
|
||||
}
|
||||
@ -277,7 +277,7 @@ void do_right(int allow_update)
|
||||
current_x = 0;
|
||||
}
|
||||
placewewant = xplustabs();
|
||||
check_statblank();
|
||||
check_statusblank();
|
||||
if (allow_update && need_horizontal_update(old_pww))
|
||||
update_line(current, current_x);
|
||||
}
|
||||
|
@ -287,7 +287,7 @@ void help_init(void)
|
||||
"the Search: prompt. Hitting Enter without entering any text "
|
||||
"will perform the previous search.\n\n The following function "
|
||||
"keys are available in Search mode:\n\n");
|
||||
else if (currshortcut == goto_list)
|
||||
else if (currshortcut == gotoline_list)
|
||||
htx = N_("Go To Line Help Text\n\n "
|
||||
"Enter the line number that you wish to go to and hit "
|
||||
"Enter. If there are fewer lines of text than the "
|
||||
|
21
src/nano.h
21
src/nano.h
@ -380,24 +380,28 @@ typedef struct historyheadtype {
|
||||
/* Normal keys. */
|
||||
#define NANO_XON_KEY NANO_CONTROL_Q
|
||||
#define NANO_XOFF_KEY NANO_CONTROL_S
|
||||
#define NANO_INSERTFILE_KEY NANO_CONTROL_R
|
||||
#define NANO_INSERTFILE_FKEY KEY_F(5)
|
||||
#define NANO_CANCEL_KEY NANO_CONTROL_C
|
||||
#define NANO_EXIT_KEY NANO_CONTROL_X
|
||||
#define NANO_EXIT_FKEY KEY_F(2)
|
||||
#define NANO_INSERTFILE_KEY NANO_CONTROL_R
|
||||
#define NANO_INSERTFILE_FKEY KEY_F(5)
|
||||
#define NANO_TOOTHERINSERT_KEY NANO_CONTROL_X
|
||||
#define NANO_WRITEOUT_KEY NANO_CONTROL_O
|
||||
#define NANO_WRITEOUT_FKEY KEY_F(3)
|
||||
#define NANO_GOTO_KEY NANO_CONTROL_7
|
||||
#define NANO_GOTO_FKEY KEY_F(13)
|
||||
#define NANO_ALT_GOTO_KEY NANO_ALT_G
|
||||
#define NANO_GOTOLINE_KEY NANO_CONTROL_7
|
||||
#define NANO_GOTOLINE_FKEY KEY_F(13)
|
||||
#define NANO_GOTOLINE_ALTKEY NANO_ALT_G
|
||||
#define NANO_TOGOTOLINE_KEY NANO_CONTROL_T
|
||||
#define NANO_HELP_KEY NANO_CONTROL_G
|
||||
#define NANO_HELP_FKEY KEY_F(1)
|
||||
#define NANO_WHEREIS_KEY NANO_CONTROL_W
|
||||
#define NANO_WHEREIS_FKEY KEY_F(6)
|
||||
#define NANO_WHEREIS_NEXT_KEY NANO_ALT_W
|
||||
#define NANO_TOOTHERWHEREIS_KEY NANO_CONTROL_T
|
||||
#define NANO_REPLACE_KEY NANO_CONTROL_4
|
||||
#define NANO_REPLACE_FKEY KEY_F(14)
|
||||
#define NANO_ALT_REPLACE_KEY NANO_ALT_R
|
||||
#define NANO_OTHERSEARCH_KEY NANO_CONTROL_R
|
||||
#define NANO_TOOTHERSEARCH_KEY NANO_CONTROL_R
|
||||
#define NANO_PREVPAGE_KEY NANO_CONTROL_Y
|
||||
#define NANO_PREVPAGE_FKEY KEY_F(7)
|
||||
#define NANO_NEXTPAGE_KEY NANO_CONTROL_V
|
||||
@ -414,7 +418,6 @@ typedef struct historyheadtype {
|
||||
#define NANO_FIRSTLINE_FKEY NANO_PREVPAGE_FKEY
|
||||
#define NANO_LASTLINE_KEY NANO_NEXTPAGE_KEY
|
||||
#define NANO_LASTLINE_FKEY NANO_NEXTPAGE_FKEY
|
||||
#define NANO_CANCEL_KEY NANO_CONTROL_C
|
||||
#define NANO_REFRESH_KEY NANO_CONTROL_L
|
||||
#define NANO_JUSTIFY_KEY NANO_CONTROL_J
|
||||
#define NANO_JUSTIFY_FKEY KEY_F(4)
|
||||
@ -425,7 +428,7 @@ typedef struct historyheadtype {
|
||||
#define NANO_FORWARD_KEY NANO_CONTROL_F
|
||||
#define NANO_BACK_KEY NANO_CONTROL_B
|
||||
#define NANO_MARK_KEY NANO_CONTROL_6
|
||||
#define NANO_ALT_MARK_KEY NANO_ALT_A
|
||||
#define NANO_MARK_ALTKEY NANO_ALT_A
|
||||
#define NANO_HOME_KEY NANO_CONTROL_A
|
||||
#define NANO_END_KEY NANO_CONTROL_E
|
||||
#define NANO_DELETE_KEY NANO_CONTROL_D
|
||||
@ -433,7 +436,6 @@ typedef struct historyheadtype {
|
||||
#define NANO_TAB_KEY NANO_CONTROL_I
|
||||
#define NANO_SUSPEND_KEY NANO_CONTROL_Z
|
||||
#define NANO_ENTER_KEY NANO_CONTROL_M
|
||||
#define NANO_FROMSEARCHTOGOTO_KEY NANO_CONTROL_T
|
||||
#define NANO_TOFILES_KEY NANO_CONTROL_T
|
||||
#define NANO_APPEND_KEY NANO_ALT_A
|
||||
#define NANO_PREPEND_KEY NANO_ALT_P
|
||||
@ -442,7 +444,6 @@ typedef struct historyheadtype {
|
||||
#define NANO_OPENPREV_ALTKEY NANO_ALT_COMMA
|
||||
#define NANO_OPENNEXT_ALTKEY NANO_ALT_PERIOD
|
||||
#define NANO_BRACKET_KEY NANO_ALT_RBRACKET
|
||||
#define NANO_EXTCMD_KEY NANO_CONTROL_X
|
||||
#define NANO_NEXTWORD_KEY NANO_CONTROL_SPACE
|
||||
#define NANO_PREVWORD_KEY NANO_ALT_SPACE
|
||||
#define NANO_PARABEGIN_KEY NANO_CONTROL_W
|
||||
|
@ -102,7 +102,7 @@ extern char *syntaxstr;
|
||||
|
||||
extern shortcut *shortcut_list;
|
||||
extern shortcut *main_list, *whereis_list;
|
||||
extern shortcut *replace_list, *goto_list;
|
||||
extern shortcut *replace_list, *gotoline_list;
|
||||
extern shortcut *writefile_list, *insertfile_list;
|
||||
extern shortcut *replace_list_2;
|
||||
#ifndef NANO_SMALL
|
||||
@ -541,7 +541,7 @@ size_t strlenpt(const char *buf);
|
||||
void blank_titlebar(void);
|
||||
void blank_edit(void);
|
||||
void blank_statusbar(void);
|
||||
void check_statblank(void);
|
||||
void check_statusblank(void);
|
||||
void blank_bottombars(void);
|
||||
char *display_string(const char *buf, size_t start_col, size_t len);
|
||||
void nanoget_repaint(const char *buf, const char *inputbuf, size_t x);
|
||||
|
17
src/search.c
17
src/search.c
@ -231,10 +231,10 @@ int search_init(bool replacing)
|
||||
return 1;
|
||||
#endif
|
||||
#endif /* !NANO_SMALL */
|
||||
case NANO_OTHERSEARCH_KEY:
|
||||
case NANO_TOOTHERSEARCH_KEY:
|
||||
backupstring = mallocstrcpy(backupstring, answer);
|
||||
return -2; /* Call the opposite search function. */
|
||||
case NANO_FROMSEARCHTOGOTO_KEY:
|
||||
case NANO_TOGOTOLINE_KEY:
|
||||
#ifndef NANO_SMALL
|
||||
search_history.current = search_history.next;
|
||||
#endif
|
||||
@ -385,6 +385,7 @@ void do_search(void)
|
||||
#ifndef DISABLE_WRAPPING
|
||||
wrap_reset();
|
||||
#endif
|
||||
|
||||
i = search_init(FALSE);
|
||||
if (i == -1) /* Cancel, Go to Line, blank search string, or
|
||||
* regcomp() failed. */
|
||||
@ -858,7 +859,7 @@ void do_gotoline(int line, bool save_pos)
|
||||
{
|
||||
if (line <= 0) { /* Ask for it. */
|
||||
char *ans = mallocstrcpy(NULL, answer);
|
||||
int st = statusq(FALSE, goto_list, line < 0 ? ans : "",
|
||||
int i = statusq(FALSE, gotoline_list, line < 0 ? ans : "",
|
||||
#ifndef NANO_SMALL
|
||||
NULL,
|
||||
#endif
|
||||
@ -867,9 +868,15 @@ void do_gotoline(int line, bool save_pos)
|
||||
free(ans);
|
||||
|
||||
/* Cancel, or Enter with blank string. */
|
||||
if (st == -1 || st == -2)
|
||||
if (i == -1 || i == -2)
|
||||
statusbar(_("Cancelled"));
|
||||
if (st != 0) {
|
||||
|
||||
if (i == NANO_TOOTHERWHEREIS_KEY) {
|
||||
do_search();
|
||||
return;
|
||||
}
|
||||
|
||||
if (i != 0) {
|
||||
display_main_list();
|
||||
return;
|
||||
}
|
||||
|
38
src/winio.c
38
src/winio.c
@ -30,9 +30,12 @@
|
||||
#include "proto.h"
|
||||
#include "nano.h"
|
||||
|
||||
static int statblank = 0; /* Number of keystrokes left after
|
||||
we call statusbar(), before we
|
||||
actually blank the statusbar */
|
||||
static int statusblank = 0; /* Number of keystrokes left after
|
||||
* we call statusbar(), before we
|
||||
* actually blank the statusbar. */
|
||||
static bool resetstatuspos = FALSE;
|
||||
/* Should we reset the statusbar cursor
|
||||
* position? */
|
||||
|
||||
/* Control character compatibility:
|
||||
*
|
||||
@ -1628,12 +1631,12 @@ void blank_statusbar(void)
|
||||
mvwaddstr(bottomwin, 0, 0, hblank);
|
||||
}
|
||||
|
||||
void check_statblank(void)
|
||||
void check_statusblank(void)
|
||||
{
|
||||
if (statblank > 1)
|
||||
statblank--;
|
||||
else if (statblank == 1 && !ISSET(CONSTUPDATE)) {
|
||||
statblank = 0;
|
||||
if (statusblank > 1)
|
||||
statusblank--;
|
||||
else if (statusblank == 1 && !ISSET(CONSTUPDATE)) {
|
||||
statusblank = 0;
|
||||
blank_statusbar();
|
||||
wnoutrefresh(bottomwin);
|
||||
reset_cursor();
|
||||
@ -1824,7 +1827,7 @@ int nanogetstr(int allowtabs, const char *buf, const char *def,
|
||||
* disable all keys that would change the text if the filename isn't
|
||||
* blank and we're at the "Write File" prompt. */
|
||||
while ((kbinput = get_kbinput(bottomwin, &meta_key, &func_key)) !=
|
||||
NANO_ENTER_KEY) {
|
||||
NANO_CANCEL_KEY && kbinput != NANO_ENTER_KEY) {
|
||||
for (t = s; t != NULL; t = t->next) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Aha! \'%c\' (%d)\n", kbinput, kbinput);
|
||||
@ -2086,11 +2089,7 @@ int nanogetstr(int allowtabs, const char *buf, const char *def,
|
||||
/* We finished putting in an answer; reset x */
|
||||
x = -1;
|
||||
|
||||
/* Just check for a blank answer here */
|
||||
if (answer[0] == '\0')
|
||||
return -2;
|
||||
else
|
||||
return 0;
|
||||
return kbinput;
|
||||
}
|
||||
|
||||
void titlebar(const char *path)
|
||||
@ -2295,7 +2294,7 @@ void statusbar(const char *msg, ...)
|
||||
}
|
||||
|
||||
SET(DISABLE_CURPOS);
|
||||
statblank = 26;
|
||||
statusblank = 26;
|
||||
}
|
||||
|
||||
void bottombars(const shortcut *s)
|
||||
@ -3026,14 +3025,19 @@ int statusq(int allowtabs, const shortcut *s, const char *def,
|
||||
break;
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
case NANO_PARABEGIN_KEY:
|
||||
case NANO_PARABEGIN_ALTKEY1:
|
||||
case NANO_PARABEGIN_ALTKEY2:
|
||||
do_para_begin();
|
||||
resetstatuspos = TRUE;
|
||||
break;
|
||||
case NANO_PARAEND_KEY:
|
||||
case NANO_PARAEND_ALTKEY1:
|
||||
case NANO_PARAEND_ALTKEY2:
|
||||
do_para_end();
|
||||
resetstatuspos = TRUE;
|
||||
break;
|
||||
case NANO_FULLJUSTIFY_KEY:
|
||||
case NANO_FULLJUSTIFY_ALTKEY:
|
||||
if (!ISSET(VIEW_MODE))
|
||||
do_full_justify();
|
||||
resetstatuspos = TRUE;
|
||||
@ -3043,6 +3047,10 @@ int statusq(int allowtabs, const shortcut *s, const char *def,
|
||||
ret = -1;
|
||||
resetstatuspos = TRUE;
|
||||
break;
|
||||
case NANO_ENTER_KEY:
|
||||
ret = (answer[0] == '\0') ? -2 : 0;
|
||||
resetstatuspos = TRUE;
|
||||
break;
|
||||
}
|
||||
blank_statusbar();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user