-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Remove root level flags used to track cell selection and focus #9882
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -60,8 +60,6 @@ export type IMainState = { | |
| currentExecutionCount: number; | ||
| debugging: boolean; | ||
| dirty?: boolean; | ||
| selectedCellId?: string; | ||
| focusedCellId?: string; | ||
| isAtBottom: boolean; | ||
| newCellId?: string; | ||
| loadTotal?: number; | ||
|
|
@@ -75,6 +73,29 @@ export type IMainState = { | |
| kernel: IServerState; | ||
| }; | ||
|
|
||
| /** | ||
| * Returns the cell id and index of selected and focused cells. | ||
| */ | ||
| export function getSelectedAndFocusedInfo(state: IMainState) { | ||
| const info: { selectedCellId?: string; selectedCellIndex?: number; focusedCellId?: string; focusedCellIndex?: number } = {}; | ||
| for (let index = 0; index < state.cellVMs.length; index += 1) { | ||
| const cell = state.cellVMs[index]; | ||
| if (cell.selected) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Focus turns on selected as well. And they should never be different so you could simplify this a bit (no need to check for focuses after finding selected, just check if that cell is also focused). NBD if you don't want to change since this doesn't matter much.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree,
Though the styles are different in the cell, e.g. when a code cell has focus, the style is not that of a selected cell (not blue) but the striped green. |
||
| info.selectedCellId = cell.cell.id; | ||
| info.selectedCellIndex = index; | ||
| } | ||
| if (cell.focused) { | ||
| info.focusedCellId = cell.cell.id; | ||
| info.focusedCellIndex = index; | ||
| } | ||
| if (info.selectedCellId && info.focusedCellId) { | ||
| break; | ||
| } | ||
| } | ||
|
|
||
| return info; | ||
| } | ||
|
|
||
| export interface IFont { | ||
| size: number; | ||
| family: string; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.