-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
Add ability to do leading spaces with ColumnEditor #13336
Conversation
Second commit changes |
Tested the PR code: none | zeros | spaces
0 0 0 0 | 00 00 00 00000 | 0 0 0 0
1 1 1 1 | 01 01 01 00001 | 1 1 1 1
2 2 2 10 | 02 02 02 00010 | 2 2 2 10
3 3 3 11 | 03 03 03 00011 | 3 3 3 11
4 4 4 100 | 04 04 04 00100 | 4 4 4 100
5 5 5 101 | 05 05 05 00101 | 5 5 5 101
6 6 6 110 | 06 06 06 00110 | 6 6 6 110
7 7 7 111 | 07 07 07 00111 | 7 7 7 111
8 8 10 1000 | 08 08 10 01000 | 8 8 10 1000
9 9 11 1001 | 09 09 11 01001 | 9 9 11 1001
10 A 12 1010 | 10 0A 12 01010 | 10 A 12 1010
11 B 13 1011 | 11 0B 13 01011 | 11 B 13 1011
12 C 14 1100 | 12 0C 14 01100 | 12 C 14 1100
13 D 15 1101 | 13 0D 15 01101 | 13 D 15 1101
14 E 16 1110 | 14 0E 16 01110 | 14 E 16 1110
15 F 17 1111 | 15 0F 17 01111 | 15 F 17 1111
16 10 20 10000 | 16 10 20 10000 | 16 10 20 10000 |
Very nice. 👍 Just another interesting case (NOT caused by this PR): |
That was noticed, but since it wasn't related to the change, I didn't worry about it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please follow the suggestions.
If the last selected section is "Text", we have "number" in config.xml. And vice-versa. notepad-plus-plus/PowerEditor/src/Parameters.cpp Line 2497 in 5645ca1
notepad-plus-plus/PowerEditor/src/Parameters.cpp Line 4095 in 5645ca1
It seems the values should be swapped. |
I'd say a resounding YES! |
@donho, if it builds (still building as I type this), then this PR is ready for re-review. |
@@ -57,7 +57,15 @@ intptr_t CALLBACK ColumnEditorDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR | |||
::SendDlgItemMessage(_hSelf, IDC_COL_LEADING_COMBO, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(TEXT("None"))); | |||
::SendDlgItemMessage(_hSelf, IDC_COL_LEADING_COMBO, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(TEXT("Zeros"))); | |||
::SendDlgItemMessage(_hSelf, IDC_COL_LEADING_COMBO, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(TEXT("Spaces"))); | |||
::SendMessage(::GetDlgItem(_hSelf, IDC_COL_LEADING_COMBO), CB_SETCURSEL, colEditParam._leadingChoice, 0); | |||
WPARAM curSel = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May I ask why this block is necessary?
Can't leadingChoice
be int
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don wanted the "leading choice" to be an enum (see Don's prior comments). My goal here was to fully uncouple things. Again, I can't read Don's mind as to how "far" to take such things, so I proceeded on the presumption of this type of decoupling being wanted. I really have no idea. If the future gets "sticky" for me on this PR, I will abandon it and close it; of course an outright rejection will do that just as well, also. :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don wanted the "leading choice" to be an enum
I meant to ask why the enum couldn't be int
. :)
Well, let's for Don's review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea, the way I read it was Don specifically wanted enum
.
But maybe his real intent was to just not have two bool. I do understand the desire to not have two bool; indeed I only went with 2 bool in the beginning in an effort to change as little as possible.
The high volume of changed lines in this makes me uncomfortable -- not at a C++ level, but at a "this is someone else's project" level.
I see others aren't afraid to change a lot of lines; I think a lot of changes are more acceptable if the feature is really wanted.
I'm truly sorry that I got involved in this one; my intent was to stay with smaller changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm glad you got involved in this one. - You did a great job. 👍
I'm sorry you didn't enjoy working on it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My main question was why the switch (colEditParam._leadingChoice) block was necessary.
"Necessary" might be a strong word, here. :-)
We can do things in a "hacky" way, and sure, that has been done in the past.
The code (that I think) you are questioning was changed to fully decouple the integer values of the combobox selection indices and the "values" of the enum
type.
With this, the code for this line:
enum leadingChoice : UCHAR { noneLeading, zeroLeading, spaceLeading };
could be changed to this without any runtime difference:
enum leadingChoice : UCHAR { noneLeading=27, zeroLeading=45, spaceLeading=106 };
(Probably the UCHAR
should be eliminated; this is a carryover of my habit because I work on smallish embedded systems where every byte can matter.)
Don seemed to want an enum
; when he requested this change, I provided, in a better and more complete fashion than an earlier commit (earlier commits aren't really relevant when changes are requested and made).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Edit: oups, I misread your comment. Good job, it's what it needs.
Thank you, Don, encouragement to your contributors that they are doing the right thing is very helpful indeed!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the explanation. 👍
You're a very good coder, and I was trying to understand and learn your approach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Yaron10
It's true that I (as a lazy dev) I would do the following without switch:
enum leadingChoice { noneLeading = 0, zeroLeading = 1, spaceLeading = 2};
::SendMessage(::GetDlgItem(_hSelf, IDC_COL_LEADING_COMBO), CB_SETCURSEL, (WPARAM)colEditParam._leadingChoice, 0);
The @alankilborn 's way guarantees strongly the value must be "> 3" & "<= 0".
As I always check both side while crossing the one way road IRL, I can understand his approach - and since it's not redundant, it's OK to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "lazy approach" was what I had in mind.
Thank you for the detailed explanation. 👍
If the Format is Hex, Initial Number is What do you think? |
notepad-plus-plus/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp Lines 178 to 179 in c59c07b
If the hex number needs an odd number of digits for display, it is increased to the next even number of digits -- no idea why this would be this way; this PR isn't related. |
Yes, it's not related to this PR. Thank you. |
I reread that now and I'm so confused. |
You asked for my opinion in that thread, and I raised that point as a side-note. |
OK... I don't think the current issue and PR can/should be a catch-all to all wacky behavior with Column Editor. I think current issue and PR should address the basic deficiency (of not currently -- 8.5.1 -- being able to insert numbers with leading spaces) and that other behavior should be addressed separately. I suggest waiting until this PR is integrated/rejected and then making issues on further defects. |
Fix #11148 ; fix #13309 .