Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
minefuto committed Jan 30, 2021
1 parent df90917 commit bf506bc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,30 +22,30 @@ Add the following to shell's config file.
`<key>`: Specify any key.
**Bash(`.bashrc`)**
```
function transparent-pipeline() {
function transparent-pipe() {
READLINE_LINE=$(tp -c "${READLINE_LINE}|")
READLINE_POINT=${#READLINE_LINE}
}
bind -x '"<key>": transparent-pipeline'
bind -x '"<key>": transparent-pipe'
```
**Zsh(`.zshrc`)**
```
function transparent-pipeline() {
function transparent-pipe() {
BUFFER="$(tp -c "${BUFFER}|")"
CURSOR=$#BUFFER
}
zle -N transparent-pipeline
bindkey "<key>" transparent-pipeline
bindkey "<key>" transparent-pipe
```
**Fish(`config.fish`)**
```
function transparent-pipeline
function transparent-pipe
commandline | read -l buffer
commandline -r (tp -c "$buffer|")
commandline -f repaint
end
function fish_user_key_bindings
bind "<key>" transparent-pipeline
bind "<key>" transparent-pipe
end
```

Expand Down
10 changes: 5 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func newTui() *tui {
flex := tview.NewFlex()
if horizontalFlag {
flex.SetDirection(tview.FlexRow).
AddItem(cliPane, 1, 1, false).
AddItem(cliPane, 1, 0, false).
AddItem(stdinPane, 0, 1, false).
AddItem(stdoutPane, 0, 1, false)
} else {
Expand All @@ -66,7 +66,7 @@ func newTui() *tui {
AddItem(stdoutPane, 0, 1, false)

flex.SetDirection(tview.FlexRow).
AddItem(cliPane, 1, 1, false).
AddItem(cliPane, 1, 0, false).
AddItem(viewPanes, 0, 1, false)
}

Expand Down Expand Up @@ -104,13 +104,13 @@ func (t *tui) setAction() {
t.cliPane.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey {
switch event.Key() {
case tcell.KeyCtrlF:
return tcell.NewEventKey(tcell.KeyRight, ' ', tcell.ModNone)
return tcell.NewEventKey(tcell.KeyRight, 0, tcell.ModNone)

case tcell.KeyCtrlB:
return tcell.NewEventKey(tcell.KeyLeft, ' ', tcell.ModNone)
return tcell.NewEventKey(tcell.KeyLeft, 0, tcell.ModNone)

case tcell.KeyCtrlD:
return tcell.NewEventKey(tcell.KeyDelete, ' ', tcell.ModNone)
return tcell.NewEventKey(tcell.KeyDelete, 0, tcell.ModNone)

case tcell.KeyCtrlC:
if commandFlag {
Expand Down

0 comments on commit bf506bc

Please sign in to comment.