Skip to content

Commit

Permalink
Add performance section to settings and add option to disable highlig…
Browse files Browse the repository at this point in the history
…hts (#89)

* menu tweaks

* cleanup settings menu

* toggle highlights

* clear highlights when u turn them off

* fix load and clean up settings

* clean up

* fix layout of long labels

* clean up settings
  • Loading branch information
TodePond authored Feb 2, 2025
1 parent a283520 commit be72c4f
Show file tree
Hide file tree
Showing 6 changed files with 183 additions and 126 deletions.
67 changes: 43 additions & 24 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -167,53 +167,70 @@ <h3>User settings</h3>
</p>
</section>
<section>
<h3>Panel types</h3>
<h3>Nudel appearance</h3>
<p>
<label>
<input type="checkbox" id="settings-strudel-enabled" />
Enable strudel
Layout
<select id="settings-panel-mode">
<option value="scroll">Scroll layout</option>
<option value="boxed">Boxed layout</option>
<option value="tabbed">Tabbed layout</option>
</select>
</label>
</p>
<p>
<label>
<input type="checkbox" id="settings-hydra-enabled" />
Enable hydra
<input type="checkbox" id="settings-zen-mode" />
Minimal user interface
</label>
</p>
</section>
<hr />
<section>
<h2>Performance</h2>
<p>
To make nudel run better on your machine, try changing these settings. Some of them turn certain things
off, which may help other things to run better.
</p>
<br />
<h3>Panel types</h3>
<p>These settings control which types of panels will run for you.</p>
<p>
<label>
<input type="checkbox" id="settings-shader-enabled" />
Enable shader
<input type="checkbox" id="settings-strudel-enabled" />
Enable strudel (sound)
</label>
</p>
<p>
<label>
<input type="checkbox" id="settings-kabelsalat-enabled" />
Enable kabelsalat
Enable kabelsalat (sound)
</label>
</p>
</section>
<section>
<h3>Nudel appearance</h3>
<p>
<label>
Layout
<select id="settings-panel-mode">
<option value="scroll">Scroll layout</option>
<option value="boxed">Boxed layout</option>
<option value="tabbed">Tabbed layout</option>
</select>
<input type="checkbox" id="settings-hydra-enabled" />
Enable hydra (visuals)
</label>
</p>
<p>
<label>
<input type="checkbox" id="settings-zen-mode" />
Minimal user interface
<input type="checkbox" id="settings-shader-enabled" />
Enable shader (visuals)
</label>
</p>
<br />
<h3>Panel settings</h3>
<p>
<label>
<input type="checkbox" id="settings-strudel-highlights-enabled" />
Enable strudel highlights
</label>
</p>
</section>
<hr />
<section>
<h3>Editor settings</h3>
<h2>Editor settings</h2>
<p>
<label>
<input type="checkbox" id="settings-line-numbers" />
Expand All @@ -235,13 +252,13 @@ <h3>Editor settings</h3>
<p>
<label>
<input type="checkbox" id="settings-track-cursors" />
Track Remote Cursors
Track remote cursors (requires reload) (only advised for boxed layout)
</label>
</p>
<p>
<label>
<input type="checkbox" id="settings-vim-mode" />
Vim keybindings
Vim keybindings (requires reload)
</label>
</p>
<p>
Expand All @@ -261,7 +278,9 @@ <h3>Editor settings</h3>
</p>
</section>
<section class="development">
<h3>Development settings</h3>
<hr />
<br />
<h2>Development settings</h2>
<p>
<label>
<input type="checkbox" id="settings-welcome-message" />
Expand All @@ -271,7 +290,7 @@ <h3>Development settings</h3>
<p>
<label>
<input type="checkbox" id="settings-strudel-autocomplete" />
Strudel Autocomplete 🧪
Strudel auto-complete (experimental)
</label>
</p>
</section>
Expand Down
8 changes: 7 additions & 1 deletion panels/strudel.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,13 @@

const strudel = new StrudelSession({
onError: (...args) => send('onError', args),
onHighlight: (docId, phase, haps) => highlightMiniLocations(editorViews.get(docId), phase, haps),
onHighlight: (docId, phase, haps) => {
const settings = window.parent.getSettings();
if (!settings.strudelHighlightsEnabled) {
return;
}
highlightMiniLocations(editorViews.get(docId), phase, haps);
},
onUpdateMiniLocations: (docId, miniLocations) => updateMiniLocations(editorViews.get(docId), miniLocations),
});

Expand Down
4 changes: 3 additions & 1 deletion src/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,9 @@ export class PastaMirror {
}); */
}

updateExtensions(settings, appliedSettings) {
updateExtensions({ previous, next }) {
const appliedSettings = previous;
const settings = next;
const keys = Object.keys(this.extensions);
for (let index in keys) {
const key = keys[index];
Expand Down
7 changes: 7 additions & 0 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,3 +204,10 @@ document.getElementById('remove-pane-button').addEventListener('click', () => {
const documents = session.getDocuments();
session.setActiveDocuments([...documents.map((doc) => ({ id: doc.id, target: doc.target })).slice(0, -1)]);
});

// highlights
export function clearStrudelHighlights() {
for (const view of pastamirror.editorViews.values()) {
updateMiniLocations(view, []);
}
}
Loading

0 comments on commit be72c4f

Please sign in to comment.