on master help sign in
removed shift matching
712f25cJan Hrastnik
helix-term/src/keymap.rs+15−24
@@ -103,15 +103,6 @@ macro_rules! key {
103 };
103 };
104}
104}
105
105
106−macro_rules! shift {
107− ($($ch:tt)*) => {
108− KeyEvent {
109− code: KeyCode::Char($($ch)*),
110− modifiers: KeyModifiers::SHIFT,
111− }
112− };
113−}
114−
115macro_rules! ctrl {
106macro_rules! ctrl {
116 ($($ch:tt)*) => {
107 ($($ch:tt)*) => {
117 KeyEvent {
108 KeyEvent {
@@ -139,8 +130,8 @@ pub fn default() -> Keymaps {
139
130
140 key!('t') => commands::find_till_char,
131 key!('t') => commands::find_till_char,
141 key!('f') => commands::find_next_char,
132 key!('f') => commands::find_next_char,
142− shift!('T') => commands::till_prev_char,
133+ key!('T') => commands::till_prev_char,
143− shift!('F') => commands::find_prev_char,
134+ key!('F') => commands::find_prev_char,
144 // and matching set for select mode (extend)
135 // and matching set for select mode (extend)
145 //
136 //
146 key!('r') => commands::replace,
137 key!('r') => commands::replace,
@@ -157,11 +148,11 @@ pub fn default() -> Keymaps {
157 key!(':') => commands::command_mode,
148 key!(':') => commands::command_mode,
158
149
159 key!('i') => commands::insert_mode,
150 key!('i') => commands::insert_mode,
160− shift!('I') => commands::prepend_to_line,
151+ key!('I') => commands::prepend_to_line,
161 key!('a') => commands::append_mode,
152 key!('a') => commands::append_mode,
162− shift!('A') => commands::append_to_line,
153+ key!('A') => commands::append_to_line,
163 key!('o') => commands::open_below,
154 key!('o') => commands::open_below,
164− shift!('O') => commands::open_above,
155+ key!('O') => commands::open_above,
165 // [<space> ]<space> equivalents too (add blank new line, no edit)
156 // [<space> ]<space> equivalents too (add blank new line, no edit)
166
157
167
158
@@ -174,12 +165,12 @@ pub fn default() -> Keymaps {
174
165
175 key!('s') => commands::select_regex,
166 key!('s') => commands::select_regex,
176 alt!('s') => commands::split_selection_on_newline,
167 alt!('s') => commands::split_selection_on_newline,
177− shift!('S') => commands::split_selection,
168+ key!('S') => commands::split_selection,
178 key!(';') => commands::collapse_selection,
169 key!(';') => commands::collapse_selection,
179 alt!(';') => commands::flip_selections,
170 alt!(';') => commands::flip_selections,
180 key!('%') => commands::select_all,
171 key!('%') => commands::select_all,
181 key!('x') => commands::select_line,
172 key!('x') => commands::select_line,
182− shift!('X') => commands::extend_line,
173+ key!('X') => commands::extend_line,
183 // or select mode X?
174 // or select mode X?
184 // extend_to_whole_line, crop_to_whole_line
175 // extend_to_whole_line, crop_to_whole_line
185
176
@@ -199,25 +190,25 @@ pub fn default() -> Keymaps {
199 key!('/') => commands::search,
190 key!('/') => commands::search,
200 // ? for search_reverse
191 // ? for search_reverse
201 key!('n') => commands::search_next,
192 key!('n') => commands::search_next,
202− shift!('N') => commands::extend_search_next,
193+ key!('N') => commands::extend_search_next,
203 // N for search_prev
194 // N for search_prev
204 key!('*') => commands::search_selection,
195 key!('*') => commands::search_selection,
205
196
206 key!('u') => commands::undo,
197 key!('u') => commands::undo,
207− shift!('U') => commands::redo,
198+ key!('U') => commands::redo,
208
199
209 key!('y') => commands::yank,
200 key!('y') => commands::yank,
210 // yank_all
201 // yank_all
211 key!('p') => commands::paste_after,
202 key!('p') => commands::paste_after,
212 // paste_all
203 // paste_all
213− shift!('P') => commands::paste_before,
204+ key!('P') => commands::paste_before,
214
205
215 key!('>') => commands::indent,
206 key!('>') => commands::indent,
216 key!('<') => commands::unindent,
207 key!('<') => commands::unindent,
217 key!('=') => commands::format_selections,
208 key!('=') => commands::format_selections,
218− shift!('J') => commands::join_selections,
209+ key!('J') => commands::join_selections,
219 // TODO: conflicts hover/doc
210 // TODO: conflicts hover/doc
220− shift!('K') => commands::keep_selections,
211+ key!('K') => commands::keep_selections,
221 // TODO: and another method for inverse
212 // TODO: and another method for inverse
222
213
223 // TODO: clashes with space mode
214 // TODO: clashes with space mode
@@ -256,7 +247,7 @@ pub fn default() -> Keymaps {
256
247
257 // move under <space>c
248 // move under <space>c
258 ctrl!('c') => commands::toggle_comments,
249 ctrl!('c') => commands::toggle_comments,
259− shift!('K') => commands::hover,
250+ key!('K') => commands::hover,
260
251
261 // z family for save/restore/combine from/to sels from register
252 // z family for save/restore/combine from/to sels from register
262
253
@@ -284,8 +275,8 @@ pub fn default() -> Keymaps {
284
275
285 key!('t') => commands::extend_till_char,
276 key!('t') => commands::extend_till_char,
286 key!('f') => commands::extend_next_char,
277 key!('f') => commands::extend_next_char,
287− shift!('T') => commands::extend_till_prev_char,
278+ key!('T') => commands::extend_till_prev_char,
288− shift!('F') => commands::extend_prev_char,
279+ key!('F') => commands::extend_prev_char,
289
280
290 KeyEvent {
281 KeyEvent {
291 code: KeyCode::Esc,
282 code: KeyCode::Esc,
helix-term/src/ui/editor.rs+6−1
@@ -543,10 +543,15 @@ impl Component for EditorView {
543 cx.editor.resize(Rect::new(0, 0, width, height - 1));
543 cx.editor.resize(Rect::new(0, 0, width, height - 1));
544 EventResult::Consumed(None)
544 EventResult::Consumed(None)
545 }
545 }
546− Event::Key(key) => {
546+ Event::Key(mut key) => {
547 // clear status
547 // clear status
548 cx.editor.status_msg = None;
548 cx.editor.status_msg = None;
549
549
550+ //canonicalize the key
551+ if key.modifiers == KeyModifiers::SHIFT {
552+ key.modifiers = KeyModifiers::NONE;
553+ }
554+
550 let (view, doc) = cx.editor.current();
555 let (view, doc) = cx.editor.current();
551 let mode = doc.mode();
556 let mode = doc.mode();
552
557