Skip to content
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

Allow to freeze content of a memory view instance #83

Merged

Conversation

tortmayr
Copy link
Contributor

What it does

Add a button in the title bar that allows to freeze the current content of the memory view. If the view is frozen, updates from the debug adapter are ignored and don't overwrite the shown data. In addition, UI elements that would trigger a data change (core options widget, load more memory buttons) are disabled.

Closes #70

How to test

Click the freeze-button (lock icon) in the title bar

  • Core options widget (adress,offset lengh) and buttons to load more memory should become disabled
  • Advanced display options are still enabled

Trigger memory updates (e.g by stepping in the debugger). Check that memory content remains unchanged

Unfreeze view and trigger updates. Memory content should update again.

Review checklist

Reminder for reviewers

Add a button in the title bar that allows to freeze the current content of the memory view.
If the view is frozen, updates from the debug adapter are ignored and don't overwrite the shown data.
In addition, UI elements that would trigger a data change (core options widget, `load more memory` buttons) are disabled.

Closes eclipse-cdt-cloud#70
@tortmayr tortmayr force-pushed the issues/70_freezeContent branch from ebbc469 to 67b8796 Compare February 27, 2024 10:06
@@ -57,6 +65,11 @@
border-top: 1px solid var(--vscode-widget-border);
}

.core-options input:disabled,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please move the input:disabled changes to https://github.com/eclipse-cdt-cloud/vscode-memory-inspector/blob/main/media/theme/components/input.css so that we can use it everywhere?

and also use the css cursor: not-allowed; please for the input and button when they are disabled.

Maybe you will also need to update: https://github.com/eclipse-cdt-cloud/vscode-memory-inspector/blob/main/media/theme/extensions.css

.pm-top-label .p-inputtext-label {
  margin-bottom: 2px;
}

.pm-top-label:not(:has(*:disabled)) .p-inputtext-label {
  cursor: pointer;
}

.pm-top-label:has(*:disabled) {
  cursor: not-allowed;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An alternative to the cursor changes would be simply not to render the 'load more' headers / footers when those options aren't available. But one of the two changes should be made - at the moment, we still show the pointer cursor over the headers, even though they can't be interacted with.

Copy link
Contributor Author

@tortmayr tortmayr Feb 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@haydar-metin The css has been adjusted. Instead of adjusting the disabled styling for individual components i opted for
defining the disabled style globally for all prime react/custom components:

.p-disabled,
.p-disabled * {
  pointer-events: auto;
  cursor: not-allowed;
  color: var(--vscode-disabledForeground);
}

This ensures that all disabled components have the same default styling.

Copy link

@colin-grant-work colin-grant-work left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functionality looks generally good; only minor comments.

@@ -33,6 +33,8 @@ interface MemoryWidgetProps extends MemoryDisplayConfiguration {
refreshMemory: () => void;
updateMemoryArguments: (memoryArguments: Partial<DebugProtocol.ReadMemoryArguments>) => void;
toggleColumn(id: string, active: boolean): void;
isFrozen: boolean;
toggleFreezeButton: () => void;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
toggleFreezeButton: () => void;
toggleFrozen: () => void;

@@ -57,6 +65,11 @@
border-top: 1px solid var(--vscode-widget-border);
}

.core-options input:disabled,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An alternative to the cursor changes would be simply not to render the 'load more' headers / footers when those options aren't available. But one of the two changes should be made - at the moment, we still show the pointer cursor over the headers, even though they can't be interacted with.

Comment on lines 188 to 191
protected toggleFreezeButton = (): void => { this.doToggleFreezeButton(); };
protected doToggleFreezeButton(): void {
this.setState(prevState => ({ ...prevState, isFrozen: !prevState.isFrozen }));
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These names sound more like they toggle the visibility of the button rather than the state itself.

- Adapt css styles to ensure consistent styling for disabled component (cursor and color)
- Rename `toggleFrozenButton` to `toggleFrozen`
@tortmayr
Copy link
Contributor Author

Thanks for the reviews!
@colin-grant-work I have adjusted the name of the toggleFreezeButtonfunction as you suggested
and disabled components should now consitently show the not-allowed cursor.

@jreineckearm
Copy link
Contributor

Thanks everyone! Functionality looks indeed good!
@tortmayr , @haydar-metin , I assume this will also disable the auto-append scrolling while frozen?

@tortmayr
Copy link
Contributor Author

tortmayr commented Mar 1, 2024

Thanks everyone! Functionality looks indeed good! @tortmayr , @haydar-metin , I assume this will also disable the auto-append scrolling while frozen?

Yes, while frozen memory fetching is globally disabled, so in theory this should also disabled auto-append.
However, we have not tested both changes together yet.
@haydar-metin WDYT? are there any potential issues with the auto append feature if memory fetching is disabled?

@haydar-metin
Copy link
Contributor

@tortmayr @jreineckearm Not that I'm aware of, as @tortmayr disabled the fetching completely. To be sure, I will test it again after merging.

@jreineckearm
Copy link
Contributor

Thanks!

@colin-grant-work colin-grant-work merged commit 531bea1 into eclipse-cdt-cloud:main Mar 1, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow to freeze content of a memory view instance
4 participants