Skip to content

Commit 9f05fb8

Browse files
authored
Enable wordWrap in the monaco editor by default. (#215)
* Enable wordWrap in the monaco editor by default. * Add entry on editor-word-wrap
1 parent beb8776 commit 9f05fb8

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

_extensions/webr/qwebr-monaco-editor-element.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ globalThis.qwebrCreateMonacoEditorInstance = function (cellData) {
3030
renderLineHighlight: "none", // Disable current line highlighting
3131
hideCursorInOverviewRuler: true, // Remove cursor indictor in right hand side scroll bar
3232
readOnly: qwebrOptions['read-only'] ?? false,
33-
quickSuggestions: qwebrOptions['editor-quick-suggestions'] ?? false
33+
quickSuggestions: qwebrOptions['editor-quick-suggestions'] ?? false,
34+
wordWrap: (qwebrOptions['editor-word-wrap'] == 'true' ? "on" : "off")
3435
});
3536

3637
// Store the official counter ID to be used in keyboard shortcuts

_extensions/webr/webr.lua

+2-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ local qwebRDefaultCellOptions = {
9393
["out-height"] = "",
9494
["editor-font-scale"] = quarto.doc.is_format("revealjs") and "0.5" or "1",
9595
["editor-max-height"] = "",
96-
["editor-quick-suggestions"] = "false"
96+
["editor-quick-suggestions"] = "false",
97+
["editor-word-wrap"] = "true"
9798
}
9899

99100
-----

docs/qwebr-cell-options.qmd

+2
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ For details regarding run options, please see [Hiding and Executing Code](qwebr-
5858
| `editor-max-height` | `0` | Set a threshold to prevent infinite growth of the editor window. |
5959
| `editor-quick-suggestions` | `false` | Show a list of autocomplete variables and/or functions based on what was typed. |
6060
| `editor-font-scale` | `1` | Modify the size of code cell and output relative to the page font size. Values less than 1 shrink the text size and values greater than 1 increase the text size. |
61+
| `editor-word-wrap` | `true` | Allow long lines to be wrapped to avoid code going off the screen causing a scroll bar to appear. |
62+
6163

6264

6365
## Attributes

docs/qwebr-release-notes.qmd

+4-2
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,15 @@ Features listed under the `-dev` version have not yet been solidified and may ch
2929

3030
- Added `cell-options` document-level option to specify global defaults for `{webr-r}` options ([#173](https://github.com/coatless/quarto-webr/pulls/173), thanks [ute](https://github.com/ute)!)
3131

32-
- Added `version` document-level option to specify what version of webR should be used. ([#211](https://github.com/coatless/quarto-webr/issues/211))
32+
- Added `version` document-level option to specify what version of webR should be used. Default embedded version. ([#211](https://github.com/coatless/quarto-webr/issues/211))
3333

3434
- Added `editor-max-height` cell option to limit growth of the editor window. ([#177](https://github.com/coatless/quarto-webr/issues/177), thanks [ute](https://github.com/ute)!)
3535

3636
- Added `editor-font-scale` cell option to scale the code cell size relative to the page font size. Default is `1` for HTML Documents, Books, and Websites and `0.5` for Revealjs Slides. ([#172](https://github.com/coatless/quarto-webr/issues/172) & [#209](https://github.com/coatless/quarto-webr/pull/209), thanks [ute](https://github.com/ute)!)
3737

38-
- Added `editor-quick-suggestions` cell option to enable autocomplete menu suggestions. ([#182](https://github.com/coatless/quarto-webr/issues/182), thanks [egenn](https://github.com/egenn)!)
38+
- Added `editor-quick-suggestions` cell option to enable autocomplete menu suggestions. Default `"false"`.([#182](https://github.com/coatless/quarto-webr/issues/182), thanks [egenn](https://github.com/egenn)!)
39+
40+
- Added `editor-word-wrap` cell option to allow long lines to be wrapped inside of the code cell. Default `"true"`. ([#38](https://github.com/coatless/quarto-webr/issues/38))
3941

4042
- Added the ability to have the monaco editor switch between Quarto's light and dark theme modes. ([#176](https://github.com/coatless/quarto-webr/issues/176))
4143

0 commit comments

Comments
 (0)