Skip to content

Commit

Permalink
Enable wordWrap in the monaco editor by default. (#215)
Browse files Browse the repository at this point in the history
* Enable wordWrap in the monaco editor by default.

* Add entry on editor-word-wrap
  • Loading branch information
coatless authored Jun 16, 2024
1 parent beb8776 commit 9f05fb8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
3 changes: 2 additions & 1 deletion _extensions/webr/qwebr-monaco-editor-element.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ globalThis.qwebrCreateMonacoEditorInstance = function (cellData) {
renderLineHighlight: "none", // Disable current line highlighting
hideCursorInOverviewRuler: true, // Remove cursor indictor in right hand side scroll bar
readOnly: qwebrOptions['read-only'] ?? false,
quickSuggestions: qwebrOptions['editor-quick-suggestions'] ?? false
quickSuggestions: qwebrOptions['editor-quick-suggestions'] ?? false,
wordWrap: (qwebrOptions['editor-word-wrap'] == 'true' ? "on" : "off")
});

// Store the official counter ID to be used in keyboard shortcuts
Expand Down
3 changes: 2 additions & 1 deletion _extensions/webr/webr.lua
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ local qwebRDefaultCellOptions = {
["out-height"] = "",
["editor-font-scale"] = quarto.doc.is_format("revealjs") and "0.5" or "1",
["editor-max-height"] = "",
["editor-quick-suggestions"] = "false"
["editor-quick-suggestions"] = "false",
["editor-word-wrap"] = "true"
}

-----
Expand Down
2 changes: 2 additions & 0 deletions docs/qwebr-cell-options.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ For details regarding run options, please see [Hiding and Executing Code](qwebr-
| `editor-max-height` | `0` | Set a threshold to prevent infinite growth of the editor window. |
| `editor-quick-suggestions` | `false` | Show a list of autocomplete variables and/or functions based on what was typed. |
| `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. |
| `editor-word-wrap` | `true` | Allow long lines to be wrapped to avoid code going off the screen causing a scroll bar to appear. |



## Attributes
Expand Down
6 changes: 4 additions & 2 deletions docs/qwebr-release-notes.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,15 @@ Features listed under the `-dev` version have not yet been solidified and may ch

- 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)!)

- Added `version` document-level option to specify what version of webR should be used. ([#211](https://github.com/coatless/quarto-webr/issues/211))
- 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))

- 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)!)

- 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)!)

- 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)!)
- 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)!)

- 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))

- 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))

Expand Down

0 comments on commit 9f05fb8

Please sign in to comment.