|
@ -1216,22 +1216,6 @@ void app_add_piano_bits_for_character(App_state* a, char c) { |
|
|
a->piano_bits |= added_bits; |
|
|
a->piano_bits |= added_bits; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void app_input_character(App_state* a, char c) { |
|
|
|
|
|
bool ok = c >= '!' && c <= '~'; |
|
|
|
|
|
if (!ok) |
|
|
|
|
|
return; |
|
|
|
|
|
switch (a->input_mode) { |
|
|
|
|
|
case Tui_input_mode_normal: |
|
|
|
|
|
case Tui_input_mode_append: |
|
|
|
|
|
case Tui_input_mode_selresize: |
|
|
|
|
|
app_write_character(a, c); |
|
|
|
|
|
break; |
|
|
|
|
|
case Tui_input_mode_piano: |
|
|
|
|
|
app_add_piano_bits_for_character(a, c); |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool app_try_selection_clipped_to_field(App_state const* a, Usz* out_y, |
|
|
bool app_try_selection_clipped_to_field(App_state const* a, Usz* out_y, |
|
|
Usz* out_x, Usz* out_h, Usz* out_w) { |
|
|
Usz* out_x, Usz* out_h, Usz* out_w) { |
|
|
Usz curs_y = a->tui_cursor.y; |
|
|
Usz curs_y = a->tui_cursor.y; |
|
@ -1277,6 +1261,28 @@ bool app_copy_selection_to_clipbard(App_state* a) { |
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void app_input_character(App_state* a, char c) { |
|
|
|
|
|
switch (a->input_mode) { |
|
|
|
|
|
case Tui_input_mode_append: |
|
|
|
|
|
app_write_character(a, c); |
|
|
|
|
|
break; |
|
|
|
|
|
case Tui_input_mode_normal: |
|
|
|
|
|
case Tui_input_mode_selresize: |
|
|
|
|
|
if (a->tui_cursor.h <= 1 && a->tui_cursor.w <= 1) { |
|
|
|
|
|
app_write_character(a, c); |
|
|
|
|
|
} else { |
|
|
|
|
|
undo_history_push(&a->undo_hist, &a->field, a->tick_num); |
|
|
|
|
|
app_fill_selection_with_char(a, c); |
|
|
|
|
|
a->needs_remarking = true; |
|
|
|
|
|
a->is_draw_dirty = true; |
|
|
|
|
|
} |
|
|
|
|
|
break; |
|
|
|
|
|
case Tui_input_mode_piano: |
|
|
|
|
|
app_add_piano_bits_for_character(a, c); |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
typedef enum { |
|
|
typedef enum { |
|
|
App_input_cmd_undo, |
|
|
App_input_cmd_undo, |
|
|
App_input_cmd_toggle_append_mode, |
|
|
App_input_cmd_toggle_append_mode, |
|
|