Skip to content

Commit e455056

Browse files
author
Chris K
committed
DFL-3633 MTS js-debugger.script-source.dfl-3565 can end up with double scrollbars
1 parent 3936291 commit e455056

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/ecma-debugger/js-source-view.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,9 +394,10 @@ cls.JsSourceView = function(id, name, container_class)
394394

395395
var setScriptContext = function(script_id, line_no)
396396
{
397-
source_content.innerHTML = "<div style='visibility:hidden'>" +
397+
source_content.innerHTML = "<div style='visibility:hidden;float:left'>" +
398398
simple_js_parser.format(__current_script, getMaxLengthLineIndex() - 1, 1).join('') + "</div>";
399-
var scrollWidth = __current_script.scroll_width = document.getElementById(SCROLL_CONTENT_ID).scrollWidth;
399+
var scroll_width_target = source_content.firstElementChild || document.getElementById(SCROLL_CONTENT_ID);
400+
var scrollWidth = __current_script.scroll_width = scroll_width_target.scrollWidth;
400401
var offsetWidth = document.getElementById(SCROLL_CONTENT_ID).offsetWidth;
401402
// ensure that a scrollbar is also displayed with very long one-liner scripts
402403
// max width which produces a scrollbar is 0x7FFF - 1
@@ -417,6 +418,14 @@ cls.JsSourceView = function(id, name, container_class)
417418
{
418419
__max_lines = __current_script.line_arr.length;
419420
}
421+
422+
if (__current_script.line_arr.length > __max_lines &&
423+
scrollWidth <= offsetWidth && offsetWidth - scrollWidth < context['scrollbar-width'])
424+
{
425+
__max_lines -= 1;
426+
__current_script.scroll_width += context['scrollbar-width'];
427+
}
428+
420429
var lines = document.querySelector(CONTAINER_LINE_NR_SELECTOR);
421430

422431
if (lines)

0 commit comments

Comments
 (0)