keym.c (most-5.0.0a) | : | keym.c (most-5.1.0) | ||
---|---|---|---|---|
/* | /* | |||
This file is part of MOST. | This file is part of MOST. | |||
Copyright (c) 1991, 1999, 2002, 2005, 2006, 2007 John E. Davis | Copyright (c) 1991, 1999, 2002, 2005-2018, 2019 John E. Davis | |||
This program is free software; you can redistribute it and/or modify it | This program is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the Free | under the terms of the GNU General Public License as published by the Free | |||
Software Foundation; either version 2 of the License, or (at your option) | Software Foundation; either version 2 of the License, or (at your option) | |||
any later version. | any later version. | |||
This program is distributed in the hope that it will be useful, but WITHOUT | This program is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |||
more details. | more details. | |||
skipping to change at line 119 | skipping to change at line 119 | |||
most_update_windows(Most_C_Line - n); | most_update_windows(Most_C_Line - n); | |||
} | } | |||
static void tail_mode_cmd (void) | static void tail_mode_cmd (void) | |||
{ | { | |||
Most_Tail_Mode = 1; | Most_Tail_Mode = 1; | |||
do | do | |||
{ | { | |||
if (0 != most_read_file_dsc (-1)) | if (0 != most_read_file_dsc (-1, 1)) | |||
most_update_windows (-1); | most_update_windows (-1); | |||
most_message ("Most Tail Mode-- MOST keys are still active.", 0); | most_message ("Most Tail Mode-- MOST keys are still active.", 0); | |||
most_put_message (); | most_put_message (); | |||
most_point_cursor (); | most_point_cursor (); | |||
SLsmg_refresh (); | SLsmg_refresh (); | |||
} | } | |||
while (0 == SLang_input_pending (15)); | while (0 == SLang_input_pending (15)); | |||
Most_Tail_Mode = 0; | Most_Tail_Mode = 0; | |||
} | } | |||
static void top_of_buffer_cmd(void) | static void top_of_buffer_cmd(void) | |||
{ | { | |||
most_update_windows(1); | most_update_windows(1); | |||
} | } | |||
static void end_of_buffer_cmd(void) | static void end_of_buffer_cmd(void) | |||
{ | { | |||
unsigned int count = 0; | ||||
/* This will loop forever if the file is changing too fast. */ | ||||
while ((Most_Buf->fd != -1) | while ((Most_Buf->fd != -1) | |||
&& (0 != most_read_file_dsc(-1))) | && (count < 5) | |||
; | && (0 != most_read_file_dsc(-1, 1))) | |||
count++; | ||||
most_update_windows (-1); | most_update_windows (-1); | |||
Most_Curs_Offset = (Most_Eob - Most_Beg); | ||||
} | } | |||
#ifdef unix | #ifdef unix | |||
# include <signal.h> | # include <signal.h> | |||
#endif | #endif | |||
static void sys_spawn_cmd(void) | static void sys_spawn_cmd(void) | |||
{ | { | |||
#ifdef IBMPC_SYSTEM | #ifdef IBMPC_SYSTEM | |||
most_message ("Not implemented.", 1); | most_message ("Not implemented.", 1); | |||
#else | #else | |||
int update = 0; | int update = 0; | |||
skipping to change at line 243 | skipping to change at line 247 | |||
MOST_INT n; | MOST_INT n; | |||
if (Most_Digit_Arg != NULL) n = *Most_Digit_Arg; | if (Most_Digit_Arg != NULL) n = *Most_Digit_Arg; | |||
else | else | |||
{ | { | |||
if (-1 == read_integer ("Goto Percent: ", &n)) | if (-1 == read_integer ("Goto Percent: ", &n)) | |||
return; | return; | |||
} | } | |||
if (n < 0) n = 0; else if (n > 100) n = 100; | if (n < 0) n = 0; else if (n > 100) n = 100; | |||
if (Most_Buf->fd != -1) most_read_file_dsc(-1); | if (Most_Buf->fd != -1) most_read_file_dsc(-1, 1); | |||
pos = Most_Beg + (n * (Most_Eob - Most_Beg))/100; | pos = Most_Beg + (n * (Most_Eob - Most_Beg))/100; | |||
n = most_what_line(pos); | n = most_what_line(pos); | |||
most_update_windows (n); | most_update_windows (n); | |||
} | } | |||
static void set_mark_cmd(void) | static void set_mark_cmd(void) | |||
{ | { | |||
Most_Buf->mark = Most_C_Line; | Most_Buf->mark = Most_C_Line; | |||
most_message("Mark Set.",0); | most_message("Mark Set.",0); | |||
} | } | |||
skipping to change at line 328 | skipping to change at line 332 | |||
Most_Search_Dir = dir; | Most_Search_Dir = dir; | |||
if (*buf) | if (*buf) | |||
strcpy (Most_Search_Str, buf); /* no buffer overflow here */ | strcpy (Most_Search_Str, buf); /* no buffer overflow here */ | |||
Most_Curs_Offset = Most_C_Offset; | Most_Curs_Offset = Most_C_Offset; | |||
find_next_cmd (); | find_next_cmd (); | |||
} | } | |||
static void search_cmd(void) | static void search_cmd(void) | |||
{ | { | |||
search_cmd_dir ( | char *prompt = "Regexp-Search: "; | |||
#ifdef SLANG_REGEXP | if (Most_Do_Regexp_Search == 0) | |||
"Regexp Search: ", | prompt += 7; | |||
#else | search_cmd_dir (prompt,1); | |||
"Search: ", | ||||
#endif | ||||
1); | ||||
} | } | |||
static void search_back_cmd(void) | static void search_back_cmd(void) | |||
{ | { | |||
search_cmd_dir ( | char *prompt = "Regexp-Search Backwards: "; | |||
#ifdef SLANG_REGEXP | if (Most_Do_Regexp_Search == 0) | |||
"Regexp Search Backwards: ", | prompt += 7; | |||
#else | search_cmd_dir (prompt, -1); | |||
"Search Backwards: ", | ||||
#endif | ||||
-1); | ||||
} | } | |||
static void help_cmd(void) | static void help_cmd(void) | |||
{ | { | |||
most_do_help_command(); | most_do_help_command(); | |||
} | } | |||
static void find_file_cmd(void) | static void find_file_cmd(void) | |||
{ | { | |||
most_user_get_file(); | most_user_get_file(); | |||
skipping to change at line 594 | skipping to change at line 592 | |||
SLkm_define_key ("\033[1~", (FVOID_STAR) search_cmd, Most_Keymap); | SLkm_define_key ("\033[1~", (FVOID_STAR) search_cmd, Most_Keymap); | |||
SLkm_define_key ("\033[2~", (FVOID_STAR) goto_mark_cmd, Most_Keymap); | SLkm_define_key ("\033[2~", (FVOID_STAR) goto_mark_cmd, Most_Keymap); | |||
SLkm_define_key ("\033[28~", (FVOID_STAR) help_cmd, Most_Keymap); | SLkm_define_key ("\033[28~", (FVOID_STAR) help_cmd, Most_Keymap); | |||
SLkm_define_key ("\033[4~", (FVOID_STAR) set_mark_cmd, Most_Keymap); | SLkm_define_key ("\033[4~", (FVOID_STAR) set_mark_cmd, Most_Keymap); | |||
SLkm_define_key ("\033[5~", (FVOID_STAR) page_up_cmd , Most_Keymap); | SLkm_define_key ("\033[5~", (FVOID_STAR) page_up_cmd , Most_Keymap); | |||
SLkm_define_key ("\033[6~", (FVOID_STAR) page_down_cmd, Most_Keymap); | SLkm_define_key ("\033[6~", (FVOID_STAR) page_down_cmd, Most_Keymap); | |||
SLkm_define_key ("\033[A", (FVOID_STAR) previous_line_cmd, Most_Keymap); | SLkm_define_key ("\033[A", (FVOID_STAR) previous_line_cmd, Most_Keymap); | |||
SLkm_define_key ("\033[B", (FVOID_STAR) next_line_cmd, Most_Keymap); | SLkm_define_key ("\033[B", (FVOID_STAR) next_line_cmd, Most_Keymap); | |||
SLkm_define_key ("\033[C", (FVOID_STAR) column_right_cmd, Most_Keymap); | SLkm_define_key ("\033[C", (FVOID_STAR) column_right_cmd, Most_Keymap); | |||
SLkm_define_key ("\033[D", (FVOID_STAR) column_left_cmd, Most_Keymap); | SLkm_define_key ("\033[D", (FVOID_STAR) column_left_cmd, Most_Keymap); | |||
SLkm_define_key ("\033[7~", (FVOID_STAR) top_of_buffer_cmd, Most_Keymap); | ||||
SLkm_define_key ("\033[8~", (FVOID_STAR) end_of_buffer_cmd, Most_Keymap); | ||||
SLkm_define_key ("^@", (FVOID_STAR) set_mark_cmd, Most_Keymap); | SLkm_define_key ("^@", (FVOID_STAR) set_mark_cmd, Most_Keymap); | |||
#else | #else | |||
SLkm_define_key ("^@H", (FVOID_STAR) previous_line_cmd, Most_Keymap); | SLkm_define_key ("^@H", (FVOID_STAR) previous_line_cmd, Most_Keymap); | |||
SLkm_define_key ("^@P", (FVOID_STAR) next_line_cmd, Most_Keymap); | SLkm_define_key ("^@P", (FVOID_STAR) next_line_cmd, Most_Keymap); | |||
SLkm_define_key ("^@M", (FVOID_STAR) column_right_cmd, Most_Keymap); | SLkm_define_key ("^@M", (FVOID_STAR) column_right_cmd, Most_Keymap); | |||
SLkm_define_key ("^@K", (FVOID_STAR) column_left_cmd, Most_Keymap); | SLkm_define_key ("^@K", (FVOID_STAR) column_left_cmd, Most_Keymap); | |||
SLkm_define_key ("^@Q", (FVOID_STAR) page_down_cmd, Most_Keymap); | SLkm_define_key ("^@Q", (FVOID_STAR) page_down_cmd, Most_Keymap); | |||
SLkm_define_key ("^@I", (FVOID_STAR) page_up_cmd, Most_Keymap); | SLkm_define_key ("^@I", (FVOID_STAR) page_up_cmd, Most_Keymap); | |||
SLkm_define_key ("^@G", (FVOID_STAR) top_of_buffer_cmd, Most_Keymap); | SLkm_define_key ("^@G", (FVOID_STAR) top_of_buffer_cmd, Most_Keymap); | |||
SLkm_define_key ("^@O", (FVOID_STAR) end_of_buffer_cmd, Most_Keymap); | SLkm_define_key ("^@O", (FVOID_STAR) end_of_buffer_cmd, Most_Keymap); | |||
End of changes. 9 change blocks. | ||||
19 lines changed or deleted | 19 lines changed or added |