Add --cursor-line to highlight the whole current line
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Similar to 'set cursorline' of Vim.
authored by Junegunn Choi · committed by Junegunn Choi · parent 9e47805 · Browse files · 3 files·+23 added−3 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
3 files+23 added−3 removed
- other:+23 added−3 removed
Provenance
- Commit
c5fb0c4- Tree
fa27a1e- Author
Junegunn Choi <junegunn.c@gmail.com>- Committer
Junegunn Choi <junegunn.c@gmail.com>- Parent
9e47805
3 files changed+23 added−3 removed
modified:man/man1/fzf.1+3 added
532 unmodified lines533 --color='hl:#719872,fg:#D9D9D9,header:#719872,fg+:#D9D9D9' \\534 --color='pointer:#E12672,marker:#E17899,prompt:#98BEDE,hl+:#98BC99'\fR535 .RE536 .TP537+.B "--cursor-line"538+Highlight the whole current line539+.TP540 .B "--no-bold"541 Do not use bold text542 .TP543 .B "--black"1029 unmodified linesmodified:src/options.go+6 added
90 unmodified lines91 Display92 --ansi Enable processing of ANSI color codes93 --tabstop=SPACES Number of spaces for a tab character (default: 8)94 --color=COLSPEC Base scheme (dark|light|16|bw) and/or custom colors95+ --cursor-line Highlight the whole current line96 --no-bold Do not use bold text97 98 History99 --history=FILE History file222 unmodified lines322 Height heightSpec323 MinHeight int324 Layout layoutType325 Cycle bool326+ CursorLine bool327 KeepRight bool328 Hscroll bool329 HscrollOff int330 ScrollOff int1618 unmodified lines1949 case "--no-reverse":1950 opts.Layout = layoutDefault1951 case "--cycle":1952 opts.Cycle = true1953+ case "--cursor-line":1954+ opts.CursorLine = true1955+ case "--no-cursor-line":1956+ opts.CursorLine = false1957 case "--no-cycle":1958 opts.Cycle = false1959 case "--keep-right":1960 opts.KeepRight = true674 unmodified linesmodified:src/terminal.go+14 added-3 removed
227 unmodified lines228 pressed string229 printQuery bool230 history *History231 cycle bool232+ cursorLine bool233 headerVisible bool234 headerFirst bool235 headerLines int236 header []string517 unmodified lines754 cleanExit: opts.ClearOnExit,755 executor: executor,756 paused: opts.Phony,757 cycle: opts.Cycle,758+ cursorLine: opts.CursorLine,759 headerVisible: true,760 headerFirst: opts.HeaderFirst,761 headerLines: opts.HeaderLines,762 header: []string{},1150 unmodified lines1913 t.window.Print(t.markerEmpty)1914 }1915 newLine.width = t.printHighlighted(result, tui.ColNormal, tui.ColMatch, false, true)1916 }1917+ if current && t.cursorLine {1918+ maxWidth := t.window.Width() - (t.pointerLen + t.markerLen + 1)1919+ fillSpaces := maxWidth - newLine.width1920+ newLine.width = maxWidth1921+ if fillSpaces > 0 {1922+ t.window.CPrint(tui.ColCurrent, strings.Repeat(" ", fillSpaces))1923+ }1924+ } else {1915- fillSpaces := prevLine.width - newLine.width1916- if fillSpaces > 0 {1917- t.window.Print(strings.Repeat(" ", fillSpaces))1925+ fillSpaces := prevLine.width - newLine.width1926+ if fillSpaces > 0 {1927+ t.window.Print(strings.Repeat(" ", fillSpaces))1928+ }1929 }1930 printBar()1931 t.prevLines[i] = newLine1932 }2483 unmodified lines