project64/Source/Project64
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
..
Plugins Clean up warnings 2023-02-28 10:09:08 +10:30
Settings Project64: Code cleanup 2022-09-26 12:01:54 +09:30
UserInterface Allowing a paste into a number field to be trimmed automatically (#2414) 2024-06-06 14:22:26 +09:30
res git-svn-id: https://localhost/svn/Project64/trunk@6 111125ac-702d-7242-af9c-5ba8ae61c1ef 2008-11-14 20:51:06 +00:00
N64System.h Project64: Code cleanup 2022-09-26 12:01:54 +09:30
Project64.exe.manifest Use Per monitor scaling where supported 2019-04-15 10:33:54 -07:00
Project64.vcxproj Rename RSP to Project64-rsp 2023-06-15 14:45:27 +09:30
Project64.vcxproj.filters [Debugger] Rewrite script API (#2110) 2021-09-03 14:41:04 +09:30
Support.h Project64: Code cleanup 2022-09-26 12:01:54 +09:30
UserInterface.h Project64: Code cleanup 2022-09-26 12:01:54 +09:30
WTLApp.h Project64: Missed some files in code cleanup 2022-09-26 12:02:33 +09:30
main.cpp Project64: Code clean up 2022-09-21 14:46:07 +09:30
stdafx.cpp Project64: Code clean up 2022-09-21 14:46:07 +09:30
stdafx.h Project64: Code cleanup 2022-09-26 12:01:54 +09:30