Skip to content

Commit 95b2153

Browse files
committed
Make the main view searchable
1 parent c240c0c commit 95b2153

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
@@ -210,6 +210,7 @@ If you would instead like to start an interactive rebase from the selected commi
210210
| `` mouse wheel up (fn+down) `` | Scroll up | |
211211
| `` <tab> `` | Switch view | Switch to other view (staged/unstaged changes). |
212212
| `` <esc> `` | Exit back to side panel | |
213+
| `` / `` | Search the current view by text | |
213214

214215
## Main panel (patch building)
215216

@@ -311,6 +312,7 @@ If you would instead like to start an interactive rebase from the selected commi
311312
|-----|--------|-------------|
312313
| `` <tab> `` | Switch view | Switch to other view (staged/unstaged changes). |
313314
| `` <esc> `` | Exit back to side panel | |
315+
| `` / `` | Search the current view by text | |
314316

315317
## Stash
316318

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

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

297299
## メインパネル (Patch Building)
298300

docs/keybindings/Keybindings_ko.md

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

8081
## Stash
8182

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

156158
## 메인 패널 (Patch Building)
157159

docs/keybindings/Keybindings_nl.md

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

222223
## Patch bouwen
223224

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

293295
## Staging
294296

docs/keybindings/Keybindings_pl.md

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

101102
## Drzewa pracy
102103

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

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

docs/keybindings/Keybindings_pt.md

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

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

@@ -324,6 +325,7 @@ Veja a documentação:
324325
|-----|--------|-------------|
325326
| `` <tab> `` | Mudar de visão | Alternar para outra visão (staged/não processadas alterações). |
326327
| `` <esc> `` | Exit back to side panel | |
328+
| `` / `` | Search the current view by text | |
327329

328330
## Stash
329331

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
@@ -278,6 +278,7 @@ _图例:`<c-b>` 意味着ctrl+b, `<a-b>意味着Alt+b, `B` 意味着shift+b_
278278
|-----|--------|-------------|
279279
| `` <tab> `` | 切换到其他面板 | 切换到其他视图(已暂存/未暂存的变更) |
280280
| `` <esc> `` | Exit back to side panel | |
281+
| `` / `` | 开始搜索 | |
281282

282283
## 正在合并
283284

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

329331
## 状态
330332

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

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

351353
## 狀態
352354

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)