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

[ColorPicker] Fix hex input without # in adjust color ui #14966

Closed
wants to merge 6 commits into from

Conversation

htcfreek
Copy link
Collaborator

@htcfreek htcfreek commented Dec 12, 2021

Summary of the Pull Request

What is this about:
In the color edit dialog we currently only accept hex values with #. This is not user friendly as we removed the # on the picked color code. When users copy the color code into the edit dialog hex field they have to add the # manually.

This PR updates UX to add the # automatically and to limit value length. The changes works with 3 and 6 value hex code.
pt-cp-hexfix
Note: The gif doesn't shows in real time (Don't know why.)

What is included in the PR:

  • Updating the regex to accept hex color code with and without #.
  • Update code to add # in text box if color code is valid.
  • Add max length property to the text box.

How does someone test / validate:
Build and tried manually with typing the code and inserting the code form clipboard with and without #.

Quality Checklist

Contributor License Agreement (CLA)

A CLA must be signed. If not, go over here and sign the CLA.

@github-actions
Copy link

github-actions bot commented Dec 12, 2021

@check-spelling-bot Report

Unrecognized words, please review:

  • Hashtag
Previously acknowledged words that are now absent Accessible Actioncenter Addavirtualdesktop ALIGNLEFT AUTOAPPEND AUTOSIZECOLUMNS available azurewebsites bca BEGINLABELEDIT bfee btn Captureascreenshot CASESENSITIVE checkboxes CHECKCANCELED chrisharris CIEXYZ coc COLUMNCLICK Connectquickaction coords countslabelrenamingfmt countslabelselectedfmt CRename CTriage dchristensen Deduplicate DISPINFO Displayandhidethedesktop djsoref docsmsft dogancelik DOUBLEBUFFER dupenv DWLP Easeof Entireitemname ENUMITEMS estdir EXCLUDEFILES EXCLUDEFOLDERS EXCLUDESUBFOLDERS EXISTINGIMAGERESIZERPATH EXISTINGPOWERRENAMEEXTPATH EXTENIONONLY EXTENSIONONLY FFAA fluentui Fody ftp ftps FULLNAME Gamebar GETDISPINFO GETEMPTYMARKUP gmx HACCEL HDF hdi HDITEM hdlg HDN HDS hitinfo htt ianjoneill IAuto IDrop INDEXTOSTATEIMAGEMASK inprivate installpowertoys IPreview IProgress ITEMSTATEICONCLICK IThumbnail itsme jakeoeding JSX KERNELBASE linecap Linkmenu listbox localhost Lockyour LPDWORD LPNMHDR LPNMHEADER LPNMLISTVIEW LPOLESTR LPPOINT lvc LVCF LVCFMT LVHITTESTINFO LVHT LVIF LVIS LVN LVS LVSIL MARQUEEPROGRESS MATCHMODE Mensching mfreadwrite mfuuid Minimizeallwindows MINMAXINFO NAMEONLY Nefario nitroin NMLVEMPTYMARKUP noactive Noactivewindow npm null nunit ONITEM Openthe OPTIONSGROUP pcelt PCorswitchaccounts pitem plvdi pnm pnmdr pnmlv POINTL polymorpism powertoyswiki ppenum ppsrui PREVIEWGROUP pritudev PROGDLG prpui Prt prui Radiobuttons RDW recyclebin refcount REPLACEWITH Reportx rgelt Rgn Rundialogbox Scn SEARCHFOR SEARCHREPLACEGROUP SHAREIMAGELISTS sidepanel SINGLESEL SORTDOWN spamming spdth sppd sppre spsrif spsrui STATEIMAGEMASK stringstream Switchbetweenvirtualdesktops systray Taskview Temporarilypeekatthedesktop textref THEMECHANGED TIMERID titlecase tsx uifabric uifabricicons ulazy UPDOWNKEYDROPSLIST USEREGEX windevbuildagents winstore XDiff xia XSmall XToolset xunit YDiff Zoomusingmagnifier
Some files were were automatically ignored

These sample patterns would exclude them:

^src/modules/MouseUtils/MouseHighlighter/MouseHighlighter\.vcxproj\.filters$
^src/modules/previewpane/UnitTests-MarkdownPreviewHandler/HelperFiles/MarkdownWithHTMLImageTag\.txt$

You should consider adding them to:

.github/actions/spell-check/excludes.txt

File matching is via Perl regular expressions.

To check these files, more of their words need to be in the dictionary than not. You can use patterns.txt to exclude portions, add items to the dictionary (e.g. by adding them to allow.txt), or fix typos.

To accept these unrecognized words as correct (and remove the previously acknowledged and now absent words), run the following commands

... in a clone of the git@github.com:htcfreek/PowerToys.git repository
on the CpHexFix branch:

update_files() {
perl -e '
my @expect_files=qw('".github/actions/spell-check/expect.txt"');
@ARGV=@expect_files;
my @stale=qw('"$patch_remove"');
my $re=join "|", @stale;
my $suffix=".".time();
my $previous="";
sub maybe_unlink { unlink($_[0]) if $_[0]; }
while (<>) {
if ($ARGV ne $old_argv) { maybe_unlink($previous); $previous="$ARGV$suffix"; rename($ARGV, $previous); open(ARGV_OUT, ">$ARGV"); select(ARGV_OUT); $old_argv = $ARGV; }
next if /^(?:$re)(?:(?:\r|\n)*$| .*)/; print;
}; maybe_unlink($previous);'
perl -e '
my $new_expect_file=".github/actions/spell-check/expect.txt";
use File::Path qw(make_path);
use File::Basename qw(dirname);
make_path (dirname($new_expect_file));
open FILE, q{<}, $new_expect_file; chomp(my @words = <FILE>); close FILE;
my @add=qw('"$patch_add"');
my %items; @items{@words} = @words x (1); @items{@add} = @add x (1);
@words = sort {lc($a)."-".$a cmp lc($b)."-".$b} keys %items;
open FILE, q{>}, $new_expect_file; for my $word (@words) { print FILE "$word\n" if $word =~ /\w/; };
close FILE;
system("git", "add", $new_expect_file);
'
(cat '.github/actions/spell-check/excludes.txt' - <<EOF
$should_exclude_patterns
EOF
) |grep .|
sort -f |
uniq > '.github/actions/spell-check/excludes.txt.temp' &&
mv '.github/actions/spell-check/excludes.txt.temp' '.github/actions/spell-check/excludes.txt'
}

comment_json=$(mktemp)
curl -L -s -S \
  --header "Content-Type: application/json" \
  "https://api.github.com/repos/microsoft/PowerToys/issues/comments/991896006" > "$comment_json"
comment_body=$(mktemp)
jq -r .body < "$comment_json" > $comment_body
rm $comment_json

patch_remove=$(perl -ne 'next unless s{^</summary>(.*)</details>$}{$1}; print' < "$comment_body")
  

patch_add=$(perl -e '$/=undef;
$_=<>;
s{<details>.*}{}s;
s{^#.*}{};
s{\n##.*}{};
s{(?:^|\n)\s*\*}{}g;
s{\s+}{ }g;
print' < "$comment_body")
  

should_exclude_patterns=$(perl -e '$/=undef;
$_=<>;
exit unless s{(?:You should consider excluding directory paths|You should consider adding them to).*}{}s;
s{.*These sample patterns would exclude them:}{}s;
s{.*\`\`\`([^`]*)\`\`\`.*}{$1}m;
print' < "$comment_body" | grep . || true)

update_files
rm $comment_body
git add -u
If you see a bunch of garbage

If it relates to a ...

well-formed pattern

See if there's a pattern that would match it.

If not, try writing one and adding it to the patterns.txt file.

Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

Note that patterns can't match multiline strings.

binary-ish string

Please add a file path to the excludes.txt file instead of just accepting the garbage.

File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

@github-actions
Copy link

github-actions bot commented Dec 12, 2021

@check-spelling-bot Report

Unrecognized words, please review:

  • Hashtag
Previously acknowledged words that are now absent Accessible Actioncenter Addavirtualdesktop ALIGNLEFT AUTOAPPEND AUTOSIZECOLUMNS available azurewebsites bca BEGINLABELEDIT bfee btn Captureascreenshot CASESENSITIVE checkboxes CHECKCANCELED chrisharris CIEXYZ coc COLUMNCLICK Connectquickaction coords countslabelrenamingfmt countslabelselectedfmt CRename CTriage dchristensen Deduplicate DISPINFO Displayandhidethedesktop djsoref docsmsft dogancelik DOUBLEBUFFER dupenv DWLP Easeof Entireitemname ENUMITEMS estdir EXCLUDEFILES EXCLUDEFOLDERS EXCLUDESUBFOLDERS EXISTINGIMAGERESIZERPATH EXISTINGPOWERRENAMEEXTPATH EXTENIONONLY EXTENSIONONLY FFAA fluentui Fody ftp ftps FULLNAME Gamebar GETDISPINFO GETEMPTYMARKUP gmx HACCEL HDF hdi HDITEM hdlg HDN HDS hitinfo htt ianjoneill IAuto IDrop INDEXTOSTATEIMAGEMASK inprivate installpowertoys IPreview IProgress ITEMSTATEICONCLICK IThumbnail itsme jakeoeding JSX KERNELBASE linecap Linkmenu listbox localhost Lockyour LPDWORD LPNMHDR LPNMHEADER LPNMLISTVIEW LPOLESTR LPPOINT lvc LVCF LVCFMT LVHITTESTINFO LVHT LVIF LVIS LVN LVS LVSIL MARQUEEPROGRESS MATCHMODE Mensching mfreadwrite mfuuid Minimizeallwindows MINMAXINFO NAMEONLY Nefario nitroin NMLVEMPTYMARKUP noactive Noactivewindow npm null nunit ONITEM Openthe OPTIONSGROUP pcelt PCorswitchaccounts pitem plvdi pnm pnmdr pnmlv POINTL polymorpism powertoyswiki ppenum ppsrui PREVIEWGROUP pritudev PROGDLG prpui Prt prui Radiobuttons RDW recyclebin refcount REPLACEWITH Reportx rgelt Rgn Rundialogbox Scn SEARCHFOR SEARCHREPLACEGROUP SHAREIMAGELISTS sidepanel SINGLESEL SORTDOWN spamming spdth sppd sppre spsrif spsrui STATEIMAGEMASK stringstream Switchbetweenvirtualdesktops systray Taskview Temporarilypeekatthedesktop textref THEMECHANGED TIMERID titlecase tsx uifabric uifabricicons ulazy UPDOWNKEYDROPSLIST USEREGEX windevbuildagents winstore XDiff xia XSmall XToolset xunit YDiff Zoomusingmagnifier
Some files were were automatically ignored

These sample patterns would exclude them:

^src/modules/MouseUtils/MouseHighlighter/MouseHighlighter\.vcxproj\.filters$
^src/modules/previewpane/UnitTests-MarkdownPreviewHandler/HelperFiles/MarkdownWithHTMLImageTag\.txt$

You should consider adding them to:

.github/actions/spell-check/excludes.txt

File matching is via Perl regular expressions.

To check these files, more of their words need to be in the dictionary than not. You can use patterns.txt to exclude portions, add items to the dictionary (e.g. by adding them to allow.txt), or fix typos.

To accept these unrecognized words as correct (and remove the previously acknowledged and now absent words), run the following commands

... in a clone of the git@github.com:htcfreek/PowerToys.git repository
on the CpHexFix branch:

update_files() {
perl -e '
my @expect_files=qw('".github/actions/spell-check/expect.txt"');
@ARGV=@expect_files;
my @stale=qw('"$patch_remove"');
my $re=join "|", @stale;
my $suffix=".".time();
my $previous="";
sub maybe_unlink { unlink($_[0]) if $_[0]; }
while (<>) {
if ($ARGV ne $old_argv) { maybe_unlink($previous); $previous="$ARGV$suffix"; rename($ARGV, $previous); open(ARGV_OUT, ">$ARGV"); select(ARGV_OUT); $old_argv = $ARGV; }
next if /^(?:$re)(?:(?:\r|\n)*$| .*)/; print;
}; maybe_unlink($previous);'
perl -e '
my $new_expect_file=".github/actions/spell-check/expect.txt";
use File::Path qw(make_path);
use File::Basename qw(dirname);
make_path (dirname($new_expect_file));
open FILE, q{<}, $new_expect_file; chomp(my @words = <FILE>); close FILE;
my @add=qw('"$patch_add"');
my %items; @items{@words} = @words x (1); @items{@add} = @add x (1);
@words = sort {lc($a)."-".$a cmp lc($b)."-".$b} keys %items;
open FILE, q{>}, $new_expect_file; for my $word (@words) { print FILE "$word\n" if $word =~ /\w/; };
close FILE;
system("git", "add", $new_expect_file);
'
(cat '.github/actions/spell-check/excludes.txt' - <<EOF
$should_exclude_patterns
EOF
) |grep .|
sort -f |
uniq > '.github/actions/spell-check/excludes.txt.temp' &&
mv '.github/actions/spell-check/excludes.txt.temp' '.github/actions/spell-check/excludes.txt'
}

comment_json=$(mktemp)
curl -L -s -S \
  --header "Content-Type: application/json" \
  "https://api.github.com/repos/microsoft/PowerToys/issues/comments/991896507" > "$comment_json"
comment_body=$(mktemp)
jq -r .body < "$comment_json" > $comment_body
rm $comment_json

patch_remove=$(perl -ne 'next unless s{^</summary>(.*)</details>$}{$1}; print' < "$comment_body")
  

patch_add=$(perl -e '$/=undef;
$_=<>;
s{<details>.*}{}s;
s{^#.*}{};
s{\n##.*}{};
s{(?:^|\n)\s*\*}{}g;
s{\s+}{ }g;
print' < "$comment_body")
  

should_exclude_patterns=$(perl -e '$/=undef;
$_=<>;
exit unless s{(?:You should consider excluding directory paths|You should consider adding them to).*}{}s;
s{.*These sample patterns would exclude them:}{}s;
s{.*\`\`\`([^`]*)\`\`\`.*}{$1}m;
print' < "$comment_body" | grep . || true)

update_files
rm $comment_body
git add -u
If you see a bunch of garbage

If it relates to a ...

well-formed pattern

See if there's a pattern that would match it.

If not, try writing one and adding it to the patterns.txt file.

Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

Note that patterns can't match multiline strings.

binary-ish string

Please add a file path to the excludes.txt file instead of just accepting the garbage.

File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

@github-actions
Copy link

github-actions bot commented Dec 12, 2021

@check-spelling-bot Report

Unrecognized words, please review:

  • Hashtag
Previously acknowledged words that are now absent Accessible Actioncenter Addavirtualdesktop ALIGNLEFT AUTOAPPEND AUTOSIZECOLUMNS available azurewebsites bca BEGINLABELEDIT bfee btn Captureascreenshot CASESENSITIVE checkboxes CHECKCANCELED chrisharris CIEXYZ coc COLUMNCLICK Connectquickaction coords countslabelrenamingfmt countslabelselectedfmt CRename CTriage dchristensen Deduplicate DISPINFO Displayandhidethedesktop djsoref docsmsft dogancelik DOUBLEBUFFER dupenv DWLP Easeof Entireitemname ENUMITEMS estdir EXCLUDEFILES EXCLUDEFOLDERS EXCLUDESUBFOLDERS EXISTINGIMAGERESIZERPATH EXISTINGPOWERRENAMEEXTPATH EXTENIONONLY EXTENSIONONLY FFAA fluentui Fody ftp ftps FULLNAME Gamebar GETDISPINFO GETEMPTYMARKUP gmx HACCEL HDF hdi HDITEM hdlg HDN HDS hitinfo htt ianjoneill IAuto IDrop INDEXTOSTATEIMAGEMASK inprivate installpowertoys IPreview IProgress ITEMSTATEICONCLICK IThumbnail itsme jakeoeding JSX KERNELBASE linecap Linkmenu listbox localhost Lockyour LPDWORD LPNMHDR LPNMHEADER LPNMLISTVIEW LPOLESTR LPPOINT lvc LVCF LVCFMT LVHITTESTINFO LVHT LVIF LVIS LVN LVS LVSIL MARQUEEPROGRESS MATCHMODE Mensching mfreadwrite mfuuid Minimizeallwindows MINMAXINFO NAMEONLY Nefario nitroin NMLVEMPTYMARKUP noactive Noactivewindow npm null nunit ONITEM Openthe OPTIONSGROUP pcelt PCorswitchaccounts pitem plvdi pnm pnmdr pnmlv POINTL polymorpism powertoyswiki ppenum ppsrui PREVIEWGROUP pritudev PROGDLG prpui Prt prui Radiobuttons RDW recyclebin refcount REPLACEWITH Reportx rgelt Rgn Rundialogbox Scn SEARCHFOR SEARCHREPLACEGROUP SHAREIMAGELISTS sidepanel SINGLESEL SORTDOWN spamming spdth sppd sppre spsrif spsrui STATEIMAGEMASK stringstream Switchbetweenvirtualdesktops systray Taskview Temporarilypeekatthedesktop textref THEMECHANGED TIMERID titlecase tsx uifabric uifabricicons ulazy UPDOWNKEYDROPSLIST USEREGEX windevbuildagents winstore XDiff xia XSmall XToolset xunit YDiff Zoomusingmagnifier
Some files were were automatically ignored

These sample patterns would exclude them:

^src/modules/MouseUtils/MouseHighlighter/MouseHighlighter\.vcxproj\.filters$
^src/modules/previewpane/UnitTests-MarkdownPreviewHandler/HelperFiles/MarkdownWithHTMLImageTag\.txt$

You should consider adding them to:

.github/actions/spell-check/excludes.txt

File matching is via Perl regular expressions.

To check these files, more of their words need to be in the dictionary than not. You can use patterns.txt to exclude portions, add items to the dictionary (e.g. by adding them to allow.txt), or fix typos.

To accept these unrecognized words as correct (and remove the previously acknowledged and now absent words), run the following commands

... in a clone of the git@github.com:htcfreek/PowerToys.git repository
on the CpHexFix branch:

update_files() {
perl -e '
my @expect_files=qw('".github/actions/spell-check/expect.txt"');
@ARGV=@expect_files;
my @stale=qw('"$patch_remove"');
my $re=join "|", @stale;
my $suffix=".".time();
my $previous="";
sub maybe_unlink { unlink($_[0]) if $_[0]; }
while (<>) {
if ($ARGV ne $old_argv) { maybe_unlink($previous); $previous="$ARGV$suffix"; rename($ARGV, $previous); open(ARGV_OUT, ">$ARGV"); select(ARGV_OUT); $old_argv = $ARGV; }
next if /^(?:$re)(?:(?:\r|\n)*$| .*)/; print;
}; maybe_unlink($previous);'
perl -e '
my $new_expect_file=".github/actions/spell-check/expect.txt";
use File::Path qw(make_path);
use File::Basename qw(dirname);
make_path (dirname($new_expect_file));
open FILE, q{<}, $new_expect_file; chomp(my @words = <FILE>); close FILE;
my @add=qw('"$patch_add"');
my %items; @items{@words} = @words x (1); @items{@add} = @add x (1);
@words = sort {lc($a)."-".$a cmp lc($b)."-".$b} keys %items;
open FILE, q{>}, $new_expect_file; for my $word (@words) { print FILE "$word\n" if $word =~ /\w/; };
close FILE;
system("git", "add", $new_expect_file);
'
(cat '.github/actions/spell-check/excludes.txt' - <<EOF
$should_exclude_patterns
EOF
) |grep .|
sort -f |
uniq > '.github/actions/spell-check/excludes.txt.temp' &&
mv '.github/actions/spell-check/excludes.txt.temp' '.github/actions/spell-check/excludes.txt'
}

comment_json=$(mktemp)
curl -L -s -S \
  --header "Content-Type: application/json" \
  "https://api.github.com/repos/microsoft/PowerToys/issues/comments/991899019" > "$comment_json"
comment_body=$(mktemp)
jq -r .body < "$comment_json" > $comment_body
rm $comment_json

patch_remove=$(perl -ne 'next unless s{^</summary>(.*)</details>$}{$1}; print' < "$comment_body")
  

patch_add=$(perl -e '$/=undef;
$_=<>;
s{<details>.*}{}s;
s{^#.*}{};
s{\n##.*}{};
s{(?:^|\n)\s*\*}{}g;
s{\s+}{ }g;
print' < "$comment_body")
  

should_exclude_patterns=$(perl -e '$/=undef;
$_=<>;
exit unless s{(?:You should consider excluding directory paths|You should consider adding them to).*}{}s;
s{.*These sample patterns would exclude them:}{}s;
s{.*\`\`\`([^`]*)\`\`\`.*}{$1}m;
print' < "$comment_body" | grep . || true)

update_files
rm $comment_body
git add -u
If you see a bunch of garbage

If it relates to a ...

well-formed pattern

See if there's a pattern that would match it.

If not, try writing one and adding it to the patterns.txt file.

Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

Note that patterns can't match multiline strings.

binary-ish string

Please add a file path to the excludes.txt file instead of just accepting the garbage.

File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

@htcfreek htcfreek marked this pull request as ready for review December 12, 2021 13:38
Comment on lines +313 to +319
// Update hex text box to show code with # and fix cursor position
if (insertHexTextHashtag)
{
HexCode.Text = newValue;
HexCode.Select(HexCode.Text.Length, 0);
insertHexTextHashtag = false;
}
Copy link
Collaborator Author

@htcfreek htcfreek Dec 12, 2021

Choose a reason for hiding this comment

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

@niels9001, @stefansjfw
If you think we get problems with adding hashtag in real time while typing on slow systems, we can think about adding it only when the user switches focus to another control.

Copy link
Collaborator

Choose a reason for hiding this comment

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

yes, I think the better way to do it either on focus to another control , or on flyout closing

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Will do it on focus change in the new pr.

Copy link
Collaborator Author

@htcfreek htcfreek Dec 16, 2021

Choose a reason for hiding this comment

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

@stefansjfw
Do you mean we get in trouble whe the user switches focus to the slider and changes it immediately? (By clicking near the dot and moving it immediately.)

Maybe we should take care on slider value updates befor writing new text into the hex field. 🤔

Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think that will be a problem. But that's why I suggested to add # on flyout closing - it should be safer. We don't need to think about where would focus go and if it's going to affect the text field

var newValue = (sender as TextBox).Text;

// support hex with 3 and 6 characters
var reg = new Regex("^#([0-9A-Fa-f]{3}){1,2}$");
// support hex with 3 or 6 characters and with or without #
Copy link
Collaborator Author

@htcfreek htcfreek Dec 12, 2021

Choose a reason for hiding this comment

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

@stefansjfw , @niels9001
Here we accept three values input but we can't use it correctly. We interpret three values input as the last three values of a six values input.

Should we remove the matching of three digits input or should we add an converter?

I have opened an issue here: #14969

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I personally suggest to block three digits input untils the converter is implemted and the issue is fixed.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not experienced with regex so @stefansfjw can better judge it.

FYI if Color Picker moves to WinUI3 we can remove all of this custom code and use the default WinUI component.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I closed this pr. I will create a new one in the next few weeks for fixing all bugs together. Otherwise we have to change code twice which is imo not necessary

@htcfreek htcfreek changed the title [ColorPicker] Fix hex input without # [ColorPicker] Adjust color ui: Fix hex input without # Dec 12, 2021
@htcfreek htcfreek changed the title [ColorPicker] Adjust color ui: Fix hex input without # [ColorPicker] Fix hex input without # in adjust color ui Dec 12, 2021
Copy link
Collaborator Author

@htcfreek htcfreek left a comment

Choose a reason for hiding this comment

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

(Code layout update if I have to change code before merging again. They are optional.)

insertHexTextHashtag = false;
}

// Update other controls
var converter = new System.Drawing.ColorConverter();

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Suggested change

var converter = new System.Drawing.ColorConverter();

var color = (System.Drawing.Color)converter.ConvertFromString(HexCode.Text);
_ignoreHexChanges = true;
var color = (System.Drawing.Color)converter.ConvertFromString(newValue);
SetColorFromTextBoxes(color);
_ignoreHexChanges = false;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Suggested change
_ignoreHexChanges = false;
_ignoreHexChanges = false;

@htcfreek htcfreek closed this Dec 12, 2021
@htcfreek
Copy link
Collaborator Author

htcfreek commented Dec 12, 2021

Closed PR to do all fixes (Hashtag, 3 values hex input, max length) in one step.

@htcfreek htcfreek deleted the CpHexFix branch December 12, 2021 16:22
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.

None yet

3 participants