Commit Graph

36 Commits

Author SHA1 Message Date
Brandon Thetford
3f29a96b33 Split out the todo list items and unify their definitions 2024-06-27 20:53:35 -07:00
Brandon Thetford
22fe127522 Add a settings layer to move and separate todo list settings to. 2024-06-27 20:05:17 -07:00
Brandon Thetford
f13786f512 New regex for CONCURRENCY 2024-06-26 19:32:13 -07:00
Brandon Thetford
9ef8545127 New regex for INTENT 2024-06-26 19:32:12 -07:00
Brandon Thetford
3c72c5a646 New regex for TODO 2024-06-26 19:32:12 -07:00
Brandon Thetford
e7524da6b3 New regex for QUESTION 2024-06-26 19:32:11 -07:00
Brandon Thetford
e502d84636 New regex for NOTE 2024-06-26 19:32:11 -07:00
Brandon Thetford
3e28ed232a New regex for SECURITY 2024-06-26 19:32:10 -07:00
Brandon Thetford
0a26d51bea New regex for PERFORMANCE 2024-06-26 19:32:09 -07:00
Brandon Thetford
a8e54a6c72 New regex for SUGGESTION 2024-06-26 19:32:09 -07:00
Brandon Thetford
36813eb64e New regex for BUG 2024-06-26 19:32:08 -07:00
Brandon Thetford
00937aa7e0 Add underscore-tolerant naming rule below the normal PascalCase rule 2024-06-26 19:32:07 -07:00
Brandon Thetford
2e2170e361 Add Roslynator to the dictionary 2024-06-25 05:53:19 -07:00
Brandon Thetford
3bc0c62e5c Add langword to the dictionary 2024-06-25 05:53:19 -07:00
Tig
dabb106c0e Refactor to simplify 2024-05-19 07:46:51 -07:00
Tig
bb37689df0 rebased and fixed 2024-05-09 12:15:39 -06:00
Tig
dcc7a9b518 Fixed a bunch of warnings 2024-05-08 10:24:49 -06:00
Tig
f2a16dc1a3 Added Justifier class with robust unit tests 2024-04-19 11:39:16 -06:00
Tig
da55844277 Rewrote ScreenToFrame to be clearer and more performant 2024-04-09 23:34:15 -04:00
Tig
57a57375f4 Updated code style for internal statics 2024-03-29 10:28:32 -06:00
Tig
550a263155 Tweaked r# settings and applied to View and ViewLayout.cs 2024-03-08 08:11:43 -07:00
Brandon Thetford
ef8b902712 Add "BUGBUG:" to the bug tag for pre-existing comments with that tag 2024-02-29 13:43:02 -07:00
Brandon Thetford
f0dc09f83d Add a tag and add colon to the tag regex so words don't trigger it unexpectedly 2024-02-29 13:42:51 -07:00
Brandon Thetford
00f70e3d17 Use target-typed new everywhere possible. 2024-02-28 14:22:13 -07:00
Brandon Thetford
2642b0f042 Annotate concurrency problem 2024-02-23 16:17:04 -07:00
Brandon Thetford
fcfc7245f1 Add a tag for unclear intent 2024-02-19 04:31:47 -07:00
Brandon Thetford
24aefb9ad9 Add PERF, NOTE, QUESTION, and CONCURRENCY tags for the todo explorer 2024-02-19 04:31:47 -07:00
Tig
4430fe2cc6 Fixes #3192. Improve correctness / clarity of existing View.AutoSize functionality/unit tests (#3202)
* Removed resharper settings from editorconfig

* Remove constructors with frame parameters from Button class.

* Remove constructors with frame parameters from CheckBox class.

* Cleanup code.

* Remove constructors with frame parameters from ComboBox class.

* @BDisp
Remove constructors with frame parameters from FrameView class.

* Remove constructors with frame parameters from Label class.

* Remove constructors with frame parameters from ListView class.

* Remove constructors with frame parameters from ScrollBarView class.

* Remove constructors with frame parameters from ScrollView class.

* Remove namespace braces.

* Cleanup code.

* Cleanup code.

* Cleanup code.

* Remove constructors with frame parameters from TextField class.

* Remove constructors with frame parameters from TimeField class.

* Fixes #3182. OnResizeNeeded returns int.MaxValue and int.MaxValue when Application.Top is null, should return Size.Empty.

* Remove constructors with frame parameters from Toplevel class.

* Remove constructors with frame parameters from Window class.

* Fix merge errors.

* Revert "Fixes #3182. OnResizeNeeded returns int.MaxValue and int.MaxValue when Application.Top is null, should return Size.Empty."

This reverts commit cf9c24b846.

* Revert unit test.

* Fixes #2882. TabView: 'Frame.DrawFrame(Rect, bool)' is obsolete: 'This method is obsolete in v2. Use use LineCanvas or Frame (#2980)

* Fixes #2882. TabView: 'Frame.DrawFrame(Rect, bool)' is obsolete: 'This method is obsolete in v2. Use use LineCanvas or Frame

* Trying fix this unit test that sometimes fail.

* Fixes #2983. View need a alternative DrawFrame for the v2.

* Use new DrawFrame method.

* Change _lines field to Lines property.

* Add TabWindow unit test.

* Add DrawIncompleteFrame method and unit tests.

* Add more unit tests to LineCanvas.

* Fix newline conflict errors.

* Revert "Change _lines field to Lines property."

This reverts commit ab6c5f3094.

* Add DrawIncompleteFrame method and unit tests.

* Add more unit tests to LineCanvas.

* Fix newline conflict errors.

* Force render immediately instead of join.

* I will never rely on zero-location-based unit test again.

* Fix TestTreeViewColor unit test fail.

* Using location of 3 to avoid be divisible by 2 and so avoiding bugs.

* Revert "Using location of 3 to avoid be divisible by 2 and so avoiding bugs."

This reverts commit dd3df135d8.

* Revert "I will never rely on zero-location-based unit test again."

This reverts commit 62adf6f285.

* Revert "Fix newline conflict errors."

This reverts commit 4acf72612d.

* Revert "Add more unit tests to LineCanvas."

This reverts commit 66bc6f514e.

* Revert "Add DrawIncompleteFrame method and unit tests."

This reverts commit 680ba264e1.

* Resolving merge conflicts.

* Revert "Use new DrawFrame method."

This reverts commit 69a7f17f19.

* Revert "Fixes #2983. View need a alternative DrawFrame for the v2."

This reverts commit dade9fd767.

* Reverting this changes to start a new one.

* Add horizontal and vertical support for combining glyphs.

* Fix text and auto size behavior.

* Add TabWidth property.

* Add unit test for WordWrap.

* Fixes #3017. View TextDirection returns incorrect size on a vertical direction instance with AutoSize as false.

* Using Frame to force read from the get method.

* Fix some issues with AutoSize and ForceValidatePosDim.

* Fixing broken unit tests.

* Restoring code I've broken.

* Removing forgotten code.

* Only LayoutStyle.Computed can change the Frame.

* DateField and TimeField depends on LayoutStyle.Computed.

* Fix unit tests related with LayoutStyle.

* Implements tabs, left and right arrows as View.

* Draws a minimum full border.

* Adds missing XML parameter.

* Adds assert tests for Frame.

* Removes duplicates InlineData.

* Adds more unit tests for minimum full border without Left and Right thickness.

* Trying to fix the TestTreeViewColor unit test fail.

* Prevents a user to set TextDirection to -1.

* Prevents any invalid TextDirection value.

* Removes (TextDirection)(-1).

* Removes unnecessary TextDirection initialization.

* Removes LayoutStyle.

* Fixing unit tests with border.

* Trying to fix TestTreeViewColor again.

* Revert "Trying to fix TestTreeViewColor again."

This reverts commit c2efa8e42e.

* Trying to fix TestTreeViewColor again.

* Fix merge errors.

* Fix merge errors.

* Restoring unit test.

* Restores the right XML comment.

* Fix Disposing unit tests that sometimes throws because some instances aren't cleared on others unit tests classes.

* Fix Disposing unit tests that sometimes throws because some instances aren't cleared on others unit tests classes.

* Only call OnResizeNeeded if it's LayoutStyle.Computed.

* Fix merge errors.

* Fix merge errors.

* Fix unit tests fail.

* Reformat.

* Again.

* Rename to OnDrawAdornments.

* Fix failing unit tests.

* Reduces indentation and cleanup code.

* Cleanup code.

* Fix bug done when cleanup.

* Replace FrameHandledMouseEvent to AdornmentHandledMouseEvent.

* Removes Tab constructor parameters.

---------

Co-authored-by: Tig <tig@users.noreply.github.com>

* Fix merge errors.

* Remove constructors with parameters from Button.

* Remove parenthesis on objects initializers from Button.

* Remove constructors with parameters from CheckBox.

* Remove parenthesis on objects initializers from CheckBox.

* Remove constructors with parameters from ComboBox.

* Remove constructors with parameters from FrameView.

* Remove parenthesis on objects initializers from FrameView.

* Initial commit

* Renamed Direction enum for clarity in refactoring unit tests

* Moved nav tests to NavigationTests

* Moved view tests around

* Cleaning up TextFormatter and View.AutoSize code

* Fixed latent TextFormatter bug with \n

* removed Application dependency on some autosize unit tests

* Fixed Label tests to deal with auotsize overriding height/width

* Fixed more label tests. WIP

* Fixed all places where AutoSize = happend after setting Dims

* Started adding new primitive View.Text tests

* Code comments

* WIP: Enforce that it makes no sense to set Width/Height if AutoSize = true. Update Unit tests to match.

* WIP: Enforce that it makes no sense to set Width/Height if AutoSize = true. Update Unit tests to match.

* Remove frame set from the View constructor and prevent SetRelativeLayout running if not yet initialized.

* Changes needed for unit tests pass on remove parameters constructors from the Label class.

* Remove constructors with parameters from Label.

* Remove parenthesis on objects initializers from Label.

* Prefix private fields with underscore.

* Renamed to MaxLength.

* Remove constructors with parameters from ListView.

* MakeWrapper not needed anymore.

* Remove parenthesis on objects initializers from ListView.

* WIP: Enforce that it makes no sense to set Width/Height if AutoSize = true. Update Unit tests to match.

* Massive code cleanup - use parameterless constructors and ensure AutoSize is set properly. Code reformat.

* Massive code cleanup - use parameterless constructors and ensure AutoSize is set properly. Code reformat.

* Fixed messagebox

* Remove constructors with parameters from ScrollBarView and ScrollView.

* Remove parenthesis on objects initializers from ScrollBarView and ScrollView.

* Cleanup code.

* Fix merge errors.

* Add empty dotsettings for solution and projects.

* Set ReSharper language analysis level for projects to  C#12

* Make ReSharper consider itself the boss for style

* Add rule to enforce property backing fields above the property

* Disable auto-detection of naming rules so ReSharper doesn't change them by itself

* Don't let someone's VS settings override the indent settings

* Explicitly set tab width to 4 spaces and force spaces.

* Rules to keep various multi-line constructs aligned within themselves

* Curly brace rules (Using K&R style, per current project spec)

* Blank line rules

Mostly to add breaks in various situations, and also to enforce max of 1 blank line.

* Increase auto-wrap to 160 from default of 120

* Line break at end of all files, to make Unixy systems happy

* Keep attributes on their own lines except for methods and records that are themselves single-line

* Increase attribute auto-wrap to 60 from default of 38

* Wrap/chop rules for long method signatures and record declarations

Chop if either already multi-line or if over 8 parameters.
Chop AFTER the left paren and BEFORE the first parameter.

* Chop rules for generics

For generics with multi-line type parameters or multiple type parameter constraints, chop in a way that has consistent alignment.

* Always enforce enum members on their own lines

* One-line functions completely on one line

They're usually expression-bodied anyway, here, so this is almost irrelevant

* Keep control flow statements on their own lines

* Follow same chop rules for method invocation as method declaration

* Chop long or multi-line method chains or patterns

* Wrap rules for binary operators

Operator at beginning of new lines
Auto-chop if long or already multi-line

* Spaces between keywords and their opening parentheses

* Add file layout rules for organization of reorderable items like fields, properties, etc.

Ugly XML, so load it up in the UI to look at it
It's MOSTLY the ReSharper defaults, but with more aggressive sorting, generally by access modifier and name, within each grouping.

* Deconstructors use per-member types

* Use keywords for built-in types and increase severity of inspection for violations

Also apply to IntPtr and similar, which should now be nint and similar

* Apply syntax style on completion.

* Use var when evident for built-in and simple types, but not elsewhere

* Increase severity for some minor redundancy and clarity inspections

* Enforce braces always required for blocks, and treat as error

* Warn if a local function is not statement-bodied

* Increase various inspection severities

IF Condition => Severity:
Attributes not wrapped property => Suggestion
Constructors expression-bodied => Error
default doesn't have type when it isn't clear => suggestion
Namespaces not file-scoped => error
Methods not statement-bodied => hint
Null check pattern not the object property pattern => Error

* Adjust preference order of null check patterns to make object pattern highest

* XmlDoc rules to keep tags and contents aligned and wrapped

* Add a few custom profiles for code cleanup and make the full profile default

* Remove parts for languages not used in this solution

* copied in v2_develop changes

* Merged v2_develop

* Added Begin/Init unit tests. Removed Application dependencey from AutoSizeFalse tests

* TextFormatter.Lines -> GetLines ()

* Let ReSharper know we intend to localize things

* TextFormatter code cleanup

* copied in v2_develop changes

* Merged v2_develop

* Spaces aren't wanted here either.

* Fix merge errors.

* Fixes ContentBottomRightCorner related with https://github.com/gui-cs/Terminal.Gui/issues/3211#issue-2098878820

* Remove constructors with parameters from ContextMenu.

* Remove commented code.

* Remove constructors with parameters from OpenDialog.

* Remove constructors with parameters from SaveDialog.

* Remove constructors with parameters from TextField.

* Remove constructors with parameters from TimeField.

* Fix unit test.

* Remove unnecessary SetInitialProperties method.

* Remove unnecessary SetInitialProperties method.

* Remove parenthesis on objects initializers from Toplevel and Window.

* Remove constructors with parameters from RadioGroup.

* Remove constructors with parameters from TextView.

* Remove constructors with parameters from MenuBar.

* TEMPORARY: Turn everything that was set to error down to warning or lower

* Fixes #3219. MenuBar is opened by call OpenMenu even it's disabled.

* Remove constructors with parameters from Menu.

* Remove constructors with parameters from View.

* Change constructor to internal because is mainly useful for testing.

* ReSharper Cleanup Code.

* Added format only r# config

* Fixes #3224. TextFormatter.Lines should return a single string.Empty list even with Width or Height equal to zero.

* Remove constructors with parameters from Dialog.

* Remove constructors with parameters from TextValidateField.

* Fixes https://github.com/gui-cs/Terminal.Gui/issues/3224#issuecomment-1924096038

* Fixes #3225. Press CursorDown on TabView doesn't move to the next view.

* Fixes #3229. TextFormatter should have a FillRemaining property.

* Testing formatting merge in bdisp

* Testing formatting merge

* Testing formatting merge bdisp

* Testing formatting merge 2

* xmldoc format

* R# Full Code Cleanup

* R# Full Code Cleanup2

* R# Full Code Cleanup2

* Merged! But broke tests

* Refixing...

* Refixed DrawTests

* Refixed ViewTests

* Refixed Text Tests

* Refixed more unit tests

* Refixed scenarios

* Refixed rest of scenarios

* Refixed ViewsTests

* Refixed rest of tests. All unit tests pass again!

* Fixed warnings

* Updated R# version. Added new code cleanup settings

* Applied latest code cleanup to solution

* Another code cleanup pass

* Tweaked r# settings. .editorconfig now matches.

* r# else on separate line

* r# - update

* r# - full solution

* test commit

* test commit

* test commit

* Removed extra profiles

* Full cleanup following cleaning up profiles

* Null checking pattern rules/inspections

* Tabs and extra whitespace are evil

* Attributes on their own lines

* Code layout rules to put fields first and to put backing fields with their properties

* Merged v2_develop

* Full cleanup following dodexahedron's PR

---------

Co-authored-by: BDisp <bd.bdisp@gmail.com>
Co-authored-by: Brandon Thetford <github@snapsinazfs.com>
2024-02-11 15:54:03 -07:00
dodexahedron
92a601254e Fixes #3170. Color improvements (#3204)
* Reduces indentation by remove the namespace braces.

* Reduces indentation and removes unused using.

* Ensures clear selection if it isn't selecting.

* Turn on nullability context for TryParse and update usages as needed.

* Use IsNullOrWhiteSpace, which includes IsNullOrEmpty

All-whitespace values are also illegal, so may as well handle that here too

* Respect the nullable here

* It's a struct

* Use byte.MaxValue and add remark

* Just use the bytes directly

* Must respect endianness

* Add uint constructor so consumers don't have to do unchecked math

* Completely re-work parsing and implement ISpanParsable<Color>

All parsing is now almost-0 allocation, and is significantly faster than before

* Extension methods required by new code

* Use standard Math.Clamp method here

* Add some new unit tests for TryParse

* De-duplicate code and handle more cases

* Enable nullability context for the file

* Go ahead and enable the language features and analysis

* Implicit usings remove a lot of boilerplate usings.

* Add these to the dictionary to shut spell check up

* Make this thing a record struct and a union, and update constructors

This commit won't build. I'm just breaking out changes a little bit.

* Some additional XmlDoc standardizing

* Make FindClosestColor and CalculateColorDistance use the vector for SIMD

* Add a TryFormat method for support of I*Formattable

* Add an interface for support of custom formatting of Colors

* Pass by in reference

* Parse string delegates to Parse span

* Parse now does all the work

* Remove the old new code from TryParse

* Some new cast operators

* Add IFormattable.ToString implementation

* Add the rest of the code for Color in its current (unfinished) state

* Move that interface to its own file

* Add ColorParseException class

* Move Attribute to its own file, too.

* Re-implement these operators as explicit methods

* Get rid of fuzzy equality operators and update tests to use the named methods that replace them

* Add an explicit test case for ToString with null format string and explicitly specified Invariant culture

* Fix byte orders for hex format to be standard ARGB

* Prove that ToString and Parse can round-trip values

* Unroll this test into parameterized cases

* Fix a couple of comments to match byte order

* Update R# dictionary to match correct byte orders

* Remove stray comment

* Separate all types in this to their own files

* Convert this one to use the handy extension

* Add test for Argb property

* Add a file nesting rule to make some incoming file changes display nicely

* Move constructor tests to their own file and add some new tests

* Add implicit cast from uint

* More constructor tests

* Since this is now a record, the equality operators are compiler generated

Still spot-checking a few arbitrary values for completeness

* Override ToString to delegate to Attribute

* Simplify and clean up ToString. Delegate to ColorScheme

* Update the test to match new output

* These should be fields, really. It's a value type.

* Add some type checks for change control

* Allow unsafe and turn on implicit usings

* Make this one better

* Rename tests and remove redundant checks (the type checks already guarantee field consistency)

* Reorganize a bit

* Make these test 16 random values

* Existing operator tests converted

* That one is now redundant with both of the other tests that check all the named colors

* Move this to type checks and simplify a little bit

* These lambdas can be static

* Move operators to another file.

* Add global using for System.Text because it's EVERYWHERE

* Reorganization of Color and some related types.

Updated usages to reflect changes

* Update tests to reflect changes in Terminal.Gui

* Add missing keyword

* Add entry to dictionary

* Add dotsettings for Terminal.Gui

Only specifies language level

* Commit unsaved changes for usings here

* Implement last remaining TryFormat method

* A little cleanup/formality

* Sorting rules

Sort methods by name and interface they implement

* Sort code

* Match namespace for tests

None!

* Unroll ordinal check and reorganize.

* Sort before writing new tests

* These got reversed...

* Add test to prove explicit cast to Vector3 works properly

* Sort these too

* Add test for uint->Color implicit operator

* Add test for Color->uint implicit operator

* Correct this test name and re-order

* Add test for implicit conversion from Vector3 to Color

* Add test for implicit conversion from Vector4 to Color

* These also got reversed, like with Vector3

* Add test for implicit conversion from Color to Vector4

* Add test for GetHashCode

* Make sure these are all under the same namespace

* Remove a now-redundant test

* Reorganize formatting and parsing tests to another type part

* Tests moved back to Terminal.Gui.DrawingTests namespace as before.

* Add tests for the constructor taking 3 or 4 integers and sort

* Cleanup

 - Renamed some tests
 - Make a test even clearer
 - Removed redundant code
 - Got rid of unused parameter in Constructor_WithColorName_AllChannelsCorrect

* That needs to be from the reverse map

Not broken - just was sub-optimal due to my error.

* Enable nullability context in this file

Not sure how it got removed but whatev

* Respect nullability context in this file now that it's on 🤦‍♂️

* Add tests for expected exceptions with whitespace or null values

* Add test for parameterless constructor

* A couple more places for reference passing and some SkipLocalsInit attributes.

* Some XmlDoc corrections to reflect the final implementation

* Remove namespace qualifier

* Can't use these because of lambdas :(

* Removed a collection that never ended up being needed.

* Add bracing, newline, and modifier style rules

* Add spacing rules inside parens/brackets

* This was still under the Terminal.Gui.Drawing namespace. Revert that.

* Applied updated formatting settings and addressed XmlDoc reviews in #3204

* More places where spaces got added in dependent code.

Also a couple of null checks fixed to not use the equality operator

* More dependent code format fixes

* Finished re-formatting modified code that got spaces added everywhere

* Visual studio didn't actually write this file to disk til I closed out of VS...

Grr

* Delete the ReSharper settings files from this branch.

---------

Co-authored-by: BDisp <bd.bdisp@gmail.com>
2024-01-24 09:58:02 -07:00
Tigger Kindel
841bbf2ed7 More simplification 2023-10-13 23:58:49 -06:00
Tigger Kindel
59339ebe22 Removed Attribute.Make (use new) 2023-10-13 23:58:49 -06:00
Tigger Kindel
f90ddd520b Re-enabled -1 result 2023-10-05 22:21:59 -06:00
Tigger Kindel
1c133ba364 Refactored CheckTimers into MainLoop and renamed/simplified 2023-10-05 22:21:59 -06:00
Tigger Kindel
293161bca1 TrueColor in NetDriver now works 2023-08-12 10:39:17 -06:00
Tigger Kindel
dd75d4ea9f Initial commit 2023-08-12 10:39:17 -06:00
Alexandru Ciobanu
43d89b119a Added Rider/Resharper settings file that enforces the formatting and code rules. 2022-10-18 21:16:02 +01:00