Skip to content

Commit

Permalink
Merge pull request #36 from grapp-dev/feature/add-linebreak-prop
Browse files Browse the repository at this point in the history
feat: add `linebreak` prop to various components
  • Loading branch information
mobily authored Apr 19, 2024
2 parents 7e43726 + 5736e66 commit 1169083
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
8 changes: 7 additions & 1 deletion docs/pages/docs/components/paragraph.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,19 @@ n.paragraph({
types={['string | string[] | NuiLine | NuiLine[]']}
/>


#### truncate

<Property
types={['boolean']}
/>

#### linebreak

<Property
defaultValue="true"
types={['boolean']}
/>

#### prepare_lines

<Property
Expand Down
7 changes: 7 additions & 0 deletions docs/pages/docs/components/text-input.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ n.text_input({
types={['string']}
/>

#### linebreak

<Property
defaultValue="false"
types={['boolean']}
/>

#### placeholder

> Optional placeholder text to show when the input is empty.
Expand Down
3 changes: 3 additions & 0 deletions lua/nui-components/paragraph.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions lua/nui-components/text-input.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ function TextInput:init(props, popup_options)
},
win_options = {
wrap = props.wrap,
linebreak = fn.default_to(props.linebreak, false),
},
}, popup_options)
)
Expand Down

0 comments on commit 1169083

Please sign in to comment.