I think I understand the situation.
Since '\0' (hex 00) means end of the string in ASCII, program stop writing...
Because you cannot have "\0" string in ASCII.
I actually can't decide what can I make to replace this character... Because you are trying to copy "non-ascii" character as a ASCII... There will be problems like that... If I move this string as a binary to memory, than you cannot paste it to any text document. If I replace the character while I copying, than there will be corruption on paste of that ASCII string.
What you wanted to have? I think I needed to inspect other programs to identify what is the default approach to this problem. Thanks.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
What you wanted to have?
I don't know.
Since the \0 is displayed as a . maybe it could be converted into a real . and there could be a warning message. The warning message window could have a "don't warn me next time" checkbox, but I think the value should not be stored (i.e. if you close wxHexEditor, next time you run it the warning message should be displayed again).
Or maybe the normal copy/paste functions could move the string as a binary, and there could be a separate "copy as ASCII" and "paste ASCII" function for if someone needs to paste to or from a text document.
I think I needed to inspect other programs to
identify what is the default approach to this problem.
Yes, that's a good idea.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Firstly I put a "filter" for characters that cannot displayed at default font... So, \0's real representation is not "." but I make it...
About copying something, we needed to put a "text" to clipboard. Because if we don't copy to text to clipboard, you cannot paste that information to some other utility like notepad... Because utilities looking for "test clipboard" area when pasting...
There is multiple clipboards one for text, one for pictures, other one is for binary objects(?). So using "paste as ASCII" has no sense from this aspect. Because at clipboard, we needed to have "ASCII representation" of that data. If I use "binary" clipboard, than you cannot use that "clipboard" actually. I use "hex" copy/pasting for binary copy/paste actions...
But it's also required to have binary copy for internal processes. Clipboard has a limits. If selection is larger than 10MB program will try to copy that info by using internal clipboard. I don't remember if I implement that but I thought to make it...
I think best way is inspecting other utilities and follow the same pattern... If other utilities has same "fault" than we could switch our way. Your offer is good but I it might be problematic on coding... At least for now because there is no "preferences" dialog available at program. We needed to make one and store that settings in it. But there is more important things is missing already. Needed to complete them first. (Like full functional find dialog)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I think best way is inspecting other utilities and follow the same
pattern.
Yes, probably.
But there is more important things is missing already. Needed to complete them first. (Like full functional find dialog).
They might be more important missing features, but this issue can be very confusing for users. How about including this patch for now?
--- trunk/src/HexEditor.cpp.old 2010-10-31 03:38:07.000000000 +1300
+++ trunk/src/HexEditor.cpp 2010-10-31 03:28:45.000000000 +1300
@@ -984,6 +984,13 @@
{
copy_mark->m_buffer.AppendByte('\0');
CopyString << wxString::FromAscii( static_cast<const char*="">(copy_mark->m_buffer.GetData()) );
+ wxMessageBox(( "WARNING:\n"\
+ "When copying from the text pane the copy will\n"\
+ "be truncated if the selection contains a null\n"\
+ "character (00 in the hex pane)!\n\n"
+ "If copying between two files you should copy\n"\
+ "from the Hex pane."),
+ ("Warning"), wxOK|wxICON_INFORMATION, this);
}
return copy_mark->SetClipboardData( CopyString );
}</const>
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
--- trunk/src/HexEditor.cpp.old 2010-10-31 03:38:07.000000000 +1300
+++ trunk/src/HexEditor.cpp 2010-10-31 04:11:12.000000000 +1300
@@ -984,6 +984,14 @@
{
copy_mark->m_buffer.AppendByte('\0');
CopyString << wxString::FromAscii( static_cast<const char*="">(copy_mark->m_buffer.GetData()) );
+ if( select->GetSize() > CopyString.size() ){
+ wxMessageBox(( "WARNING:\n"\
+ "The text you are copying includes a null character\n"\
+ "(00 in the hex pane) and will be truncated!\n\n"\
+ "If copying to another file in wxHexEditor you\n"\
+ "should copy from the Hex pane, not the text pane"),
+ ("Warning"), wxOK|wxICON_INFORMATION, this);
+ }
}
return copy_mark->SetClipboardData( CopyString );
}</const>
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Sorry, I realise code posted in the comments loses its indentation, but I can't see any way to attach a file. Maybe I don't have permissions for that...?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Doesn't matter. If you mind, I can add you as project member with SVN write access.
I feel that program is too buggy to fix by for just one developer...
:)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Sorry, that was me again - I forgot to log in.
I think I understand the situation.
Since '\0' (hex 00) means end of the string in ASCII, program stop writing...
Because you cannot have "\0" string in ASCII.
I actually can't decide what can I make to replace this character... Because you are trying to copy "non-ascii" character as a ASCII... There will be problems like that... If I move this string as a binary to memory, than you cannot paste it to any text document. If I replace the character while I copying, than there will be corruption on paste of that ASCII string.
What you wanted to have? I think I needed to inspect other programs to identify what is the default approach to this problem. Thanks.
Firstly I put a "filter" for characters that cannot displayed at default font... So, \0's real representation is not "." but I make it...
About copying something, we needed to put a "text" to clipboard. Because if we don't copy to text to clipboard, you cannot paste that information to some other utility like notepad... Because utilities looking for "test clipboard" area when pasting...
There is multiple clipboards one for text, one for pictures, other one is for binary objects(?). So using "paste as ASCII" has no sense from this aspect. Because at clipboard, we needed to have "ASCII representation" of that data. If I use "binary" clipboard, than you cannot use that "clipboard" actually. I use "hex" copy/pasting for binary copy/paste actions...
But it's also required to have binary copy for internal processes. Clipboard has a limits. If selection is larger than 10MB program will try to copy that info by using internal clipboard. I don't remember if I implement that but I thought to make it...
I think best way is inspecting other utilities and follow the same pattern... If other utilities has same "fault" than we could switch our way. Your offer is good but I it might be problematic on coding... At least for now because there is no "preferences" dialog available at program. We needed to make one and store that settings in it. But there is more important things is missing already. Needed to complete them first. (Like full functional find dialog)
Hi again,
--- trunk/src/HexEditor.cpp.old 2010-10-31 03:38:07.000000000 +1300
+++ trunk/src/HexEditor.cpp 2010-10-31 03:28:45.000000000 +1300
@@ -984,6 +984,13 @@
{
copy_mark->m_buffer.AppendByte('\0');
CopyString << wxString::FromAscii( static_cast<const char*="">(copy_mark->m_buffer.GetData()) );
+ wxMessageBox(( "WARNING:\n"\
+ "When copying from the text pane the copy will\n"\
+ "be truncated if the selection contains a null\n"\
+ "character (00 in the hex pane)!\n\n"
+ "If copying between two files you should copy\n"\
+ "from the Hex pane."),
+ ("Warning"), wxOK|wxICON_INFORMATION, this);
}
return copy_mark->SetClipboardData( CopyString );
}</const>
Actually, here is a better patch:
--- trunk/src/HexEditor.cpp.old 2010-10-31 03:38:07.000000000 +1300
+++ trunk/src/HexEditor.cpp 2010-10-31 04:11:12.000000000 +1300
@@ -984,6 +984,14 @@
{
copy_mark->m_buffer.AppendByte('\0');
CopyString << wxString::FromAscii( static_cast<const char*="">(copy_mark->m_buffer.GetData()) );
+ if( select->GetSize() > CopyString.size() ){
+ wxMessageBox(( "WARNING:\n"\
+ "The text you are copying includes a null character\n"\
+ "(00 in the hex pane) and will be truncated!\n\n"\
+ "If copying to another file in wxHexEditor you\n"\
+ "should copy from the Hex pane, not the text pane"),
+ ("Warning"), wxOK|wxICON_INFORMATION, this);
+ }
}
return copy_mark->SetClipboardData( CopyString );
}</const>
Sorry, I realise code posted in the comments loses its indentation, but I can't see any way to attach a file. Maybe I don't have permissions for that...?
Doesn't matter. If you mind, I can add you as project member with SVN write access.
I feel that program is too buggy to fix by for just one developer...
:)
OK, if you like.
I'm not really a developer, so I'll need to stick to small fixes only.
Added you as project member. :) Welcome.
Also put your code to svn.
Thanks :)
Great, thanks.