Skip to content

Commit 8973a5d

Browse files
committed
ShortcutDialog update 7
1 parent 16f01a5 commit 8973a5d

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

FlashDevelop/Dialogs/ShortcutDialog.cs

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ namespace FlashDevelop.Dialogs
1414
{
1515
public class ShortcutDialog : SmartForm
1616
{
17-
const string ViewConflictsKey = "?"; // TODO: Change the type to char after #969 is merged
18-
const string ViewCustomKey = "*"; // TODO: Change the type to char after #969 is merged
17+
const char ViewConflictsKey = '?';
18+
const char ViewCustomKey = '*';
1919

2020
Timer updateTimer;
2121
ToolStripMenuItem removeShortcut;
@@ -330,6 +330,8 @@ bool ShowConflictsPresent()
330330
if (MessageBox.Show(this, text, " " + caption, MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
331331
{
332332
this.filterTextBox.Text = ViewConflictsKey.ToString();
333+
this.filterTextBox.SelectAll();
334+
this.filterTextBox.Focus();
333335
return true;
334336
}
335337
return false;
@@ -365,17 +367,17 @@ void PopulateListView(string filter)
365367

366368
/// <summary>
367369
/// Reads and removes filter keywords from the start of the filter.
368-
/// Order of the keywords is irrelevant.
370+
/// The order of the keywords is irrelevant.
369371
/// </summary>
370372
static string ExtractFilterKeywords(string filter, ref bool viewCustom, ref bool viewConflicts)
371373
{
372-
if (!viewCustom && filter.StartsWith(ViewCustomKey))
374+
if (!viewCustom && filter.Length != 0 && filter[0] == ViewCustomKey)
373375
{
374376
filter = filter.Substring(1);
375377
viewCustom = true;
376378
return ExtractFilterKeywords(filter, ref viewCustom, ref viewConflicts);
377379
}
378-
if (!viewConflicts && filter.StartsWith(ViewConflictsKey))
380+
if (!viewConflicts && filter.Length != 0 && filter[0] == ViewConflictsKey)
379381
{
380382
filter = filter.Substring(1);
381383
viewConflicts = true;
@@ -585,14 +587,10 @@ void SelectCustomShortcut(object sender, EventArgs e)
585587

586588
if (dialog.ShowDialog(this) == DialogResult.OK)
587589
{
588-
string extension = Path.GetExtension(dialog.FileName);
589-
if (extension.Equals(".fda", StringComparison.OrdinalIgnoreCase))
590-
{
591-
this.listView.BeginUpdate();
592-
ShortcutManager.LoadCustomShortcuts(dialog.FileName, this.shortcutListItems);
593-
this.UpdateAllShortcutsConflicts();
594-
this.listView.EndUpdate();
595-
}
590+
this.listView.BeginUpdate();
591+
ShortcutManager.LoadCustomShortcuts(dialog.FileName, this.shortcutListItems);
592+
this.UpdateAllShortcutsConflicts();
593+
this.listView.EndUpdate();
596594
}
597595
}
598596

0 commit comments

Comments
 (0)