Skip to content

Commit 1a940d7

Browse files
authored
Merge pull request #815 from yorukot/develop
Write prompt tutorial, rename prompt mode to spf mode , add develop branch in github workflow, show_panel_footer_info flag
2 parents 0c15880 + 4f11804 commit 1a940d7

File tree

14 files changed

+72
-27
lines changed

14 files changed

+72
-27
lines changed

.github/workflows/superfile-build-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: Go
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches: [ main, develop ]
66
pull_request:
7-
branches: [ main ]
7+
branches: [ main, develop ]
88

99
jobs:
1010

asset/prompt_shell_mode.png

78.9 KB
Loading

asset/prompt_spf_mode.png

110 KB
Loading

src/internal/common/config_type.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ type ConfigType struct {
7171
CdOnQuit bool `toml:"cd_on_quit" comment:"\nCd on quit (For more details, please check out https://superfile.netlify.app/configure/superfile-config/#cd_on_quit)"`
7272
DefaultOpenFilePreview bool `toml:"default_open_file_preview" comment:"\nWhether to open file preview automatically every time superfile is opened."`
7373
ShowImagePreview bool `toml:"show_image_preview" comment:"\nWhether to show image preview."`
74+
ShowPanelFooterInfo bool `toml:"show_panel_footer_info" comment:"\nWhether to show additional footer info for file panel."`
7475
DefaultDirectory string `toml:"default_directory" comment:"\nThe path of the first file panel when superfile is opened."`
7576
FileSizeUseSI bool `toml:"file_size_use_si" comment:"\nDisplay file sizes using powers of 1000 (kB, MB, GB) instead of powers of 1024 (KiB, MiB, GiB)."`
7677
DefaultSortType int `toml:"default_sort_type" comment:"\nDefault sort type (0: Name, 1: Size, 2: Date Modified)."`

src/internal/model_render.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,14 @@ func (panel *filePanel) Render(mainPanelHeight int, filePanelWidth int, focussed
122122
}
123123
cursorNumberString := fmt.Sprintf("%d/%d", cursorNumber, len(panel.element))
124124

125-
r.SetBorderInfoItems(sortTypeString, panelModeString, cursorNumberString)
126-
if r.AreInfoItemsTruncated() {
127-
// Use smaller values
128-
r.SetBorderInfoItems(sortTypeStringSmall, panelModeStringSmall, cursorNumberString)
125+
if common.Config.ShowPanelFooterInfo {
126+
r.SetBorderInfoItems(sortTypeString, panelModeString, cursorNumberString)
127+
if r.AreInfoItemsTruncated() {
128+
// Use smaller values
129+
r.SetBorderInfoItems(sortTypeStringSmall, panelModeStringSmall, cursorNumberString)
130+
}
131+
} else {
132+
r.SetBorderInfoItems(cursorNumberString)
129133
}
130134

131135
if len(panel.element) == 0 {

src/internal/ui/prompt/consts.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const (
1919
failureMessagePrefix = "Error"
2020

2121
shellModeString = "(Shell Mode)"
22-
spfModeString = "(Prompt Mode)"
22+
spfModeString = "(SPF Mode)"
2323

2424
// Error message string
2525
tokenizationError = "Failed during tokenization"

src/internal/ui/prompt/model.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ func (m *Model) HandleSPFActionResults(success bool, msg string) {
123123

124124
func (m *Model) Render() string {
125125
r := ui.PromptRenderer(m.maxHeight, m.width)
126-
r.SetBorderTitle(m.headline + modeString(m.shellMode))
126+
r.SetBorderTitle(m.headline + " " + modeString(m.shellMode))
127127
r.AddLines(" " + m.textInput.View())
128128

129129
if !m.shellMode {
@@ -148,7 +148,7 @@ func (m *Model) Render() string {
148148
}
149149
} else if m.textInput.Value() == "" {
150150
r.AddSection()
151-
r.AddLines(" '" + m.spfPromptHotkey + "' - Get into SPF Prompt mode")
151+
r.AddLines(" '" + m.spfPromptHotkey + "' - Get into SPF mode")
152152
}
153153

154154
if m.resultMsg != "" {

src/internal/ui/prompt/model_test.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -239,19 +239,19 @@ func TestModel_Render(t *testing.T) {
239239
m.setShellMode(true)
240240
res := ansi.Strip(m.Render())
241241
exp := "" +
242-
"╭─┤ " + icon.Terminal + " Superfile Prompt(Shell Mode) ├──╮\n" +
243-
// 000123--------4------------56789012345678901234567890123456789
242+
"╭─┤ " + icon.Terminal + " Superfile Prompt (Shell Mode) ├──╮\n" +
243+
// 23--------4------------56789012345678901234567890123456789
244244
"│ : │\n" +
245-
// 000123456789012345678901234567890123456789
245+
// 23456789012345678901234567890123456789
246246
"├──────────────────────────────────────┤\n" +
247-
"│ '>' - Get into SPF Prompt mode │\n" +
247+
"│ '>' - Get into SPF mode \n" +
248248
"╰──────────────────────────────────────╯"
249249
assert.Equal(t, exp, res)
250250
m.setShellMode(false)
251251
res = ansi.Strip(m.Render())
252252
exp = "" +
253-
"╭─┤ " + icon.Terminal + " Superfile Prompt(Prompt Mode) ├──╮\n" +
254-
// 000123--------4------------56789012345678901234567890123456789
253+
"╭─┤ " + icon.Terminal + " Superfile Prompt (SPF Mode) ├────╮\n" +
254+
// 23--------4------------56789012345678901234567890123456789
255255
"│ > │\n" +
256256
"├──────────────────────────────────────┤\n" +
257257
"│ ':' - Get into Shell mode │\n" +
@@ -292,25 +292,25 @@ func TestModel_Render(t *testing.T) {
292292
m.HandleShellCommandResults(0, "")
293293
res := ansi.Strip(m.Render())
294294
exp := "" +
295-
"╭─┤ " + icon.Terminal + " Superfile Prompt(Shell Mode) ├────────────╮\n" +
296-
// 000123--------4------------567890123456789012345678901234567890123456789
295+
"╭─┤ " + icon.Terminal + " Superfile Prompt (Shell Mode) ├────────────╮\n" +
296+
// 23--------4------------567890123456789012345678901234567890123456789
297297
"│ : │\n" +
298-
// 0001234567890123456789012345678901234567890123456789
298+
// 234567890123456789012345678901234567890123456789
299299
"├────────────────────────────────────────────────┤\n" +
300-
"│ '>' - Get into SPF Prompt mode │\n" +
300+
"│ '>' - Get into SPF mode \n" +
301301
"├────────────────────────────────────────────────┤\n" +
302302
"│ Success : Command exited with status 0 │\n" +
303303
"╰────────────────────────────────────────────────╯"
304304
assert.Equal(t, exp, res)
305305
m.HandleShellCommandResults(1, "")
306306
res = ansi.Strip(m.Render())
307307
exp = "" +
308-
"╭─┤ " + icon.Terminal + " Superfile Prompt(Shell Mode) ├────────────╮\n" +
309-
// 000123--------4------------567890123456789012345678901234567890123456789
308+
"╭─┤ " + icon.Terminal + " Superfile Prompt (Shell Mode) ├────────────╮\n" +
309+
// 23--------4------------567890123456789012345678901234567890123456789
310310
"│ : │\n" +
311-
// 0001234567890123456789012345678901234567890123456789
311+
// 234567890123456789012345678901234567890123456789
312312
"├────────────────────────────────────────────────┤\n" +
313-
"│ '>' - Get into SPF Prompt mode │\n" +
313+
"│ '>' - Get into SPF mode \n" +
314314
"├────────────────────────────────────────────────┤\n" +
315315
"│ Error : Command exited with status 1 │\n" +
316316
"╰────────────────────────────────────────────────╯"

src/internal/ui/prompt/utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func getPromptAction(shellMode bool, value string, cwdLocation string) (common.M
5757

5858
default:
5959
return noAction, invalidCmdError{
60-
uiMsg: "Invalid spf prompt command : " + promptArgs[0],
60+
uiMsg: "Invalid spf command : " + promptArgs[0],
6161
}
6262
}
6363
}

src/internal/ui/prompt/utils_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func TestModel_getPromptAction(t *testing.T) {
6868
shellMode: false,
6969
expectecAction: common.NoAction{},
7070
expectedErr: true,
71-
expectedErrMsg: "Invalid spf prompt command : abcd",
71+
expectedErrMsg: "Invalid spf command : abcd",
7272
},
7373
{
7474
name: "Correct split command",

0 commit comments

Comments
 (0)