Skip to content

Commit

Permalink
Fix word wrap behavior in console pane (#6034)
Browse files Browse the repository at this point in the history
Updated console stylesheet to enable wrapping mid-word (i.e., not
waiting for a natural breakpoint). Overflowing lines now wrap as soon as
they reach the edge of a console, preventing the horizontal scrollbar
from becoming active.

Addresses #5580
  • Loading branch information
samclark2015 authored Jan 24, 2025
1 parent a70d1f0 commit 9404206
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@

.console-core .console-instance .console-instance-container {
cursor: text;
word-wrap: break-word;
}

.console-core .console-instance:focus {
Expand Down
14 changes: 13 additions & 1 deletion test/e2e/tests/console/console-output.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under the Elastic License 2.0. See LICENSE.txt for license information.
*--------------------------------------------------------------------------------------------*/

import { test, tags } from '../_test.setup';
import { test, tags, expect } from '../_test.setup';

test.use({
suiteId: __filename
Expand All @@ -16,6 +16,16 @@ test.describe('Console Output', { tag: [tags.WIN, tags.CONSOLE, tags.WEB] }, ()
await app.workbench.console.waitForConsoleContents('Why do programmers prefer dark mode');
await app.workbench.console.waitForConsoleContents('Because light attracts bugs!');
});

test('Long console output wraps appropriately', async function ({ app, page, python }) {
await app.workbench.console.waitForReady('>>>');
await app.workbench.console.pasteCodeToConsole(pyCode);
await app.workbench.console.sendEnterKey();
await app.workbench.console.waitForReady('>>>');

const el = page.locator('.console-instance');
await expect(await el.evaluate((el) => el.scrollWidth)).toBeLessThanOrEqual(await el.evaluate((el) => el.clientWidth));
});
});

const rCode = `tokens <- c(
Expand All @@ -38,3 +48,5 @@ const rCode = `tokens <- c(
cat(token)
Sys.sleep(0.01)
}`;

const pyCode = `"Blah" * 300`;

0 comments on commit 9404206

Please sign in to comment.