From a5a9b322e9fa6c5263a19d660a6bd71f857dd76c Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Mon, 27 Apr 2015 17:00:27 -0700 Subject: [PATCH] Add hover text to long filenames. --- lib/ui/FileBrowser.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/ui/FileBrowser.js b/lib/ui/FileBrowser.js index aa69d77..745fa09 100644 --- a/lib/ui/FileBrowser.js +++ b/lib/ui/FileBrowser.js @@ -19,6 +19,18 @@ function FileBrowser (opts) { keys: true, mouse: true }).merge(opts).toObject()); + + // Add hover text to filenames that are too long for the panel: + self.on('refresh', function() { + for (var i = 0; i < self.items.length; i++) { + if (self.items[i].getText().length > self.items[i].width) { + self.items[i].setHover(self.items[i].getContent()); + } else { + self.items[i].removeHover(); + } + } + }); + self.refresh(); self.data.selectedStyle = self.style.selected; self.data.itemStyle = self.style.item;