mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-10 20:05:50 +02:00
Make the main view searchable
This commit is contained in:
parent
2b399a3c36
commit
ec51efc82c
12 changed files with 34 additions and 2 deletions
|
@ -210,6 +210,7 @@ If you would instead like to start an interactive rebase from the selected commi
|
||||||
| `` mouse wheel up (fn+down) `` | Scroll up | |
|
| `` mouse wheel up (fn+down) `` | Scroll up | |
|
||||||
| `` <tab> `` | Switch view | Switch to other view (staged/unstaged changes). |
|
| `` <tab> `` | Switch view | Switch to other view (staged/unstaged changes). |
|
||||||
| `` <esc> `` | Exit back to side panel | |
|
| `` <esc> `` | Exit back to side panel | |
|
||||||
|
| `` / `` | Search the current view by text | |
|
||||||
|
|
||||||
## Main panel (patch building)
|
## Main panel (patch building)
|
||||||
|
|
||||||
|
@ -311,6 +312,7 @@ If you would instead like to start an interactive rebase from the selected commi
|
||||||
|-----|--------|-------------|
|
|-----|--------|-------------|
|
||||||
| `` <tab> `` | Switch view | Switch to other view (staged/unstaged changes). |
|
| `` <tab> `` | Switch view | Switch to other view (staged/unstaged changes). |
|
||||||
| `` <esc> `` | Exit back to side panel | |
|
| `` <esc> `` | Exit back to side panel | |
|
||||||
|
| `` / `` | Search the current view by text | |
|
||||||
|
|
||||||
## Stash
|
## Stash
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
|
||||||
|-----|--------|-------------|
|
|-----|--------|-------------|
|
||||||
| `` <tab> `` | パネルを切り替え | Switch to other view (staged/unstaged changes). |
|
| `` <tab> `` | パネルを切り替え | Switch to other view (staged/unstaged changes). |
|
||||||
| `` <esc> `` | Exit back to side panel | |
|
| `` <esc> `` | Exit back to side panel | |
|
||||||
|
| `` / `` | 検索を開始 | |
|
||||||
|
|
||||||
## Stash
|
## Stash
|
||||||
|
|
||||||
|
@ -293,6 +294,7 @@ If you would instead like to start an interactive rebase from the selected commi
|
||||||
| `` mouse wheel up (fn+down) `` | 上にスクロール | |
|
| `` mouse wheel up (fn+down) `` | 上にスクロール | |
|
||||||
| `` <tab> `` | パネルを切り替え | Switch to other view (staged/unstaged changes). |
|
| `` <tab> `` | パネルを切り替え | Switch to other view (staged/unstaged changes). |
|
||||||
| `` <esc> `` | Exit back to side panel | |
|
| `` <esc> `` | Exit back to side panel | |
|
||||||
|
| `` / `` | 検索を開始 | |
|
||||||
|
|
||||||
## メインパネル (Patch Building)
|
## メインパネル (Patch Building)
|
||||||
|
|
||||||
|
|
|
@ -76,6 +76,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
|
||||||
|-----|--------|-------------|
|
|-----|--------|-------------|
|
||||||
| `` <tab> `` | 패널 전환 | Switch to other view (staged/unstaged changes). |
|
| `` <tab> `` | 패널 전환 | Switch to other view (staged/unstaged changes). |
|
||||||
| `` <esc> `` | Exit back to side panel | |
|
| `` <esc> `` | Exit back to side panel | |
|
||||||
|
| `` / `` | 검색 시작 | |
|
||||||
|
|
||||||
## Stash
|
## Stash
|
||||||
|
|
||||||
|
@ -152,6 +153,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
|
||||||
| `` mouse wheel up (fn+down) `` | 위로 스크롤 | |
|
| `` mouse wheel up (fn+down) `` | 위로 스크롤 | |
|
||||||
| `` <tab> `` | 패널 전환 | Switch to other view (staged/unstaged changes). |
|
| `` <tab> `` | 패널 전환 | Switch to other view (staged/unstaged changes). |
|
||||||
| `` <esc> `` | Exit back to side panel | |
|
| `` <esc> `` | Exit back to side panel | |
|
||||||
|
| `` / `` | 검색 시작 | |
|
||||||
|
|
||||||
## 메인 패널 (Patch Building)
|
## 메인 패널 (Patch Building)
|
||||||
|
|
||||||
|
|
|
@ -218,6 +218,7 @@ If you would instead like to start an interactive rebase from the selected commi
|
||||||
| `` mouse wheel up (fn+down) `` | Scroll omhoog | |
|
| `` mouse wheel up (fn+down) `` | Scroll omhoog | |
|
||||||
| `` <tab> `` | Ga naar een ander paneel | Switch to other view (staged/unstaged changes). |
|
| `` <tab> `` | Ga naar een ander paneel | Switch to other view (staged/unstaged changes). |
|
||||||
| `` <esc> `` | Exit back to side panel | |
|
| `` <esc> `` | Exit back to side panel | |
|
||||||
|
| `` / `` | Start met zoeken | |
|
||||||
|
|
||||||
## Patch bouwen
|
## Patch bouwen
|
||||||
|
|
||||||
|
@ -289,6 +290,7 @@ If you would instead like to start an interactive rebase from the selected commi
|
||||||
|-----|--------|-------------|
|
|-----|--------|-------------|
|
||||||
| `` <tab> `` | Ga naar een ander paneel | Switch to other view (staged/unstaged changes). |
|
| `` <tab> `` | Ga naar een ander paneel | Switch to other view (staged/unstaged changes). |
|
||||||
| `` <esc> `` | Exit back to side panel | |
|
| `` <esc> `` | Exit back to side panel | |
|
||||||
|
| `` / `` | Start met zoeken | |
|
||||||
|
|
||||||
## Staging
|
## Staging
|
||||||
|
|
||||||
|
|
|
@ -97,6 +97,7 @@ Jeśli chcesz zamiast tego rozpocząć interaktywny rebase od wybranego commita,
|
||||||
|-----|--------|-------------|
|
|-----|--------|-------------|
|
||||||
| `` <tab> `` | Przełącz widok | Przełącz na inny widok (zatwierdzone/niezatwierdzone zmiany). |
|
| `` <tab> `` | Przełącz widok | Przełącz na inny widok (zatwierdzone/niezatwierdzone zmiany). |
|
||||||
| `` <esc> `` | Exit back to side panel | |
|
| `` <esc> `` | Exit back to side panel | |
|
||||||
|
| `` / `` | Szukaj w bieżącym widoku po tekście | |
|
||||||
|
|
||||||
## Drzewa pracy
|
## Drzewa pracy
|
||||||
|
|
||||||
|
@ -167,6 +168,7 @@ Jeśli chcesz zamiast tego rozpocząć interaktywny rebase od wybranego commita,
|
||||||
| `` mouse wheel up (fn+down) `` | Przewiń w górę | |
|
| `` mouse wheel up (fn+down) `` | Przewiń w górę | |
|
||||||
| `` <tab> `` | Przełącz widok | Przełącz na inny widok (zatwierdzone/niezatwierdzone zmiany). |
|
| `` <tab> `` | Przełącz widok | Przełącz na inny widok (zatwierdzone/niezatwierdzone zmiany). |
|
||||||
| `` <esc> `` | Exit back to side panel | |
|
| `` <esc> `` | Exit back to side panel | |
|
||||||
|
| `` / `` | Szukaj w bieżącym widoku po tekście | |
|
||||||
|
|
||||||
## Panel główny (scalanie)
|
## Panel główny (scalanie)
|
||||||
|
|
||||||
|
|
|
@ -232,6 +232,7 @@ If you would instead like to start an interactive rebase from the selected commi
|
||||||
| `` mouse wheel up (fn+down) `` | Rolar para cima | |
|
| `` mouse wheel up (fn+down) `` | Rolar para cima | |
|
||||||
| `` <tab> `` | Mudar de visão | Alternar para outra visão (staged/não processadas alterações). |
|
| `` <tab> `` | Mudar de visão | Alternar para outra visão (staged/não processadas alterações). |
|
||||||
| `` <esc> `` | Exit back to side panel | |
|
| `` <esc> `` | Exit back to side panel | |
|
||||||
|
| `` / `` | Search the current view by text | |
|
||||||
|
|
||||||
## Painel Principal (preparação)
|
## Painel Principal (preparação)
|
||||||
|
|
||||||
|
@ -324,6 +325,7 @@ Veja a documentação:
|
||||||
|-----|--------|-------------|
|
|-----|--------|-------------|
|
||||||
| `` <tab> `` | Mudar de visão | Alternar para outra visão (staged/não processadas alterações). |
|
| `` <tab> `` | Mudar de visão | Alternar para outra visão (staged/não processadas alterações). |
|
||||||
| `` <esc> `` | Exit back to side panel | |
|
| `` <esc> `` | Exit back to side panel | |
|
||||||
|
| `` / `` | Search the current view by text | |
|
||||||
|
|
||||||
## Stash
|
## Stash
|
||||||
|
|
||||||
|
|
|
@ -67,6 +67,7 @@ _Связки клавиш_
|
||||||
|-----|--------|-------------|
|
|-----|--------|-------------|
|
||||||
| `` <tab> `` | Переключиться на другую панель (проиндексированные/непроиндексированные изменения) | Switch to other view (staged/unstaged changes). |
|
| `` <tab> `` | Переключиться на другую панель (проиндексированные/непроиндексированные изменения) | Switch to other view (staged/unstaged changes). |
|
||||||
| `` <esc> `` | Exit back to side panel | |
|
| `` <esc> `` | Exit back to side panel | |
|
||||||
|
| `` / `` | Найти | |
|
||||||
|
|
||||||
## Главная панель (Индексирование)
|
## Главная панель (Индексирование)
|
||||||
|
|
||||||
|
@ -98,6 +99,7 @@ _Связки клавиш_
|
||||||
| `` mouse wheel up (fn+down) `` | Прокрутить вверх | |
|
| `` mouse wheel up (fn+down) `` | Прокрутить вверх | |
|
||||||
| `` <tab> `` | Переключиться на другую панель (проиндексированные/непроиндексированные изменения) | Switch to other view (staged/unstaged changes). |
|
| `` <tab> `` | Переключиться на другую панель (проиндексированные/непроиндексированные изменения) | Switch to other view (staged/unstaged changes). |
|
||||||
| `` <esc> `` | Exit back to side panel | |
|
| `` <esc> `` | Exit back to side panel | |
|
||||||
|
| `` / `` | Найти | |
|
||||||
|
|
||||||
## Главная панель (Слияние)
|
## Главная панель (Слияние)
|
||||||
|
|
||||||
|
|
|
@ -278,6 +278,7 @@ _图例:`<c-b>` 意味着ctrl+b, `<a-b>意味着Alt+b, `B` 意味着shift+b_
|
||||||
|-----|--------|-------------|
|
|-----|--------|-------------|
|
||||||
| `` <tab> `` | 切换到其他面板 | 切换到其他视图(已暂存/未暂存的变更) |
|
| `` <tab> `` | 切换到其他面板 | 切换到其他视图(已暂存/未暂存的变更) |
|
||||||
| `` <esc> `` | Exit back to side panel | |
|
| `` <esc> `` | Exit back to side panel | |
|
||||||
|
| `` / `` | 开始搜索 | |
|
||||||
|
|
||||||
## 正在合并
|
## 正在合并
|
||||||
|
|
||||||
|
@ -325,6 +326,7 @@ _图例:`<c-b>` 意味着ctrl+b, `<a-b>意味着Alt+b, `B` 意味着shift+b_
|
||||||
| `` mouse wheel up (fn+down) `` | 向上滚动 | |
|
| `` mouse wheel up (fn+down) `` | 向上滚动 | |
|
||||||
| `` <tab> `` | 切换到其他面板 | 切换到其他视图(已暂存/未暂存的变更) |
|
| `` <tab> `` | 切换到其他面板 | 切换到其他视图(已暂存/未暂存的变更) |
|
||||||
| `` <esc> `` | Exit back to side panel | |
|
| `` <esc> `` | Exit back to side panel | |
|
||||||
|
| `` / `` | 开始搜索 | |
|
||||||
|
|
||||||
## 状态
|
## 状态
|
||||||
|
|
||||||
|
|
|
@ -74,6 +74,7 @@ _說明:`<c-b>` 表示 Ctrl+B、`<a-b>` 表示 Alt+B,`B`表示 Shift+B
|
||||||
| `` mouse wheel up (fn+down) `` | 向上捲動 | |
|
| `` mouse wheel up (fn+down) `` | 向上捲動 | |
|
||||||
| `` <tab> `` | 切換至另一個面板 (已預存/未預存更改) | Switch to other view (staged/unstaged changes). |
|
| `` <tab> `` | 切換至另一個面板 (已預存/未預存更改) | Switch to other view (staged/unstaged changes). |
|
||||||
| `` <esc> `` | Exit back to side panel | |
|
| `` <esc> `` | Exit back to side panel | |
|
||||||
|
| `` / `` | 搜尋 | |
|
||||||
|
|
||||||
## 主面板(合併)
|
## 主面板(合併)
|
||||||
|
|
||||||
|
@ -347,6 +348,7 @@ If you would instead like to start an interactive rebase from the selected commi
|
||||||
|-----|--------|-------------|
|
|-----|--------|-------------|
|
||||||
| `` <tab> `` | 切換至另一個面板 (已預存/未預存更改) | Switch to other view (staged/unstaged changes). |
|
| `` <tab> `` | 切換至另一個面板 (已預存/未預存更改) | Switch to other view (staged/unstaged changes). |
|
||||||
| `` <esc> `` | Exit back to side panel | |
|
| `` <esc> `` | Exit back to side panel | |
|
||||||
|
| `` / `` | 搜尋 | |
|
||||||
|
|
||||||
## 狀態
|
## 狀態
|
||||||
|
|
||||||
|
|
|
@ -7,12 +7,16 @@ import (
|
||||||
|
|
||||||
type MainContext struct {
|
type MainContext struct {
|
||||||
*SimpleContext
|
*SimpleContext
|
||||||
|
*SearchTrait
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var _ types.ISearchableContext = (*MainContext)(nil)
|
||||||
|
|
||||||
func NewMainContext(
|
func NewMainContext(
|
||||||
view *gocui.View,
|
view *gocui.View,
|
||||||
windowName string,
|
windowName string,
|
||||||
key types.ContextKey,
|
key types.ContextKey,
|
||||||
|
c *ContextCommon,
|
||||||
) *MainContext {
|
) *MainContext {
|
||||||
ctx := &MainContext{
|
ctx := &MainContext{
|
||||||
SimpleContext: NewSimpleContext(
|
SimpleContext: NewSimpleContext(
|
||||||
|
@ -24,7 +28,14 @@ func NewMainContext(
|
||||||
Focusable: true,
|
Focusable: true,
|
||||||
HighlightOnFocus: false,
|
HighlightOnFocus: false,
|
||||||
})),
|
})),
|
||||||
|
SearchTrait: NewSearchTrait(c),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ctx.GetView().SetOnSelectItem(ctx.SearchTrait.onSelectItemWrapper(func(int) error { return nil }))
|
||||||
|
|
||||||
return ctx
|
return ctx
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (self *MainContext) ModelSearchResults(searchStr string, caseSensitive bool) []gocui.SearchPosition {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
|
@ -39,8 +39,8 @@ func NewContextTree(c *ContextCommon) *ContextTree {
|
||||||
Tags: NewTagsContext(c),
|
Tags: NewTagsContext(c),
|
||||||
Stash: NewStashContext(c),
|
Stash: NewStashContext(c),
|
||||||
Suggestions: NewSuggestionsContext(c),
|
Suggestions: NewSuggestionsContext(c),
|
||||||
Normal: NewMainContext(c.Views().Main, "main", NORMAL_MAIN_CONTEXT_KEY),
|
Normal: NewMainContext(c.Views().Main, "main", NORMAL_MAIN_CONTEXT_KEY, c),
|
||||||
NormalSecondary: NewMainContext(c.Views().Secondary, "secondary", NORMAL_SECONDARY_CONTEXT_KEY),
|
NormalSecondary: NewMainContext(c.Views().Secondary, "secondary", NORMAL_SECONDARY_CONTEXT_KEY, c),
|
||||||
Staging: NewPatchExplorerContext(
|
Staging: NewPatchExplorerContext(
|
||||||
c.Views().Staging,
|
c.Views().Staging,
|
||||||
"main",
|
"main",
|
||||||
|
|
|
@ -44,6 +44,9 @@ func (self *SwitchToFocusedMainViewController) Context() types.Context {
|
||||||
func (self *SwitchToFocusedMainViewController) handleFocusMainView() error {
|
func (self *SwitchToFocusedMainViewController) handleFocusMainView() error {
|
||||||
mainViewContext := self.c.Helpers().Window.GetContextForWindow("main")
|
mainViewContext := self.c.Helpers().Window.GetContextForWindow("main")
|
||||||
mainViewContext.SetParentContext(self.context)
|
mainViewContext.SetParentContext(self.context)
|
||||||
|
if context, ok := mainViewContext.(types.ISearchableContext); ok {
|
||||||
|
context.ClearSearchString()
|
||||||
|
}
|
||||||
self.c.Context().Push(mainViewContext, types.OnFocusOpts{})
|
self.c.Context().Push(mainViewContext, types.OnFocusOpts{})
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue