forked from vercel/hyper
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
split panes: create initial implementation
This allows users to split their Hyperterm terms into multiple nested splits, both vertical and horizontal. Fixes vercel#56
- Loading branch information
Showing
23 changed files
with
620 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import rpc from '../rpc'; | ||
import { | ||
DIRECTION, | ||
TERM_GROUP_REQUEST, | ||
TERM_GROUP_SPLIT | ||
} from '../constants/term-groups'; | ||
import { SESSION_REQUEST } from '../constants/sessions'; | ||
import { setActiveSession } from './sessions'; | ||
|
||
function requestSplit (direction) { | ||
return (dispatch, getState) => { | ||
const { ui } = getState(); | ||
dispatch({ | ||
type: SESSION_REQUEST, | ||
effect: () => { | ||
rpc.emit('new', { | ||
splitDirection: direction, | ||
cwd: ui.cwd | ||
}); | ||
} | ||
}); | ||
}; | ||
} | ||
|
||
export const requestVerticalSplit = () => requestSplit(DIRECTION.VERTICAL); | ||
export const requestHorizontalSplit = () => requestSplit(DIRECTION.HORIZONTAL); | ||
|
||
export function createSplit (uid, direction) { | ||
return (dispatch, getState) => { | ||
const { sessions } = getState(); | ||
dispatch({ | ||
type: TERM_GROUP_SPLIT, | ||
activeUid: sessions.activeUid, | ||
direction, | ||
uid | ||
}); | ||
}; | ||
} | ||
|
||
export function requestTermGroup () { | ||
return (dispatch, getState) => { | ||
const { ui } = getState(); | ||
const { cols, rows, cwd } = ui; | ||
dispatch({ | ||
type: TERM_GROUP_REQUEST, | ||
effect: () => { | ||
rpc.emit('new', { | ||
isNewGroup: true, | ||
cols, | ||
rows, | ||
cwd | ||
}); | ||
} | ||
}); | ||
}; | ||
} | ||
|
||
export function setActiveGroup (uid) { | ||
return (dispatch, getState) => { | ||
const { termGroups } = getState(); | ||
const group = termGroups.termGroups[uid]; | ||
dispatch(setActiveSession(group.activeSessionUid)); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.