robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
3b00ddb601
master
1#pragma once 2 3#include <stdbool.h> 4 5#include "nvim/pos_defs.h" 6#include "nvim/types_defs.h" 7 8/// Change-delimiting cursor-move in insert-mode (start_arrow()): undo, Ins.start and last_insert 9/// (the ". register) restart at next edit (stop_arrow()); typed keys sync undo (may_sync_undo()). 10typedef enum { 11kInsNone = 0 ,///< No cursor-move since last edit: contiguous insert-session. 12kInsArrow ,///< Cursor-move captured in the atom. 13kInsJump ,///< Non-replayable jump (mouse, <PageUp>, …): atom terminated (<Esc>). 14}InsArrow ; 15 16/// Insert-mode session state: the in-progress insert session, as one global "group" (Ins), so it 17/// can be saved/restored around nested edit() sessions (mc_ins_save_state). 18typedef struct { 19pos_T start ;///< Start of current INSERTION: from here to cursor is the unit that 20///< undo, '[ and ". treat as one. Reanchored after cursor-move, C-G u. 21pos_T start_orig ;///< Where insert by the user started (for op_insert): follows `start` 22///< until insertion starts right of it; <bs> before it pulls back. 23colnr_T start_textlen ;///< length of line when insert started 24colnr_T start_blank_vcol ;///< vcol for first inserted blank 25InsArrow moved ;///< Cursor moved since the last edit; see InsArrow. 26bool stop_insert_mode ;///< for ":stopinsert" 27bool can_cindent ;///< may do cindenting on this line 28bool need_undo ;///< call u_save() before inserting a char. Set when edit() is 29///< called; after that `moved` is used. 30bool did_ai ;///< Makes auto-indent work right on lines where only a <CR> or 31///< <Esc> is typed: set when an auto-indent is done, reset when any 32///< other editing is done on the line. If an <Esc> or <CR> is 33///< received and did_ai is true, the line is truncated. 34colnr_T ai_col ;///< Column of first char after autoindent. 0 when no autoindent 35///< done. Used when 'backspace' is 0, to avoid backspacing over 36///< autoindent. 37int end_comment_pending ;///< A character which will end a start-middle-end comment when 38///< typed as the first character on a new line. Taken from the last 39///< character of the "end" comment leader when the COM_AUTO_END 40///< flag is given for that comment end in 'comments'. Only valid 41///< when did_ai is true. 42bool did_si ;///< Set when a smart indent has been performed: when the next 43///< typed character is a '{' the inserted tab will be deleted again. 44bool can_si ;///< after an auto indent: a typed '}' removes one indent 45bool can_si_back ;///< after an "O" command: a typed '{' removes one indent 46bool update_start_orig ;///< set start_orig to start 47int new_insert_skip ;///< number of chars in front of the current insert 48int did_restart_edit ;///< "restart_edit" when edit() was called 49bool revins_on ;///< reverse insert mode on 50int revins_chars ;///< how much to skip after edit 51int revins_legal ;///< was the last char "legal"? 52int revins_scol ;///< start column of revins session 53TriState dont_sync_undo ;///< CTRL-G U prevents syncing undo for the next left/right cursor key 54linenr_T o_lnum ;///< "o" command's line, for "CTRL-O ." that adds a line (ins_at_eol) 55}InsState ;