Skip to content
Merged

Dev #328

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## v1.3.22
- Wrap long lines in FloatingWindow display mode

## v1.3.21
- Settable current working directory
- Fix window/terminal close bug
Expand Down
6 changes: 6 additions & 0 deletions CHECKLIST.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@
But alas some packages must be downgraded to respect MSRV, see Cargo.toml and
add to the list if (when) necessary:
- cargo update -p syn@2.0.108 --precise 2.0.106
- cargo update -p ryu@1.0.22 --precise 1.0.20
- cargo update -p unicode-ident@1.0.24 --precise 1.0.20
- cargo update -p quote@1.0.44 --precise 1.0.41
- cargo update -p log@0.4.29 --precise 0.4.28
- cargo update -p itoa@1.0.17 --precise 1.0.15
- cargo update -p proc-macro2@1.0.106 --precise 1.0.102

## Merge process
- create a PR dev -> master
Expand Down
18 changes: 9 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "sniprun"
version = "1.3.21"
version = "1.3.22"
authors = ["michaelb <michael.bleuez2@gmail.com>"]
rust-version = "1.65"
edition = "2018"
Expand Down
1 change: 1 addition & 0 deletions doc/sources/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ require'sniprun'.setup({
terminal_width = 45, --# change the terminal display option width (if vertical)
terminal_height = 20, --# change the terminal display option height (if horizontal)
notification_timeout = 5 --# timeout for nvim_notify output
max_fw_width = 80, --# max width for floating windows, longer lines will wrap
},

--# You can use the same keys to customize whether a sniprun producing
Expand Down
1 change: 1 addition & 0 deletions lua/sniprun.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ M.config_values = {
terminal_height = 20, -- change the terminal display option heigth (if horizontal)
notification_timeout = 5, -- timeout for nvim_notify output
notification_render = "default", -- nvim_notify style
max_fw_width = 80, -- max width of floating windows. Longer text gets wrapped
},

show_no_output = {
Expand Down
12 changes: 8 additions & 4 deletions lua/sniprun/display.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,29 @@ function M.fw_open(row, column, message, ok, temp)
local namespace_id = vim.api.nvim_create_namespace(NAMESPACE)

local w = 0
local h = -1
local h = 0
local bp = { row, column }
local bufnr = vim.api.nvim_create_buf(false, true)

local max_width = math.max(require("sniprun").config_values.display_options.max_fw_width, 1)
for line in message:gmatch("([^\n]*)\n?") do
h = h + 1
w = math.max(w, string.len(line))
vim.api.nvim_buf_set_lines(bufnr, h, h + 1, false, { line })
h = h + (1 + math.floor((string.len(line) - 1) / max_width)) -- account for lines which will wrap
w = math.max(w, string.len(line))
vim.api.nvim_buf_add_highlight(bufnr, namespace_id, hl, h, 0, -1) -- highlight lines in floating window
end

if h ~= 0 then
M.fw_handle = vim.api.nvim_open_win(bufnr, false, {
relative = "win",
width = w + 1,
width = math.min(w, max_width),
height = h,
bufpos = bp,
focusable = false,
style = "minimal",
border = M.borders,
})
vim.api.nvim_set_option_value("wrap", true, { win = M.fw_handle })
end
end

Expand Down
3 changes: 0 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -552,9 +552,6 @@ pub fn start() {
// normal, unique result
display(result, event_handler2.nvim, &mut event_handler2.data);
}

//clean data
event_handler2.data = DataHolder::new();
})));
}
Messages::Clean => {
Expand Down
Loading