Skip to content

Commit

Permalink
fix(preview): fix show/hide preview window when relative is 'win' (#691)
Browse files Browse the repository at this point in the history
  • Loading branch information
linrongbin16 committed May 7, 2024
1 parent e502269 commit dfb8bc1
Show file tree
Hide file tree
Showing 10 changed files with 393 additions and 263 deletions.
29 changes: 3 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,28 +73,6 @@ jobs:
with:
luaVersion: "luajit-2.1.0-beta3"
- uses: leafo/gh-actions-luarocks@v4
- name: Run Tests
run: |
sudo apt-get -y -qq install bat
sudo apt-get -y -qq install fzf
luarocks install vusted
vusted --shuffle ./spec
code_coverage:
name: Code Coverage
needs:
- lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: rhysd/action-setup-vim@v1
id: vim
with:
neovim: true
version: stable
- uses: leafo/gh-actions-lua@v10
with:
luaVersion: "luajit-2.1.0-beta3"
- uses: leafo/gh-actions-luarocks@v4
- name: Run Tests
run: |
sudo apt-get -y -qq install bat
Expand All @@ -103,18 +81,18 @@ jobs:
luarocks install luacov-reporter-lcov
luarocks install vusted
vusted --coverage ./spec
- name: Generate coverage reports
shell: bash
- name: Generate Reports
run: |
echo "ls ."
ls -l .
echo "run luacov"
luacov -r lcov
luacov
echo "ls ."
ls -l .
echo "tail ./luacov.report.out"
tail -n 50 ./luacov.report.out
mv luacov.report.out luacov.report.txt
cp luacov.report.out luacov.report.txt
- uses: codecov/codecov-action@v4
with:
files: luacov.report.txt
Expand All @@ -125,7 +103,6 @@ jobs:
if: ${{ github.ref == 'refs/heads/main' }}
needs:
- unit_test
- code_coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
22 changes: 12 additions & 10 deletions lua/fzfx/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -257,22 +257,24 @@ local Defaults = {
-- - editor
-- - win
-- - cursor
relative = "editor",

-- when relative is 'editor' or 'win', the anchor is the middle center, not the `nvim_open_win` API's default 'NW' (north west).
-- because 'NW' is a little bit complicated for users to calculate the position, usually we just put the popup window in the center of editor/window.
-- if you need to adjust the position of popup, you can specify the `row` and `col` of the popup:
--
-- when relative is 'editor' or 'win', the anchor is the center position, not default 'NW' (north west).
-- because 'NW' is a little bit complicated for users to calculate the position, usually we just put the popup window in the center of editor.
--
-- 1. if -0.5 <= r/c <= 0.5, evaluate proportionally according to editor's lines and columns.
-- e.g. shift rows = r * lines, shift columns = c * columns.
-- 1. if -0.5 <= `row`/`col` <= 0.5, they're evaluated as percentage value based on the editor/window's `height` and `width`.
-- i.e. the real row of center = `row * height`, real column of center = `col * width`.
--
-- 2. if r/c <= -1 or r/c >= 1, evaluate as absolute rows/columns to be shift.
-- e.g. you can easily set 'row = -vim.o.cmdheight' to move popup window to up 1~2 lines (based on your 'cmdheight' option).
-- this is especially useful when popup window is too big and conflicts with command/status line at bottom.
-- 2. if `row`/`col` <= -1 or `row`/`col` >= 1, they're evaluated as absolute value.
-- e.g. you can set 'row = -vim.o.cmdheight' to move popup up for 1~2 rows based on the 'cmdheight' option.
-- this is especially useful when popup window is too big and conflicts with the statusline at bottom.
--
-- 3. r/c cannot be in range (-1, -0.5) or (0.5, 1), it makes no sense.
-- 3. `row`/`col` cannot be in range (-1, -0.5) or (0.5, 1), it's invalid.
--
-- when relative is 'cursor', the anchor is 'NW' (north west).
-- because we just want to put the popup window relative to the cursor.
-- so 'row' and 'col' will be directly passed to `vim.api.nvim_open_win` API without any pre-processing.
-- so 'row' and 'col' will be directly passed to the `nvim_open_win` API without any pre-processing.
--
row = 0,
col = 0,
Expand Down
Loading

0 comments on commit dfb8bc1

Please sign in to comment.