Skip to content

Commit b19645d

Browse files
authored
Merge pull request #38 from hgrias/master
feat: add fixup flag commands
2 parents b474dc9 + 0931cdf commit b19645d

3 files changed

Lines changed: 21 additions & 1 deletion

File tree

‎lib/key-bindings.js‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ module.exports = function (customKeyBindingsFile) {
2929
e: 'edit',
3030
s: 'squash',
3131
f: 'fixup',
32+
ALT_F: 'fixup -c',
33+
CTRL_F: 'fixup -C',
3234
b: 'break',
3335
d: 'drop',
3436
BACKSPACE: 'drop',

‎lib/reducer.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22

3-
const actions = ['pick', 'fixup', 'squash', 'reword', 'edit', 'drop'];
3+
const actions = ['pick', 'fixup', 'fixup -c', 'fixup -C', 'squash', 'reword', 'edit', 'drop'];
44
const [DOWN, UP] = [1, -1];
55

66
function deepFreeze(obj) {

‎test/reducer.spec.js‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,24 @@ describe('Reducer', function () {
344344
expect(newState.otherStateVar).to.equal(state.otherStateVar);
345345
});
346346

347+
it("should change on fixup - alternate keybinds with flag", function () {
348+
const state = getState(3, 1);
349+
let newState = reduce(state, "fixup -C");
350+
expect(newState.lines[0]).to.equal(state.lines[0]);
351+
expect(newState.lines[1].action).to.equal("fixup -C");
352+
expect(newState.lines[1].message).to.equal(state.lines[1].message);
353+
expect(newState.lines[1]).not.to.equal(state.lines[1]);
354+
expect(newState.lines[2]).to.equal(state.lines[2]);
355+
expect(newState.otherStateVar).to.equal(state.otherStateVar);
356+
newState = reduce(state, "fixup -c");
357+
expect(newState.lines[0]).to.equal(state.lines[0]);
358+
expect(newState.lines[1].action).to.equal("fixup -c");
359+
expect(newState.lines[1].message).to.equal(state.lines[1].message);
360+
expect(newState.lines[1]).not.to.equal(state.lines[1]);
361+
expect(newState.lines[2]).to.equal(state.lines[2]);
362+
expect(newState.otherStateVar).to.equal(state.otherStateVar);
363+
});
364+
347365
it('should change entire selection', function () {
348366
const state = getState([{
349367
action: 'pick',

0 commit comments

Comments
 (0)