Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: KSP-CKAN/CKAN
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 216daaa5547d
Choose a base ref
...
head repository: KSP-CKAN/CKAN
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 62dbc58802d2
Choose a head ref
  • 2 commits
  • 2 files changed
  • 2 contributors

Commits on Oct 21, 2018

  1. Copy the full SHA
    d3e6edd View commit details

Commits on Oct 23, 2018

  1. Copy the full SHA
    62dbc58 View commit details
Showing with 27 additions and 29 deletions.
  1. +1 −0 CHANGELOG.md
  2. +26 −29 GUI/MainModList.cs
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -24,6 +24,7 @@ All notable changes to this project will be documented in this file.
- [Core] Stop auto-moving cached files (#2538 by: HebaruSan; reviewed: politas)
- [GUI] Fix toolbar background colors for dark themes (#2541 by: HebaruSan; reviewed: Olympic1)
- [GUI] Fix text colors for dark themes (#2540 by: HebaruSan; reviewed: Olympic1)
- [GUI] Clean up mod list spacebar handling in GUI (#2543 by: HebaruSan; reviewed: politas)

## v1.25.3 (Woomera)

55 changes: 26 additions & 29 deletions GUI/MainModList.cs
Original file line number Diff line number Diff line change
@@ -289,26 +289,39 @@ private void ModList_HeaderMouseClick(object sender, DataGridViewCellMouseEventA
/// </summary>
private void ModList_KeyDown(object sender, KeyEventArgs e)
{
DataGridViewCell cell = null;
switch (e.KeyCode)
{
case Keys.Home:
// First row.
cell = ModList.Rows[0].Cells[2];
ModList.CurrentCell = ModList.Rows[0].Cells[2];
e.Handled = true;
break;

case Keys.End:
// Last row.
cell = ModList.Rows[ModList.Rows.Count - 1].Cells[2];
ModList.CurrentCell = ModList.Rows[ModList.Rows.Count - 1].Cells[2];
e.Handled = true;
break;
}

if (cell != null)
{
e.Handled = true;

// Selects the top/bottom row and scrolls the list to it.
ModList.CurrentCell = cell;
case Keys.Space:
// If they've focused one of the checkbox columns, don't intercept
if (ModList.CurrentCell.ColumnIndex > 1)
{
DataGridViewRow row = ModList.CurrentRow;
// Toggle Update column if enabled, otherwise Install
for (int colIndex = 1; colIndex >= 0; --colIndex)
{
if (row?.Cells[colIndex] is DataGridViewCheckBoxCell)
{
// Need to change the state here, because the user hasn't clicked on a checkbox
row.Cells[colIndex].Value = !(bool)row.Cells[colIndex].Value;
ModList.CommitEdit(DataGridViewDataErrorContexts.Commit);
e.Handled = true;
break;
}
}
}
break;
}
}

@@ -321,29 +334,13 @@ private void ModList_KeyDown(object sender, KeyEventArgs e)
/// </summary>
private void ModList_KeyPress(object sender, KeyPressEventArgs e)
{
var current_row = ModList.CurrentRow;
var key = e.KeyChar.ToString();

// Check the key. If it is space and the current row is selected, mark the current mod as selected.
if (key == " ")
// Don't search for spaces or newlines
if (e.KeyChar == (char)Keys.Space || e.KeyChar == (char)Keys.Enter)
{
if (current_row != null && current_row.Selected)
{
var gui_mod = (GUIMod)current_row.Tag;
if (gui_mod.IsInstallable())
MarkModForInstall(gui_mod.Identifier, gui_mod.IsInstallChecked);
}

e.Handled = true;
return;
}

if (e.KeyChar == (char)Keys.Enter)
{
// Don't try to search for newlines.
return;
}

var key = e.KeyChar.ToString();
// Determine time passed since last key press.
TimeSpan interval = DateTime.Now - lastSearchTime;
if (interval.TotalSeconds < 1)