mirror of
https://github.com/junegunn/fzf.git
synced 2026-12-01 10:36:06 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d6d4c359bd |
No files matched your search
@@ -33,12 +33,12 @@ jobs:
|
|||||||
|
|
||||||
# Initializes the CodeQL tools for scanning.
|
# Initializes the CodeQL tools for scanning.
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@v4.39.4
|
uses: github/codeql-action/init@v4.39.5
|
||||||
with:
|
with:
|
||||||
languages: ${{ matrix.language }}
|
languages: ${{ matrix.language }}
|
||||||
|
|
||||||
- name: Autobuild
|
- name: Autobuild
|
||||||
uses: github/codeql-action/autobuild@v4.39.4
|
uses: github/codeql-action/autobuild@v4.39.5
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
- name: Perform CodeQL Analysis
|
||||||
uses: github/codeql-action/analyze@v4.39.4
|
uses: github/codeql-action/analyze@v4.39.5
|
||||||
@@ -8,7 +8,6 @@ CHANGELOG
|
|||||||
- [vim] Fixed the popup window being cropped on Windows when the first redraw after starting the terminal is delayed (#4957) (@FanXiangTM)
|
- [vim] Fixed the popup window being cropped on Windows when the first redraw after starting the terminal is delayed (#4957) (@FanXiangTM)
|
||||||
- Fixed a character under the cursor being erased on Terminal.app when fzf starts (#4963) (@nhooyr)
|
- Fixed a character under the cursor being erased on Terminal.app when fzf starts (#4963) (@nhooyr)
|
||||||
- [bash] Fixed CTRL-R showing the oldest history entry with an extra empty line and not removing it as a duplicate (#4962) (@GladTechInfo)
|
- [bash] Fixed CTRL-R showing the oldest history entry with an extra empty line and not removing it as a duplicate (#4962) (@GladTechInfo)
|
||||||
- Fixed Kitty image preview showing nothing in a tmux popup when the image command is wrapped for tmux (#4972) (@jipeng6036-del)
|
|
||||||
|
|
||||||
0.75.0
|
0.75.0
|
||||||
------
|
------
|
||||||
|
|||||||
+2
-7
@@ -5097,13 +5097,8 @@ Loop:
|
|||||||
for idx, passThrough := range passThroughs {
|
for idx, passThrough := range passThroughs {
|
||||||
// Handling Sixel/iTerm image
|
// Handling Sixel/iTerm image
|
||||||
requiredLines := 0
|
requiredLines := 0
|
||||||
imageSequence := passThrough
|
isSixel := strings.HasPrefix(passThrough, "\x1bP")
|
||||||
// A tmux wrapper doubles the ESC that starts the inner sequence.
|
isItermImage := strings.HasPrefix(passThrough, "\x1b]1337;")
|
||||||
if inner, wrapped := strings.CutPrefix(passThrough, "\x1bPtmux;\x1b"); wrapped {
|
|
||||||
imageSequence = inner
|
|
||||||
}
|
|
||||||
isSixel := sixelBeginRegex.MatchString(imageSequence)
|
|
||||||
isItermImage := strings.HasPrefix(imageSequence, "\x1b]1337;")
|
|
||||||
isImage := isSixel || isItermImage
|
isImage := isSixel || isItermImage
|
||||||
if isImage {
|
if isImage {
|
||||||
t.previewed.wipe = true
|
t.previewed.wipe = true
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"text/template"
|
"text/template"
|
||||||
|
|
||||||
"github.com/junegunn/fzf/src/tui"
|
|
||||||
"github.com/junegunn/fzf/src/util"
|
"github.com/junegunn/fzf/src/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -585,75 +584,6 @@ func TestWrapPassThrough(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type previewTextWindow struct {
|
|
||||||
tui.Window
|
|
||||||
line, column int
|
|
||||||
text strings.Builder
|
|
||||||
}
|
|
||||||
|
|
||||||
func (*previewTextWindow) Width() int { return 40 }
|
|
||||||
func (w *previewTextWindow) X() int { return w.column }
|
|
||||||
func (w *previewTextWindow) Y() int { return w.line }
|
|
||||||
|
|
||||||
func (w *previewTextWindow) Move(y, x int) {
|
|
||||||
w.line, w.column = y, x
|
|
||||||
}
|
|
||||||
|
|
||||||
func (w *previewTextWindow) MoveAndClear(y, x int) {
|
|
||||||
w.Move(y, x)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (w *previewTextWindow) Fill(text string) tui.FillReturn {
|
|
||||||
if text == "\n" {
|
|
||||||
w.Move(w.line+1, 0)
|
|
||||||
} else {
|
|
||||||
w.text.WriteString(text)
|
|
||||||
}
|
|
||||||
return tui.FillContinue
|
|
||||||
}
|
|
||||||
|
|
||||||
func (w *previewTextWindow) CFill(_, _, _ tui.Color, _ tui.Attr, text string) tui.FillReturn {
|
|
||||||
return w.Fill(text)
|
|
||||||
}
|
|
||||||
|
|
||||||
type previewTextRenderer struct {
|
|
||||||
tui.Renderer
|
|
||||||
sequences []string
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *previewTextRenderer) PassThrough(seq string) {
|
|
||||||
r.sequences = append(r.sequences, seq)
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestPreviewWrappedImageWithUnknownPixelHeight(t *testing.T) {
|
|
||||||
for _, tc := range []struct {
|
|
||||||
name, sequence string
|
|
||||||
reserveWindow bool
|
|
||||||
}{
|
|
||||||
{"Kitty placeholder", "\x1bPtmux;\x1b\x1b_Ga=T,U=1,f=32;AAAA\x1b\x1b\\\x1b\\", false},
|
|
||||||
{"Sixel", "\x1bP0;1;0q#0~~\x1b\\", true},
|
|
||||||
{"wrapped Sixel", "\x1bPtmux;\x1b\x1bP0;1;0q#0~~\x1b\x1b\\\x1b\\", true},
|
|
||||||
{"iTerm", "\x1b]1337;File=inline=1:AAAA\a", true},
|
|
||||||
{"wrapped iTerm", "\x1bPtmux;\x1b\x1b]1337;File=inline=1:AAAA\a\x1b\\", true},
|
|
||||||
} {
|
|
||||||
t.Run(tc.name, func(t *testing.T) {
|
|
||||||
window := &previewTextWindow{}
|
|
||||||
renderer := &previewTextRenderer{}
|
|
||||||
terminal := &Terminal{pwindow: window, tui: renderer, theme: tui.EmptyTheme, activePreviewOpts: &previewOpts{}}
|
|
||||||
const placeholder = "preview placeholder"
|
|
||||||
|
|
||||||
terminal.renderPreviewText(3, []string{tc.sequence, placeholder}, 0, false)
|
|
||||||
|
|
||||||
if len(renderer.sequences) != 1 || renderer.sequences[0] != tc.sequence {
|
|
||||||
t.Errorf("preview should pass through the image sequence once, got %q", renderer.sequences)
|
|
||||||
}
|
|
||||||
if got := strings.Contains(window.text.String(), placeholder); got == tc.reserveWindow {
|
|
||||||
t.Errorf("placeholder visible = %v, want %v", got, !tc.reserveWindow)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestIsImagePassThrough(t *testing.T) {
|
func TestIsImagePassThrough(t *testing.T) {
|
||||||
for _, tc := range []struct {
|
for _, tc := range []struct {
|
||||||
given string
|
given string
|
||||||
|
|||||||
Reference in new issue
Block a user