Skip to content

Further fixes for whitespace #10210

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 19, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 22 additions & 15 deletions src/datascience-ui/history-react/redux/reducers/creation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,22 +53,29 @@ export namespace Creation {

// No elseif as we want newly visible cells to pick up the correct expand / collapse state
if (cellVM.inputBlockOpen !== expanded && cellVM.inputBlockCollapseNeeded && cellVM.inputBlockShow) {
if (expanded) {
// Expand the cell
const newText = extractInputBlockText(cellVM, settings);

newCellVM.inputBlockOpen = true;
newCellVM.inputBlockText = newText;
} else {
// Collapse the cell
let newText = extractInputBlockText(cellVM, settings);
if (newText.length > 0) {
newText = newText.split('\n', 1)[0];
newText = newText.slice(0, 255); // Slice to limit length, slicing past length is fine
newText = newText.concat('...');
let newText = extractInputBlockText(cellVM, settings);

// While extracting the text, we might eliminate all extra lines
if (newText.includes('\n')) {
if (expanded) {
// Expand the cell
newCellVM.inputBlockOpen = true;
newCellVM.inputBlockText = newText;
} else {
// Collapse the cell
if (newText.length > 0) {
newText = newText.split('\n', 1)[0];
newText = newText.slice(0, 255); // Slice to limit length, slicing past length is fine
newText = newText.concat('...');
}

newCellVM.inputBlockOpen = false;
newCellVM.inputBlockText = newText;
}

newCellVM.inputBlockOpen = false;
} else {
// If all lines eliminated, get rid of the collapse bar.
newCellVM.inputBlockCollapseNeeded = false;
newCellVM.inputBlockOpen = true;
newCellVM.inputBlockText = newText;
}
}
Expand Down