1 /* 2 * Copyright 2018 Jiri Techet <techet@gmail.com> 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation; either version 2 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 */ 18 19 #ifndef __VIMODE_CONTEXT_H__ 20 #define __VIMODE_CONTEXT_H__ 21 22 #include "vi.h" 23 #include "sci.h" 24 25 #define INSERT_BUF_LEN 131072 26 27 typedef struct 28 { 29 /* key presses accumulated over time (e.g. for commands like 100dd) */ 30 GSList *kpl; 31 /* kpl of the last edit command used for repeating last command */ 32 GSList *repeat_kpl; 33 /* current scintilla object */ 34 ScintillaObject *sci; 35 /* callbacks for the backend */ 36 ViCallback *cb; 37 38 /* the last full search command, including '/' or '?' */ 39 gchar *search_text; 40 /* the last full substitute (replace) command of the form 's/pattern/str/flags' */ 41 gchar *substitute_text; 42 /* the last full character search command, such as 'fc' or 'Tc' */ 43 gchar *search_char; 44 45 /* whether the last copy was in line-copy-mode (like yy) or selection mode */ 46 gboolean line_copy; 47 /* whether insert mode was entered using 'o' or 'O' - we need to add newlines 48 * when copying it N times */ 49 gboolean newline_insert; 50 51 /* selection anchor - selection is between anchor and caret */ 52 gint sel_anchor; 53 /* number entered before performing mode-switching command */ 54 gint num; 55 56 /* buffer used in insert/replace mode to record entered text so it can be 57 * copied N times when e.g. 'i' is preceded by a number or when using '.' */ 58 gchar insert_buf[INSERT_BUF_LEN]; 59 gint insert_buf_len; 60 } CmdContext; 61 62 #endif 63