Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
fzf
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KMSCAKKSCFKA AKFACAMADCAS
fzf
Commits
340af463
Unverified
Commit
340af463
authored
8 years ago
by
Junegunn Choi
Browse files
Options
Downloads
Patches
Plain Diff
Add --min-height option for percent --height
parent
78a3f819
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
man/man1/fzf.1
+4
-0
4 additions, 0 deletions
man/man1/fzf.1
src/options.go
+9
-1
9 additions, 1 deletion
src/options.go
src/terminal.go
+5
-4
5 additions, 4 deletions
src/terminal.go
with
18 additions
and
5 deletions
man/man1/fzf.1
+
4
−
0
View file @
340af463
...
...
@@ -138,6 +138,10 @@ Label characters for \fBjump\fR and \fBjump-accept\fR
Display fzf window below the cursor with the given height instead of using
fullscreen.
.TP
.BI "--min-height=" "HEIGHT"
Minimum height when \fB--height\fR is given in percent (default: 10).
Ignored when \fB--height\fR is not specified.
.TP
.B "--reverse"
Reverse orientation
.TP
...
...
This diff is collapsed.
Click to expand it.
src/options.go
+
9
−
1
View file @
340af463
...
...
@@ -50,6 +50,8 @@ const usage = `usage: fzf [options]
Layout
--height=HEIGHT[%] Display fzf window below the cursor with the given
height instead of using fullscreen
--min-height=HEIGHT Minimum height when --height is given in percent
(default: 10)
--reverse Reverse orientation
--margin=MARGIN Screen margin (TRBL / TB,RL / T,RL,B / T,R,B,L)
--inline-info Display finder info inline with the query
...
...
@@ -153,6 +155,7 @@ type Options struct {
Black
bool
Bold
bool
Height
sizeSpec
MinHeight
int
Reverse
bool
Cycle
bool
Hscroll
bool
...
...
@@ -200,6 +203,7 @@ func defaultOptions() *Options {
Theme
:
tui
.
EmptyTheme
(),
Black
:
false
,
Bold
:
true
,
MinHeight
:
10
,
Reverse
:
false
,
Cycle
:
false
,
Hscroll
:
true
,
...
...
@@ -1023,7 +1027,9 @@ func parseOptions(opts *Options, allArgs []string) {
parsePreviewWindow
(
&
opts
.
Preview
,
nextString
(
allArgs
,
&
i
,
"preview window layout required: [up|down|left|right][:SIZE[%]][:wrap][:hidden]"
))
case
"--height"
:
opts
.
Height
=
parseHeight
(
nextString
(
allArgs
,
&
i
,
"height required: [HEIGHT[%]]"
))
opts
.
Height
=
parseHeight
(
nextString
(
allArgs
,
&
i
,
"height required: HEIGHT[%]"
))
case
"--min-height"
:
opts
.
MinHeight
=
nextInt
(
allArgs
,
&
i
,
"height required: HEIGHT"
)
case
"--no-height"
:
opts
.
Height
=
sizeSpec
{}
case
"--no-margin"
:
...
...
@@ -1054,6 +1060,8 @@ func parseOptions(opts *Options, allArgs []string) {
opts
.
Sort
=
1
// Don't care
}
else
if
match
,
value
:=
optString
(
arg
,
"--height="
);
match
{
opts
.
Height
=
parseHeight
(
value
)
}
else
if
match
,
value
:=
optString
(
arg
,
"--min-height="
);
match
{
opts
.
MinHeight
=
atoi
(
value
)
}
else
if
match
,
value
:=
optString
(
arg
,
"--toggle-sort="
);
match
{
parseToggleSort
(
opts
.
Keymap
,
value
)
}
else
if
match
,
value
:=
optString
(
arg
,
"--expect="
);
match
{
...
...
This diff is collapsed.
Click to expand it.
src/terminal.go
+
5
−
4
View file @
340af463
...
...
@@ -275,14 +275,15 @@ func NewTerminal(opts *Options, eventBox *util.EventBox) *Terminal {
maxHeightFunc
:=
func
(
termHeight
int
)
int
{
var
maxHeight
int
if
opts
.
Height
.
percent
{
maxHeight
=
int
(
opts
.
Height
.
size
*
float64
(
termHeight
)
/
100.0
)
maxHeight
=
util
.
Min
(
termHeight
,
util
.
Max
(
int
(
opts
.
Height
.
size
*
float64
(
termHeight
)
/
100.0
),
opts
.
MinHeight
))
}
else
{
maxHeight
=
util
.
Min
(
int
(
opts
.
Height
.
size
)
,
termHeight
)
maxHeight
=
util
.
Min
(
termHeight
,
int
(
opts
.
Height
.
size
))
}
if
opts
.
InlineInfo
{
return
util
.
Max
(
maxHeight
,
3
)
return
util
.
Max
(
maxHeight
,
minHeight
-
1
)
}
return
util
.
Max
(
maxHeight
,
4
)
return
util
.
Max
(
maxHeight
,
minHeight
)
}
renderer
=
tui
.
NewLightRenderer
(
opts
.
Theme
,
opts
.
Black
,
opts
.
Mouse
,
opts
.
Tabstop
,
maxHeightFunc
)
}
else
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment