mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-04 15:41:12 -03:00
restyle switch blocks to match project style
I missed restyling a few "switch" blocks to make them consistent with the rest of the code base. This fixes that oversight. This should be the final step in restyling the C++ code to have a consistent style. This also includes a few trivial cleanups elsewhere. I also missed restyling the "complete" module when working my way from a to z so this final change includes restyling that module. Total lint errors decreased 36%. Cppcheck errors went from 47 to 24. Oclint P2 errors went from 819 to 778. Oclint P3 errors went from 3252 to 1842. Resolves #2902.
This commit is contained in:
@@ -584,26 +584,27 @@ bool pager_t::select_next_completion_in_direction(selection_direction_t directio
|
||||
// Handle the case of nothing selected yet.
|
||||
if (selected_completion_idx == PAGER_SELECTION_NONE) {
|
||||
switch (direction) {
|
||||
// These directions do something sane.
|
||||
case direction_south:
|
||||
case direction_page_south:
|
||||
case direction_next:
|
||||
case direction_prev:
|
||||
case direction_prev: {
|
||||
// These directions do something sane.
|
||||
if (direction == direction_prev) {
|
||||
selected_completion_idx = completion_infos.size() - 1;
|
||||
} else {
|
||||
selected_completion_idx = 0;
|
||||
}
|
||||
return true;
|
||||
|
||||
// These do nothing.
|
||||
}
|
||||
case direction_north:
|
||||
case direction_page_north:
|
||||
case direction_east:
|
||||
case direction_west:
|
||||
case direction_deselect:
|
||||
default:
|
||||
default: {
|
||||
// These do nothing.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -651,7 +652,6 @@ bool pager_t::select_next_completion_in_direction(selection_direction_t directio
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case direction_page_south: {
|
||||
if (current_row + page_height < rendering.rows) {
|
||||
current_row += page_height;
|
||||
@@ -675,7 +675,6 @@ bool pager_t::select_next_completion_in_direction(selection_direction_t directio
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case direction_east: {
|
||||
// Go east, wrapping to the next row. There is no "row memory," so if we run off the
|
||||
// end, wrap.
|
||||
@@ -688,7 +687,6 @@ bool pager_t::select_next_completion_in_direction(selection_direction_t directio
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case direction_west: {
|
||||
// Go west, wrapping to the previous row.
|
||||
if (current_col > 0) {
|
||||
@@ -699,10 +697,10 @@ bool pager_t::select_next_completion_in_direction(selection_direction_t directio
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
default: {
|
||||
assert(0 && "Unknown cardinal direction");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Compute the new index based on the changed row.
|
||||
|
||||
Reference in New Issue
Block a user