Skip to content

Commit f4005dd

Browse files
committed
Make the main view searchable
1 parent ef1ccd7 commit f4005dd

12 files changed

+34
-2
lines changed

docs/keybindings/Keybindings_en.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ If you would instead like to start an interactive rebase from the selected commi
209209
| `` mouse wheel up (fn+down) `` | Scroll up | |
210210
| `` <tab> `` | Switch view | Switch to other view (staged/unstaged changes). |
211211
| `` <esc> `` | Exit back to side panel | |
212+
| `` / `` | Search the current view by text | |
212213

213214
## Main panel (patch building)
214215

@@ -309,6 +310,7 @@ If you would instead like to start an interactive rebase from the selected commi
309310
|-----|--------|-------------|
310311
| `` <tab> `` | Switch view | Switch to other view (staged/unstaged changes). |
311312
| `` <esc> `` | Exit back to side panel | |
313+
| `` / `` | Search the current view by text | |
312314

313315
## Stash
314316

docs/keybindings/Keybindings_ja.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
5757
|-----|--------|-------------|
5858
| `` <tab> `` | パネルを切り替え | Switch to other view (staged/unstaged changes). |
5959
| `` <esc> `` | Exit back to side panel | |
60+
| `` / `` | 検索を開始 | |
6061

6162
## Stash
6263

@@ -291,6 +292,7 @@ If you would instead like to start an interactive rebase from the selected commi
291292
| `` mouse wheel up (fn+down) `` | 上にスクロール | |
292293
| `` <tab> `` | パネルを切り替え | Switch to other view (staged/unstaged changes). |
293294
| `` <esc> `` | Exit back to side panel | |
295+
| `` / `` | 検索を開始 | |
294296

295297
## メインパネル (Patch Building)
296298

docs/keybindings/Keybindings_ko.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
7575
|-----|--------|-------------|
7676
| `` <tab> `` | 패널 전환 | Switch to other view (staged/unstaged changes). |
7777
| `` <esc> `` | Exit back to side panel | |
78+
| `` / `` | 검색 시작 | |
7879

7980
## Stash
8081

@@ -150,6 +151,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
150151
| `` mouse wheel up (fn+down) `` | 위로 스크롤 | |
151152
| `` <tab> `` | 패널 전환 | Switch to other view (staged/unstaged changes). |
152153
| `` <esc> `` | Exit back to side panel | |
154+
| `` / `` | 검색 시작 | |
153155

154156
## 메인 패널 (Patch Building)
155157

docs/keybindings/Keybindings_nl.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ If you would instead like to start an interactive rebase from the selected commi
217217
| `` mouse wheel up (fn+down) `` | Scroll omhoog | |
218218
| `` <tab> `` | Ga naar een ander paneel | Switch to other view (staged/unstaged changes). |
219219
| `` <esc> `` | Exit back to side panel | |
220+
| `` / `` | Start met zoeken | |
220221

221222
## Patch bouwen
222223

@@ -287,6 +288,7 @@ If you would instead like to start an interactive rebase from the selected commi
287288
|-----|--------|-------------|
288289
| `` <tab> `` | Ga naar een ander paneel | Switch to other view (staged/unstaged changes). |
289290
| `` <esc> `` | Exit back to side panel | |
291+
| `` / `` | Start met zoeken | |
290292

291293
## Staging
292294

docs/keybindings/Keybindings_pl.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ Jeśli chcesz zamiast tego rozpocząć interaktywny rebase od wybranego commita,
9696
|-----|--------|-------------|
9797
| `` <tab> `` | Przełącz widok | Przełącz na inny widok (zatwierdzone/niezatwierdzone zmiany). |
9898
| `` <esc> `` | Exit back to side panel | |
99+
| `` / `` | Szukaj w bieżącym widoku po tekście | |
99100

100101
## Drzewa pracy
101102

@@ -166,6 +167,7 @@ Jeśli chcesz zamiast tego rozpocząć interaktywny rebase od wybranego commita,
166167
| `` mouse wheel up (fn+down) `` | Przewiń w górę | |
167168
| `` <tab> `` | Przełącz widok | Przełącz na inny widok (zatwierdzone/niezatwierdzone zmiany). |
168169
| `` <esc> `` | Exit back to side panel | |
170+
| `` / `` | Szukaj w bieżącym widoku po tekście | |
169171

170172
## Panel główny (scalanie)
171173

docs/keybindings/Keybindings_pt.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ If you would instead like to start an interactive rebase from the selected commi
231231
| `` mouse wheel up (fn+down) `` | Scroll up | |
232232
| `` <tab> `` | Mudar de visão | Alternar para outra visão (staged/não processadas alterações). |
233233
| `` <esc> `` | Exit back to side panel | |
234+
| `` / `` | Search the current view by text | |
234235

235236
## Painel Principal (preparação)
236237

@@ -322,6 +323,7 @@ Veja a documentação:
322323
|-----|--------|-------------|
323324
| `` <tab> `` | Mudar de visão | Alternar para outra visão (staged/não processadas alterações). |
324325
| `` <esc> `` | Exit back to side panel | |
326+
| `` / `` | Search the current view by text | |
325327

326328
## Stash
327329

docs/keybindings/Keybindings_ru.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ _Связки клавиш_
6767
|-----|--------|-------------|
6868
| `` <tab> `` | Переключиться на другую панель (проиндексированные/непроиндексированные изменения) | Switch to other view (staged/unstaged changes). |
6969
| `` <esc> `` | Exit back to side panel | |
70+
| `` / `` | Найти | |
7071

7172
## Главная панель (Индексирование)
7273

@@ -98,6 +99,7 @@ _Связки клавиш_
9899
| `` mouse wheel up (fn+down) `` | Прокрутить вверх | |
99100
| `` <tab> `` | Переключиться на другую панель (проиндексированные/непроиндексированные изменения) | Switch to other view (staged/unstaged changes). |
100101
| `` <esc> `` | Exit back to side panel | |
102+
| `` / `` | Найти | |
101103

102104
## Главная панель (Слияние)
103105

docs/keybindings/Keybindings_zh-CN.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ _图例:`<c-b>` 意味着ctrl+b, `<a-b>意味着Alt+b, `B` 意味着shift+b_
275275
|-----|--------|-------------|
276276
| `` <tab> `` | 切换到其他面板 | 切换到其他视图(已暂存/未暂存的变更) |
277277
| `` <esc> `` | Exit back to side panel | |
278+
| `` / `` | 开始搜索 | |
278279

279280
## 正在合并
280281

@@ -322,6 +323,7 @@ _图例:`<c-b>` 意味着ctrl+b, `<a-b>意味着Alt+b, `B` 意味着shift+b_
322323
| `` mouse wheel up (fn+down) `` | 向上滚动 | |
323324
| `` <tab> `` | 切换到其他面板 | 切换到其他视图(已暂存/未暂存的变更) |
324325
| `` <esc> `` | Exit back to side panel | |
326+
| `` / `` | 开始搜索 | |
325327

326328
## 状态
327329

docs/keybindings/Keybindings_zh-TW.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ _說明:`<c-b>` 表示 Ctrl+B、`<a-b>` 表示 Alt+B,`B`表示 Shift+B
7474
| `` mouse wheel up (fn+down) `` | 向上捲動 | |
7575
| `` <tab> `` | 切換至另一個面板 (已預存/未預存更改) | Switch to other view (staged/unstaged changes). |
7676
| `` <esc> `` | Exit back to side panel | |
77+
| `` / `` | 搜尋 | |
7778

7879
## 主面板(合併)
7980

@@ -344,6 +345,7 @@ If you would instead like to start an interactive rebase from the selected commi
344345
|-----|--------|-------------|
345346
| `` <tab> `` | 切換至另一個面板 (已預存/未預存更改) | Switch to other view (staged/unstaged changes). |
346347
| `` <esc> `` | Exit back to side panel | |
348+
| `` / `` | 搜尋 | |
347349

348350
## 狀態
349351

pkg/gui/context/main_context.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,16 @@ import (
77

88
type MainContext struct {
99
*SimpleContext
10+
*SearchTrait
1011
}
1112

13+
var _ types.ISearchableContext = (*MainContext)(nil)
14+
1215
func NewMainContext(
1316
view *gocui.View,
1417
windowName string,
1518
key types.ContextKey,
19+
c *ContextCommon,
1620
) *MainContext {
1721
ctx := &MainContext{
1822
SimpleContext: NewSimpleContext(
@@ -24,7 +28,14 @@ func NewMainContext(
2428
Focusable: true,
2529
HighlightOnFocus: false,
2630
})),
31+
SearchTrait: NewSearchTrait(c),
2732
}
2833

34+
ctx.GetView().SetOnSelectItem(ctx.SearchTrait.onSelectItemWrapper(func(int) error { return nil }))
35+
2936
return ctx
3037
}
38+
39+
func (self *MainContext) ModelSearchResults(searchStr string, caseSensitive bool) []gocui.SearchPosition {
40+
return nil
41+
}

0 commit comments

Comments
 (0)