Axel Dörfler писал 13.01.2013 19:08:There are two unrelated "be:*" entities - first ones are received in RefsReceived second ones are handled as file attributes;
On 01/09/2013 10:00 PM, zharik@xxxxxx wrote:c7087c9: Implement "be:caret_position" document file attribute. * Use "be:caret_position"document file attribute instead of "be:line" and "be:selection_{length|offset}" file attributes;I'm not fond of this solution. For one, it breaks backwards compatibility (even if it's agreeably a minor issue), and also, other applications (like Pe) are using those as well. I would just make it ignore the selection, and always set the cursor to the end or start of the selection.
Those "be:line", "be:selection_start" and "be:selection_length" were used only to provide corresponding info from BeIDE to it's external editor and parsed only in StyledEditApp::RefsReceived. The file attributes I have fixed here were introduced just some weeks ago by Vlad's patch. Neither BeIDE nor Pe use be:line or be:selection*-named attributes to store any information. They are using it's own data structures for preserving cursor position. So we free to use any attribute name we like, IMO.
--- a/src/apps/stylededit/StyledEditApp.cpp +++ b/src/apps/stylededit/StyledEditApp.cpp @@ -266,18 +266,18 @@ StyledEditApp::RefsReceived(BMessage* message) length = -1; } - BMessage* selMessage = NULL; + BMessage* selection = NULL; if (line >= 0 || (start >= 0 && length >= 0)) { - selMessage = new BMessage(UPDATE_LINE_SEL); + selection = new BMessage(UPDATE_LINE_SELECTION); if (line >= 0) - selMessage->AddInt32("be:line", line); + selection->AddInt32("be:line", line); if (start >= 0) { - selMessage->AddInt32("be:selection_offset", start); - selMessage->AddInt32("be:selection_length", max_c(0, length)); + selection->AddInt32("be:selection_offset", start); + selection->AddInt32("be:selection_length", max_c(0, length)); }You still use be:line, and be:selection_* here, btw.
Yes, because we have received this message from BeIDE. ;-) We do not use them for file attrbutes.
-- Kind Regards, S.Zharski