project64/Source/Project64/UserInterface/WTLControls
Summate 65a9097980
Allowing a paste into a number field to be trimmed automatically (#2414)
The specific issue I experienced is that Excel/LibreOffice Calc add a newline when you copy the contents of a single cell. This is bad behavior and they should provide a copy option that does not do that, but alas, it's much harder to get that into those applications. This behavior made it impossible to paste an otherwise-valid hex address into the Project64 fields without first putting it into Notepad, deleting the newline, recopying, and then doing the paste from there. If the field was simply text, you can go into the field edit and shift + home to select all and then do a copy, but that does not work for a formula. When you edit the file, it shows the formula instead. Therefore, you have absolutely no way of working around this except pasting it somewhere else and removing the newline manually.

In principle, there's no reason why you wouldn't trim the ends at least. Whitespace on either end is useless to you. However, content being after the newline should be rejected as it was before.

There were two secondary issues in the pasting code that are fixed here: One is that it only sort of collapsed single spaces. So if you had more than one space, spaces still would have ended up in the result. Actually I think the semantics were slightly more insidious, <space><number> would have turned into <number><same number> effectively. The only thing it did was remove the space by duplicating the number. If you had two spaces, then it would have ended up with e.g. <space><number><same number>. The only case where this wouldn't have happened is a space at the end which would have been preserved in the paste.

Secondly, it mutated the clipboard data directly. This would have lead to confusing results where multiple pastes would have had clipboard data in the clipboard itself move from, for example, two spaces to a single space to no spaces at all. The better solution is to preprocess to figure out how big we ultimately want our space-less result to be and stamp out the copy ourselves skipping anything we don't want. Leave the clipboard alone.

If it's desired to preserve single spaces only in the middle, the code will need to be modified a bit.

Co-authored-by: Summate <summate.ssbm@gmail.com>
2024-06-06 14:22:26 +09:30
..
ClistCtrl Project64: Code cleanup 2022-09-26 12:01:54 +09:30
DisplayMode.h Project64: Code cleanup 2022-09-26 12:01:54 +09:30
EditConInput.h Project64: Code cleanup 2022-09-26 12:01:54 +09:30
EditNumber32.cpp Allowing a paste into a number field to be trimmed automatically (#2414) 2024-06-06 14:22:26 +09:30
EditNumber32.h Project64: Code cleanup 2022-09-26 12:01:54 +09:30
GetCWindowText.cpp Project64: Code clean up 2022-09-21 14:46:07 +09:30
GetCWindowText.h Update GetCWindowText.h 2021-03-17 20:47:05 -05:00
HexEditCtrl.cpp Clean up warnings 2023-02-28 10:09:08 +10:30
HexEditCtrl.h Project64: Code cleanup 2022-09-26 12:01:54 +09:30
ModifiedCheckBox.h Project64: Code cleanup 2022-09-26 12:01:54 +09:30
ModifiedComboBox.h Project64: Code cleanup 2022-09-26 12:01:54 +09:30
ModifiedEditBox.cpp Project64: Code clean up 2022-09-21 14:46:07 +09:30
ModifiedEditBox.h Project64: Code cleanup 2022-09-26 12:01:54 +09:30
PartialGroupBox.cpp Project64: Code clean up 2022-09-21 14:46:07 +09:30
PartialGroupBox.h Project64: Code cleanup 2022-09-26 12:01:54 +09:30
TooltipDialog.h Code clean up 2022-10-10 10:52:17 +10:30
wtl-BitmapPicture.cpp Clean up warnings 2023-02-28 10:09:08 +10:30
wtl-BitmapPicture.h Project64: Code cleanup 2022-09-26 12:01:54 +09:30