diff --git a/src/editor.js b/src/editor.js index e94e240..e69f430 100644 --- a/src/editor.js +++ b/src/editor.js @@ -97,6 +97,9 @@ export class PastaMirror { to = line.to + 1; } + // Ensure the removal works when the cursor is on the last line + // see: #80 + to = Math.min(to, view.state.doc.length); const message = view.state.sliceDoc(from, to).trim(); doc.session._pubSubClient.publish(`session:pastagang:chat`, { docId: doc.id, diff --git a/src/strudel.js b/src/strudel.js index d3dc753..2a9d076 100644 --- a/src/strudel.js +++ b/src/strudel.js @@ -192,6 +192,13 @@ export class StrudelSession { pattern = this.allTransform(pattern); } + // fix `pattern.fmap is not a function` exception, + // which happens when the pattern is the hubda function. + // TODO: figure out why this is happening, that sounds like a bug with the nudel std lib. + if (typeof pattern === 'function') { + return; + } + // fft wiring if (this.enableAutoAnalyze) { pattern = pattern.fmap((value) => {