only allow saving/loading/piping in normal mode
This commit is contained in:
parent
45aa9bd63c
commit
3bc43448fc
@ -277,6 +277,37 @@ static int global_input(const int c) {
|
|||||||
++current_page;
|
++current_page;
|
||||||
window_change |= CH_RESULT;
|
window_change |= CH_RESULT;
|
||||||
break;
|
break;
|
||||||
|
case '!': /* shell escape */
|
||||||
|
execute(shell, shell, NULL);
|
||||||
|
current_page = 0;
|
||||||
|
break;
|
||||||
|
case ctrl('U'): /* redraw screen */
|
||||||
|
case KEY_CLEAR:
|
||||||
|
window_change = CH_ALL;
|
||||||
|
break;
|
||||||
|
case '?': /* help */
|
||||||
|
window_change = CH_HELP;
|
||||||
|
break;
|
||||||
|
case ctrl('E'): /* edit all lines */
|
||||||
|
editall();
|
||||||
|
break;
|
||||||
|
case ctrl('S'): // toggle caseless
|
||||||
|
caseless = !caseless;
|
||||||
|
egrepcaseless(caseless);
|
||||||
|
window_change |= CH_CASE;
|
||||||
|
break;
|
||||||
|
case EOF:
|
||||||
|
myexit(0);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int normal_global_input(const int c) {
|
||||||
|
switch(c) {
|
||||||
case '>': /* write or append the lines to a file */
|
case '>': /* write or append the lines to a file */
|
||||||
if (totallines == 0) {
|
if (totallines == 0) {
|
||||||
postmsg("There are no lines to write to a file");
|
postmsg("There are no lines to write to a file");
|
||||||
@ -296,7 +327,7 @@ static int global_input(const int c) {
|
|||||||
break; // XXX fix
|
break; // XXX fix
|
||||||
if(totallines == 0) {
|
if(totallines == 0) {
|
||||||
postmsg("There are no lines to pipe to a shell command");
|
postmsg("There are no lines to pipe to a shell command");
|
||||||
return 0;
|
break;
|
||||||
}
|
}
|
||||||
/* get the shell command */
|
/* get the shell command */
|
||||||
// move(PRLINE, 0);
|
// move(PRLINE, 0);
|
||||||
@ -335,28 +366,6 @@ static int global_input(const int c) {
|
|||||||
// askforreturn();
|
// askforreturn();
|
||||||
// entercurses();
|
// entercurses();
|
||||||
break;
|
break;
|
||||||
case '!': /* shell escape */
|
|
||||||
execute(shell, shell, NULL);
|
|
||||||
current_page = 0;
|
|
||||||
break;
|
|
||||||
case ctrl('U'): /* redraw screen */
|
|
||||||
case KEY_CLEAR:
|
|
||||||
window_change = CH_ALL;
|
|
||||||
break;
|
|
||||||
case '?': /* help */
|
|
||||||
window_change = CH_HELP;
|
|
||||||
break;
|
|
||||||
case ctrl('E'): /* edit all lines */
|
|
||||||
editall();
|
|
||||||
break;
|
|
||||||
case ctrl('S'): // toggle caseless
|
|
||||||
caseless = !caseless;
|
|
||||||
egrepcaseless(caseless);
|
|
||||||
window_change |= CH_CASE;
|
|
||||||
break;
|
|
||||||
case EOF:
|
|
||||||
myexit(0);
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -534,6 +543,9 @@ int handle_input(const int c) {
|
|||||||
/* --- mode specific --- */
|
/* --- mode specific --- */
|
||||||
switch(input_mode) {
|
switch(input_mode) {
|
||||||
case INPUT_NORMAL:
|
case INPUT_NORMAL:
|
||||||
|
const int r = normal_global_input(c);
|
||||||
|
if(r) { return 0; }
|
||||||
|
//
|
||||||
if(*current_window == winput) {
|
if(*current_window == winput) {
|
||||||
return interpret(c);
|
return interpret(c);
|
||||||
} else if(*current_window == wmode) {
|
} else if(*current_window == wmode) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user