Skip to content

Commit 62ebf9a

Browse files
committed
Remove extra commands
1 parent d86d444 commit 62ebf9a

File tree

4 files changed

+2
-335
lines changed

4 files changed

+2
-335
lines changed

src/Files.App/UserControls/TerminalView.xaml.cs

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -417,40 +417,6 @@ Task<string> GetTextAsync()
417417
Paste(content);
418418
return;
419419
}
420-
case nameof(Command.PasteWithoutNewlines):
421-
{
422-
return;
423-
}
424-
case nameof(Command.Search):
425-
{
426-
return;
427-
}
428-
case nameof(Command.CloseSearch):
429-
{
430-
return;
431-
}
432-
case nameof(Command.IncreaseFontSize):
433-
{
434-
FontSize++;
435-
await ExecuteScriptAsync($"setFontSize({FontSize})");
436-
return;
437-
}
438-
case nameof(Command.DecreaseFontSize):
439-
{
440-
if (FontSize > 2)
441-
{
442-
FontSize--;
443-
await ExecuteScriptAsync($"setFontSize({FontSize})");
444-
}
445-
446-
return;
447-
}
448-
case nameof(Command.ResetFontSize):
449-
{
450-
FontSize = new DefaultValueProvider().GetDefaultTerminalOptions().FontSize;
451-
await ExecuteScriptAsync($"setFontSize({FontSize})");
452-
return;
453-
}
454420
default:
455421
{
456422
return;

src/Files.App/Utils/Terminal/DefaultValueProvider.cs

Lines changed: 1 addition & 267 deletions
Original file line numberDiff line numberDiff line change
@@ -22,190 +22,6 @@ public ICollection<KeyBinding> GetDefaultKeyBindings(Command command)
2222
{
2323
switch (command)
2424
{
25-
case Command.ToggleWindow:
26-
return new List<KeyBinding>
27-
{
28-
new KeyBinding
29-
{
30-
Command = nameof(Command.ToggleWindow),
31-
Key = (int)ExtendedVirtualKey.Scroll
32-
}
33-
};
34-
35-
case Command.NextTab:
36-
return new List<KeyBinding>
37-
{
38-
new KeyBinding
39-
{
40-
Command = nameof(Command.NextTab),
41-
Ctrl = true,
42-
Key = (int)ExtendedVirtualKey.Tab
43-
}
44-
};
45-
46-
case Command.PreviousTab:
47-
return new List<KeyBinding>
48-
{
49-
new KeyBinding
50-
{
51-
Command = nameof(Command.PreviousTab),
52-
Ctrl = true,
53-
Shift = true,
54-
Key = (int)ExtendedVirtualKey.Tab
55-
}
56-
};
57-
58-
case Command.SwitchToTerm1:
59-
case Command.SwitchToTerm2:
60-
case Command.SwitchToTerm3:
61-
case Command.SwitchToTerm4:
62-
case Command.SwitchToTerm5:
63-
case Command.SwitchToTerm6:
64-
case Command.SwitchToTerm7:
65-
case Command.SwitchToTerm8:
66-
case Command.SwitchToTerm9:
67-
return new List<KeyBinding>
68-
{
69-
new KeyBinding
70-
{
71-
Command = command.ToString(),
72-
Alt = true,
73-
Key = (int)ExtendedVirtualKey.Number1 + (command - Command.SwitchToTerm1)
74-
}
75-
};
76-
77-
case Command.DuplicateTab:
78-
return new List<KeyBinding>
79-
{
80-
new KeyBinding
81-
{
82-
Command = nameof(Command.DuplicateTab),
83-
Ctrl = true,
84-
Shift = true,
85-
Key = (int)ExtendedVirtualKey.D
86-
}
87-
};
88-
89-
case Command.ReconnectTab:
90-
return new List<KeyBinding>
91-
{
92-
new KeyBinding
93-
{
94-
Command = nameof(Command.ReconnectTab),
95-
Ctrl = true,
96-
Alt = true,
97-
Key = (int)ExtendedVirtualKey.R
98-
}
99-
};
100-
101-
case Command.NewTab:
102-
return new List<KeyBinding>
103-
{
104-
new KeyBinding
105-
{
106-
Command = nameof(Command.NewTab),
107-
Ctrl = true,
108-
Shift = true,
109-
Key = (int)ExtendedVirtualKey.T
110-
}
111-
};
112-
113-
case Command.NewSshTab:
114-
return new List<KeyBinding>
115-
{
116-
new KeyBinding
117-
{
118-
Command = nameof(Command.NewSshTab),
119-
Ctrl = true,
120-
Shift = true,
121-
Key = (int)ExtendedVirtualKey.Y
122-
}
123-
};
124-
125-
case Command.NewSshWindow:
126-
return new List<KeyBinding>
127-
{
128-
new KeyBinding
129-
{
130-
Command = nameof(Command.NewSshWindow),
131-
Ctrl = true,
132-
Alt = true,
133-
Key = (int)ExtendedVirtualKey.Y
134-
}
135-
};
136-
137-
case Command.NewCustomCommandTab:
138-
return new List<KeyBinding>
139-
{
140-
new KeyBinding
141-
{
142-
Command = nameof(Command.NewCustomCommandTab),
143-
Ctrl = true,
144-
Alt = true,
145-
Key = (int)ExtendedVirtualKey.T
146-
}
147-
};
148-
149-
case Command.NewCustomCommandWindow:
150-
return new List<KeyBinding>
151-
{
152-
new KeyBinding
153-
{
154-
Command = nameof(Command.NewCustomCommandWindow),
155-
Ctrl = true,
156-
Alt = true,
157-
Key = (int)ExtendedVirtualKey.N
158-
}
159-
};
160-
161-
case Command.ChangeTabTitle:
162-
return new List<KeyBinding>
163-
{
164-
new KeyBinding
165-
{
166-
Command = nameof(Command.ChangeTabTitle),
167-
Ctrl = true,
168-
Shift = true,
169-
Key = (int)ExtendedVirtualKey.R
170-
}
171-
};
172-
173-
case Command.CloseTab:
174-
return new List<KeyBinding>
175-
{
176-
new KeyBinding
177-
{
178-
Command = nameof(Command.CloseTab),
179-
Ctrl = true,
180-
Shift = true,
181-
Key = (int)ExtendedVirtualKey.W
182-
}
183-
};
184-
185-
case Command.NewWindow:
186-
return new List<KeyBinding>
187-
{
188-
new KeyBinding
189-
{
190-
Command = nameof(Command.NewWindow),
191-
Ctrl = true,
192-
Shift = true,
193-
Key = (int)ExtendedVirtualKey.N
194-
}
195-
};
196-
197-
case Command.ShowSettings:
198-
return new List<KeyBinding>
199-
{
200-
new KeyBinding
201-
{
202-
Command = nameof(Command.ShowSettings),
203-
Ctrl = true,
204-
Shift = true,
205-
Key = (int)ExtendedVirtualKey.Comma
206-
}
207-
};
208-
20925
case Command.Copy:
21026
return new List<KeyBinding>
21127
{
@@ -217,7 +33,6 @@ public ICollection<KeyBinding> GetDefaultKeyBindings(Command command)
21733
Key = (int)ExtendedVirtualKey.C
21834
}
21935
};
220-
22136
case Command.Paste:
22237
return new List<KeyBinding>
22338
{
@@ -230,57 +45,6 @@ public ICollection<KeyBinding> GetDefaultKeyBindings(Command command)
23045
}
23146
};
23247

233-
234-
case Command.PasteWithoutNewlines:
235-
return new List<KeyBinding>
236-
{
237-
new KeyBinding
238-
{
239-
Command = nameof(Command.PasteWithoutNewlines),
240-
Ctrl = true,
241-
Alt = true,
242-
Key = (int)ExtendedVirtualKey.V
243-
}
244-
};
245-
246-
case Command.Search:
247-
return new List<KeyBinding>
248-
{
249-
new KeyBinding
250-
{
251-
Command = nameof(Command.Search),
252-
Ctrl = true,
253-
Shift = true,
254-
Key = (int)ExtendedVirtualKey.F
255-
}
256-
};
257-
258-
case Command.CloseSearch:
259-
return new List<KeyBinding>
260-
{
261-
new KeyBinding
262-
{
263-
Command = nameof(Command.CloseSearch),
264-
Key = (int)ExtendedVirtualKey.Escape
265-
}
266-
};
267-
268-
case Command.ToggleFullScreen:
269-
return new List<KeyBinding>
270-
{
271-
new KeyBinding
272-
{
273-
Command = nameof(Command.ToggleFullScreen),
274-
Alt = true,
275-
Key = (int)ExtendedVirtualKey.Enter
276-
},
277-
new KeyBinding
278-
{
279-
Command = nameof(Command.ToggleFullScreen),
280-
Key = (int)ExtendedVirtualKey.F11
281-
}
282-
};
283-
28448
case Command.SelectAll:
28549
return new List<KeyBinding>
28650
{
@@ -292,7 +56,6 @@ public ICollection<KeyBinding> GetDefaultKeyBindings(Command command)
29256
Key = (int)ExtendedVirtualKey.A
29357
}
29458
};
295-
29659
case Command.Clear:
29760
return new List<KeyBinding>
29861
{
@@ -304,36 +67,7 @@ public ICollection<KeyBinding> GetDefaultKeyBindings(Command command)
30467
Key = (int)ExtendedVirtualKey.L
30568
}
30669
};
307-
case Command.IncreaseFontSize:
308-
return new List<KeyBinding>
309-
{
310-
new KeyBinding
311-
{
312-
Command = nameof(Command.IncreaseFontSize),
313-
Ctrl = true,
314-
Key = (int)ExtendedVirtualKey.Plus
315-
}
316-
};
317-
case Command.DecreaseFontSize:
318-
return new List<KeyBinding>
319-
{
320-
new KeyBinding
321-
{
322-
Command = nameof(Command.DecreaseFontSize),
323-
Ctrl = true,
324-
Key = (int)ExtendedVirtualKey.Minus
325-
}
326-
};
327-
case Command.ResetFontSize:
328-
return new List<KeyBinding>
329-
{
330-
new KeyBinding
331-
{
332-
Command = nameof(Command.ResetFontSize),
333-
Ctrl = true,
334-
Key = (int)ExtendedVirtualKey.Number0
335-
}
336-
};
70+
33771
default:
33872
throw new InvalidOperationException($"Default keybindings for Command '{command}' are missing");
33973
}

src/Files.App/Utils/Terminal/TerminalModels.cs

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -549,40 +549,10 @@ public enum ScrollBarStyle
549549

550550
public enum Command
551551
{
552-
ToggleWindow,
553-
NextTab,
554-
PreviousTab,
555-
NewTab,
556-
NewWindow,
557-
NewSshTab,
558-
NewSshWindow,
559-
NewCustomCommandTab,
560-
NewCustomCommandWindow,
561-
ChangeTabTitle,
562-
CloseTab,
563-
ShowSettings,
564552
Copy,
565553
Paste,
566-
PasteWithoutNewlines,
567-
Search,
568-
CloseSearch,
569-
ToggleFullScreen,
570554
SelectAll,
571-
Clear,
572-
SwitchToTerm1,
573-
SwitchToTerm2,
574-
SwitchToTerm3,
575-
SwitchToTerm4,
576-
SwitchToTerm5,
577-
SwitchToTerm6,
578-
SwitchToTerm7,
579-
SwitchToTerm8,
580-
SwitchToTerm9,
581-
DuplicateTab,
582-
ReconnectTab,
583-
IncreaseFontSize,
584-
DecreaseFontSize,
585-
ResetFontSize
555+
Clear
586556
}
587557

588558
public class TerminalSize

src/Files.App/Utils/Terminal/UI/Build/src/index.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,9 +253,6 @@ window.createTerminal = (options, theme, keyBindings) => {
253253
term.selectAll();
254254
return false;
255255
}
256-
if (keyBinding.command == 'CloseSearch') {
257-
return true;
258-
}
259256

260257
e.preventDefault();
261258
window.terminalBridge.invokeCommand(keyBinding.command);

0 commit comments

Comments
 (0)