From aa14c5a738f317bcf7c3dd330bbef87ee7743d0a Mon Sep 17 00:00:00 2001 From: Jens Kreutschmann Date: Mon, 7 Oct 2019 20:11:38 +0200 Subject: [PATCH] Fix length of bar in help search result header This was 81 instead of 80 chars long. There was already a helper in another function which I moved out to use it here, too. --- commands/help.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/commands/help.js b/commands/help.js index fcce176..c0bb007 100644 --- a/commands/help.js +++ b/commands/help.js @@ -2,6 +2,8 @@ const { Broadcast: B, Logger } = require('ranvier'); +const width = 80; +const bar = B.line(width, '-', 'yellow') + '\r\n'; module.exports = { usage: 'help [search] [topic keyword]', @@ -36,9 +38,6 @@ function render(state, hfile) { let body = hfile.body; const name = hfile.name; - const width = 80; - const bar = B.line(width, '-', 'yellow') + '\r\n'; - let header = bar + B.center(width, name, 'white') + '\r\n' + bar; const formatHeaderItem = (item, value) => `${item}: ${value}\r\n\r\n`; @@ -80,9 +79,9 @@ function searchHelpfiles(args, player, state) { const [ _, hfile ] = [...results][0]; return B.sayAt(player, render(state, hfile)); } - B.sayAt(player, "---------------------------------------------------------------------------------"); + B.sayAt(player, bar); B.sayAt(player, "Search Results:"); - B.sayAt(player, "---------------------------------------------------------------------------------"); + B.sayAt(player, bar); for (const [name, help] of results) { B.sayAt(player, `${name}`);