📄 switches.c
字号:
show_status_line_2 ("Consider Case [Y/N]", 0, -1, 0);
key_2 = get_1_key (1);
set.c_case = (toupper (key_2) == 'Y');
break;
case 'D':
show_status_line_2 ("Display Macro Execution [Y/N]",
0, -1, 0);
key_2 = get_1_key (1);
set.display = (toupper (key_2) == 'Y');
break;
#if (WITH_E_DELIMIT)
case 'E':
do_it = get_line_2_string ("Delimiter Set:",
fc->e_delimit, C_R, ID_DELI);
if (do_it)
{
normalize_delims ();
perform_view ();
}
break;
#endif
case 'F':
sprintf (str_numb, "%d", set.file_num);
do_it = get_line_2_string ("File number:",
str_numb, C_R, ID_NUMB);
if (do_it)
{
if ((sscanf (str_numb, "%d", &help_int)) == 1)
{
set.file_num = help_int;
set.file_num = max (1, /* minimum 1 file !! */
min (MAX_FC_NUM, set.file_num));
}
else
{
err_message (INVALID_INPUT_VALUE);
}
}
break;
case 'H':
show_status_line_2 ("Display Highbit Characters as is [Y/N/A]",
0, -1, 0);
key_2 = get_1_key (1);
/* default */ set.highbit_global = 0; /* No */
if (toupper(key_2) == 'Y') set.highbit_global = 1; /* Yes */
if (toupper(key_2) == 'A') set.highbit_global = 2; /* Auto */
set_highbit();
#if 0
update_entire_window (fc->top_left);
perform_update (fc->buff_0, fc->byte_anz,
fc->left_col);
#else
perform_view ();
#endif
break;
case 'I':
show_status_line_2 ("Auto indent during insert [Y/N]",
0, -1, 0);
key_2 = get_1_key (1);
set.indent = (toupper (key_2) == 'Y');
break;
case 'K':
show_status_line_2 ("Find only token strings [Y/N]",
0, -1, 0);
key_2 = get_1_key (1);
set.k_token = (toupper (key_2) == 'Y');
break;
case 'L':
sprintf (str_numb, "%d", fc->left_col);
do_it = get_line_2_string ("Left column:",
str_numb, C_R, ID_NUMB);
if (do_it)
{
if ((sscanf (str_numb, "%d", &help_int)) == 1)
{
if ((*str_numb == '+') ||
(*str_numb == '-'))
fc->left_col += help_int;
else
fc->left_col = help_int;
}
else
{
err_message (INVALID_INPUT_VALUE);
}
}
fc->left_col = max (0, fc->left_col);
update_entire_window (fc->top_left);
break;
case 'M':
sprintf (str_numb, "%d, %d, %d", set.margin[0],
set.margin[1],
set.margin[2] );
do_it = get_line_2_string ("Margin (Indent, Left, Right):",
str_numb, C_R, ID_MARG);
if (do_it)
{
help_int = set.margin[0];
help_int2 = set.margin[1];
help_int3 = set.margin[2];
num = sscanf (str_numb, "%d %c %d %c %d",
&help_int,
&komma,
&help_int2,
&komma,
&help_int3 );
if ((num < 1) ||
(help_int3 <= help_int) ||
(help_int3 <= help_int2))
{
err_message (INVALID_INPUT_VALUE);
}
else
{
set.margin[0] = help_int;
if (num >= 2) set.margin[1] = help_int2;
if (num >= 3) set.margin[2] = help_int3;
}
}
break;
case 'N':
show_status_line_2 ("Insert blanks for tabs [Y/N]",
0, -1, 0);
key_2 = get_1_key (1);
set.notab = (toupper (key_2) == 'Y');
break;
case 'O':
show_status_line_2 ("set file to view Only [Y/N]",
0, -1, 0);
key_2 = get_1_key (1);
fc->view_only = (toupper (key_2) == 'Y');
break;
case 'R':
show_status_line_2
("Radix : Alpha Binary Decimal Hex Octal", 0, -1, 0);
key_2 = toupper (get_1_key (1));
switch (key_2)
{
case 'A':
case 'B':
case 'D':
case 'H':
case 'O':
set.radix = key_2;
break;
default:
err_message (INVALID_RADIX);
break;
}
break;
case 'S':
show_status_line_2 ("Show Find: [Y/N]", 0, -1, 0);
key_2 = get_1_key (1);
set.showfind = (toupper (key_2) == 'Y');
break;
case 'T':
sprintf (str_numb, "%d", set.tabs);
do_it = get_line_2_string ("Tabs:",
str_numb, C_R, ID_NUMB);
if (do_it)
{
if ((sscanf (str_numb, "%d", &help_int)) == 1)
{
set.tabs = help_int;
set.tabs = max (1, min (COLUMNS, set.tabs));
update_entire_window (fc->top_left);
check_dirty_cursor ();
}
else
{
err_message (INVALID_INPUT_VALUE);
}
}
break;
case 'V':
sprintf (str_numb, "%d", (set.viewrow + LINE_OFFSET));
do_it = get_line_2_string ("View row:",
str_numb, C_R, ID_NUMB);
if (do_it)
{
if ((sscanf (str_numb, "%d", &help_int)) == 1)
{
set.viewrow = help_int - LINE_OFFSET;
set.viewrow = max (0, min (MAX_ROW, set.viewrow));
perform_view ();
}
else
{
err_message (INVALID_INPUT_VALUE);
}
}
break;
case 'W':
show_status_line_2 ("Warning beep level: [0-2]", 0, -1, 0);
key_2 = get_1_key (1);
set.warning = key_2 - '0';
set.warning = max (0, min (2, set.warning));
break;
case 'Y':
#if (WITH_SYNTAX_HIGHLIGHTING)
sprintf (str_numb, "%d,%d", fc->syntax_flag,
fc->file_type);
do_it = get_line_2_string ("sYntax highlighting: [0-7,filetype]",
str_numb, C_R, ID_MARG);
if (do_it)
{
help_int = fc->syntax_flag;
help_int2 = fc->file_type;
num = sscanf (str_numb, "%d %c %d", &help_int,
&komma,
&help_int2 );
if (num < 1)
{
err_message (INVALID_INPUT_VALUE);
}
else
{
fc->syntax_flag = help_int;
if (num >= 2) fc->file_type = help_int2;
}
}
fc->syntax_flag &= 0x07;
fc->e_delimit = get_hi_light_delimiters(fc->file_type);
update_entire_window (fc->top_left);
#else
err_message (NOT_IMPLEMENTED);
#endif
break;
case '*':
show_status_line_2 ("Search with Wildcards (?*): [Y/N]",
0, -1, 0);
key_2 = get_1_key (1);
set.wildcards = (toupper (key_2) == 'Y');
break;
case '~':
show_status_line_2 ("Replace \'~\' with HOME DIR: [Y/N]",
0, -1, 0);
key_2 = get_1_key (1);
set.tilde_home = (toupper (key_2) == 'Y');
break;
case 0x1b: /* <esc> */
case 0x03: /* ^C */
break; /* do nothing */
default:
err_message (ILLEGAL_COMMAND);
break;
}
break;
case 'F': /* Find */
case '-': /* -find */
line_2_flag = 1;
if (repeat_count == 0)
{
if (key_0 == '-')
do_it = get_line_2_string ("-Find:", str_find,
-1, ID_FIND);
else
do_it = get_line_2_string ("Find:" , str_find,
-1, ID_FIND);
if (!do_it)
{
end_of_edit = -1;
break;
}
}
BREAK_IF_REPEAT_0
if ((repeat_count == 0) || (repeat_max == 1))
{
find_count = 0;
replace_count = -1;
first_call = 1;
}
else
{
first_call = 0;
}
direction = (toupper (key_0) == 'F');
new_index = perform_find (direction,
str_find, first_call, &len1);
save_find_indizes (direction, new_index, len1);
if (new_index < 0L)
{
find_ok = 0;
end_of_edit = -1;
}
else
{
find_ok = 1;
find_count++;
/* zeiger bewegen */
perform_move (new_index);
}
/* letzter durchlauf ? */
last_call = ((repeat_count >= (repeat_max - 1)) ||
(find_ok == 0));
abort = show_find_display (key_0, 0, 0,
first_call, last_call, find_ok);
if (abort)
end_of_edit = -1;
if (last_call)
show_find_result (str_find, find_count, replace_count);
break;
case 'R': /* Replace */
case '?':
LOCK_WHEN_BUFFER_ACTIVE LOCK_WHEN_VIEW_ONLY
line_2_flag = 1;
if (repeat_count == 0)
{
/* str_help, damit auch 'R' "^SR" with "^ST" funktioniert : */
memcpy (str_help, str_find, sizeof(str_help));
if (key_0 == '?')
do_it = get_line_2_string ("?Replace:", str_help,
-1, ID_FIND);
else
do_it = get_line_2_string ("Replace:", str_help,
-1, ID_FIND);
if (!do_it)
{
end_of_edit = -1;
break;
}
do_it = get_line_2_string ("with :", str_repl,
-1, ID_REPL);
if (!do_it)
{
end_of_edit = -1;
break;
}
memcpy (str_find, str_help, sizeof(str_find));
/* is there any <lf> in one of the strings ? */
lf_strings = string_with_eol (str_find) |
string_with_eol (str_repl);
}
BREAK_IF_REPEAT_0
/* display auch bei macro execute aktivieren */
if (key_0 == '?')
set.display |= 0x02;
if ((repeat_count == 0) || (repeat_max == 1))
{
find_count = 0;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -