From 5bc61c002808f7bf1abbd40ad4f90bb11ee03de9 Mon Sep 17 00:00:00 2001 From: Adam Nemet Date: Tue, 14 Nov 2017 04:48:18 +0000 Subject: [PATCH] [opt-viewer] Truncate long remark text in source view The table is changed to fixed layout[1] and the lines use ellipses if they would overflow their cell. [1] https://css-tricks.com/fixing-tables-long-strings/ llvm-svn: 318136 --- llvm/tools/opt-viewer/opt-viewer.py | 18 +++++++++++------- llvm/tools/opt-viewer/style.css | 10 ++++++++++ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/llvm/tools/opt-viewer/opt-viewer.py b/llvm/tools/opt-viewer/opt-viewer.py index bdf21bb03c97..5af78b062e63 100755 --- a/llvm/tools/opt-viewer/opt-viewer.py +++ b/llvm/tools/opt-viewer/opt-viewer.py @@ -119,17 +119,21 @@ class SourceFileRenderer:
- +
+ - - - - - -''', file=self.stream) + + +''', file=self.stream) self.render_source_lines(self.source_stream, line_remarks) print(''' +
LineHotnessOptimizationSourceInline Context
Line +Hotness +Optimization +Source +Inline Context +
''', file=self.stream) diff --git a/llvm/tools/opt-viewer/style.css b/llvm/tools/opt-viewer/style.css index 595c3e46847d..0d3347c1578c 100644 --- a/llvm/tools/opt-viewer/style.css +++ b/llvm/tools/opt-viewer/style.css @@ -1,3 +1,13 @@ +.source { + table-layout: fixed; + width: 100%; + white-space: nowrap; +} +.source td { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} .red { background-color: #ffd0d0; }