From c42f8a36977d9986afffa44db8281eef3973d58f Mon Sep 17 00:00:00 2001 From: Marcin Dziewulski Date: Fri, 19 Apr 2024 20:29:31 +0200 Subject: [PATCH 1/2] feat: add `linebreak` prop to various components --- lua/nui-components/paragraph.lua | 3 +++ lua/nui-components/text-input.lua | 1 + 2 files changed, 4 insertions(+) diff --git a/lua/nui-components/paragraph.lua b/lua/nui-components/paragraph.lua index ba9a2e6..6004670 100644 --- a/lua/nui-components/paragraph.lua +++ b/lua/nui-components/paragraph.lua @@ -25,6 +25,9 @@ function Paragraph:init(props, popup_options) buf_options = { filetype = props.filetype or "", }, + win_options = { + linebreak = fn.default_to(props.linebreak, true), + }, }, popup_options) ) end diff --git a/lua/nui-components/text-input.lua b/lua/nui-components/text-input.lua index 8a13c94..3fd7e83 100644 --- a/lua/nui-components/text-input.lua +++ b/lua/nui-components/text-input.lua @@ -40,6 +40,7 @@ function TextInput:init(props, popup_options) }, win_options = { wrap = props.wrap, + linebreak = fn.default_to(props.linebreak, false), }, }, popup_options) ) From 5736e66a2649f2a3accee3b457f5d9dcd2cbf36c Mon Sep 17 00:00:00 2001 From: Marcin Dziewulski Date: Fri, 19 Apr 2024 20:31:17 +0200 Subject: [PATCH 2/2] chore: update docs --- docs/pages/docs/components/paragraph.mdx | 8 +++++++- docs/pages/docs/components/text-input.mdx | 7 +++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/docs/pages/docs/components/paragraph.mdx b/docs/pages/docs/components/paragraph.mdx index a80de25..6bbf4ad 100644 --- a/docs/pages/docs/components/paragraph.mdx +++ b/docs/pages/docs/components/paragraph.mdx @@ -40,13 +40,19 @@ n.paragraph({ types={['string | string[] | NuiLine | NuiLine[]']} /> - #### truncate +#### linebreak + + + #### prepare_lines +#### linebreak + + + #### placeholder > Optional placeholder text to show when the input is empty.