diff --git a/demo/server.js b/demo/server.js index 0aa9deef..ebe2f644 100644 --- a/demo/server.js +++ b/demo/server.js @@ -58,9 +58,25 @@ app.ws('/terminals/:pid', function (ws, req) { console.log('Connected to terminal ' + term.pid); ws.send(logs[term.pid]); + function buffer(socket, timeout) { + let s = ''; + let sender = null; + return (data) => { + s += data; + if (!sender) { + sender = setTimeout(() => { + socket.send(s); + s = ''; + sender = null; + }, timeout); + } + }; + } + const send = buffer(ws, 5); + term.on('data', function(data) { try { - ws.send(data); + send(data); } catch (ex) { // The WebSocket is not open, ignore } diff --git a/src/addons/search/SearchHelper.ts b/src/addons/search/SearchHelper.ts index d07c6b2c..f23a8c58 100644 --- a/src/addons/search/SearchHelper.ts +++ b/src/addons/search/SearchHelper.ts @@ -4,7 +4,7 @@ */ import { ISearchHelper, ISearchAddonTerminal, ISearchOptions, ISearchResult } from './Interfaces'; -const nonWordCharacters = ' ~!@#$%^&*()_+`-=[]{}|\;:"\',./<>?'; +const nonWordCharacters = ' ~!@#$%^&*()+`-=[]{}|\;:"\',./<>?'; /** * A class that knows how to search the terminal and how to display the results.