[haiku-commits] Re: haiku: hrev45144 - src/apps/stylededit

  • From: Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 13 Jan 2013 19:08:27 +0100

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.

--- 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.

Bye,
   Axel.


Other related posts: