Skip to content

Fixes #5087 - Removes Dialog scrolling code and and fixes other bugs along the way#5090

Merged
tig merged 8 commits intodevelopfrom
fix/5097-FileDialog
Apr 28, 2026
Merged

Fixes #5087 - Removes Dialog scrolling code and and fixes other bugs along the way#5090
tig merged 8 commits intodevelopfrom
fix/5097-FileDialog

Conversation

@tig
Copy link
Copy Markdown
Collaborator

@tig tig commented Apr 27, 2026

Fixes

Proposed Changes/Todos

  • Todo 1

Pull Request checklist:

  • I've named my PR in the form of "Fixes #issue. Terse description."
  • My code follows the style guidelines of Terminal.Gui - if you use Visual Studio, hit CTRL-K-D to automatically reformat your files before committing.
  • My code follows the Terminal.Gui library design guidelines
  • I ran dotnet test before commit
  • I have made corresponding changes to the API documentation (using /// style comments)
  • My changes generate no new warnings
  • I have checked my code and corrected any poor grammar or misspellings
  • I conducted basic QA to assure all features are working

@tig tig marked this pull request as draft April 27, 2026 15:12
tig added 2 commits April 28, 2026 09:14
- Moved AllowedTypeAny and IAllowedType to separate files
- Enhanced Notepad open dialog filters and options
- Replaced Enumerable.Empty<T>() with [] literals
- Changed CancelButton to CancelButtonIndex (int)
- Moved FileDialog UI/filter setup to EndInit
- Simplified FileDialogState and FileDialogTableSource
- Updated OpenDialog/SaveDialog to use CancelButtonIndex
- Applied code style and expression-bodied member improvements
Eliminates tracking and usage of _minimumSubViewsSize. Dialog sizing now only considers viewport, title, and button sizes. OnSubViewAdded override and related calculations are removed for simplification.
@tig tig marked this pull request as ready for review April 28, 2026 16:00
@tig tig requested review from BDisp, Copilot and tznind April 28, 2026 16:00
@tig tig changed the title WIP: Diagnosing #5087 and fixing other bugs along the way Fixes #5087 - Removes Dialog scrolling code and and fixes other bugs along the way Apr 28, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR is focused on diagnosing the FileDialog performance regression reported in #5087, while also refactoring FileDialog initialization/nullability and removing the (now-deleted) AI example project from the solution.

Changes:

  • Refactors FileDialog initialization (moving much of the “when running” setup into EndInit) and adjusts cancel-result handling.
  • Reworks FileDialog search/state/history/filter plumbing (new IAllowedType file split, nullable updates, history tweaks).
  • Removes Examples/AI from the repository and solution.

Reviewed changes

Copilot reviewed 29 out of 29 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
Terminal.sln Removes the Examples/AI project from the solution.
Terminal.Gui/Views/FileDialogs/SaveDialog.cs Updates cancel detection to use CancelButtonIndex.
Terminal.Gui/Views/FileDialogs/OpenMode.cs Removes file-level nullable disable directive.
Terminal.Gui/Views/FileDialogs/OpenDialog.cs Updates docs and cancel detection to use CancelButtonIndex.
Terminal.Gui/Views/FileDialogs/IAllowedType.cs Splits IAllowedType into its own file.
Terminal.Gui/Views/FileDialogs/FilesSelectedEventArgs.cs Minor expression-bodied ctor refactor.
Terminal.Gui/Views/FileDialogs/FileDialogTableSource.cs Refactors indexer and formatting in column rendering logic.
Terminal.Gui/Views/FileDialogs/FileDialogState.cs Changes state initialization/child enumeration behavior and nullability.
Terminal.Gui/Views/FileDialogs/FileDialogHistory.cs Refactors navigation stacks and nullability/flow.
Terminal.Gui/Views/FileDialogs/FileDialog.cs Major refactor: cancel button API, dropdown creation, init moved to EndInit, SearchState adjustments, dispose moved.
Terminal.Gui/Views/FileDialogs/FileDialog.TableView.cs Tightens context-menu mouse-binding detection and adds issue reference comment.
Terminal.Gui/Views/FileDialogs/FileDialog.Navigation.cs Nullability tweaks and guards around autocomplete generation; signature changes.
Terminal.Gui/Views/FileDialogs/FileDialog.Commands.cs Nullability tweaks, minor logic refactors, changes enum-default exception type.
Terminal.Gui/Views/FileDialogs/DefaultFileOperations.cs Makes operations return nullable results and adjusts null-handling.
Terminal.Gui/Views/FileDialogs/AllowedTypeAny.cs Moves AllowedTypeAny into its own file.
Terminal.Gui/Views/FileDialogs/AllowedType.cs Removes embedded interface/AllowedTypeAny, updates ToString truncation implementation.
Terminal.Gui/Views/DialogTResult.cs Changes dialog sizing/min-size logic.
Terminal.Gui/Views/Autocomplete/AutocompleteFilepathContext.cs Nullability changes in suggestion generation and small refactors.
Terminal.Gui/ViewBase/Layout/Aligner.cs Refactors properties to auto-property + field usage; adjusts PropertyChanged patterns.
Terminal.Gui/ViewBase/Helpers/StackExtensions.cs Rewrites Stack extension methods using extension-member syntax and refactors implementations.
Terminal.Gui/FileServices/IFileOperations.cs Updates New/Rename to return nullable.
Terminal.Gui/FileServices/FileSystemTreeBuilder.cs Nullability changes in comparer and small refactors.
Examples/UICatalog/Scenarios/Notepad.cs Adds OpenDialog AllowedTypes filtering; adjusts nullable handling.
Examples/UICatalog/Scenarios/Editor.cs Adjusts nullable handling for SaveDialog.FileName.
Examples/AI/SlashCommandSuggestionGenerator.cs Deleted.
Examples/AI/SingleTurnView.cs Deleted.
Examples/AI/Program.cs Deleted.
Examples/AI/ChatView.cs Deleted.
Examples/AI/AI.csproj Deleted.

Comment thread Terminal.Gui/Views/FileDialogs/FileDialogState.cs
Comment thread Terminal.Gui/Views/FileDialogs/FileDialog.cs
Comment thread Terminal.Gui/Views/DialogTResult.cs
Comment thread Terminal.Gui/Views/DialogTResult.cs
Comment thread Terminal.Gui/Views/FileDialogs/FileDialog.cs
Comment thread Terminal.Gui/Views/Autocomplete/AutocompleteFilepathContext.cs
Comment thread Examples/UICatalog/Scenarios/Notepad.cs Outdated
Comment thread Terminal.Gui/Views/FileDialogs/FileDialog.Commands.cs Outdated
tig and others added 2 commits April 28, 2026 10:21
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…fType&lt;string&gt;() after Where filter

Agent-Logs-Url: https://github.com/gui-cs/Terminal.Gui/sessions/30418e61-6cfd-44e9-a7f7-0c239168714e

Co-authored-by: tig <585482+tig@users.noreply.github.com>
Copilot finished work on behalf of tig April 28, 2026 16:28
Copy link
Copy Markdown
Collaborator

@BDisp BDisp left a comment

Choose a reason for hiding this comment

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

Perfect. Now it's very much faster indeed.

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.

SHOW STOPPER: FileDialog performance nosedive

4 participants