• Login
Community
  • Login

How to get Vertical Edge Settings programmatically?

Scheduled Pinned Locked Moved Notepad++ & Plugin Development
13 Posts 3 Posters 630 Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D
    Derek Brown
    last edited by Apr 30, 2020, 4:53 PM

    You used to be able to use SCI_GETEDGECOLUMN, but in v7.8.6 NP++ changed to using multiline mode for the vertical edge, and this message does not work with multiline mode.

    Is there a way to programmatically get the vertical edge now?

    A 1 Reply Last reply Apr 30, 2020, 5:11 PM Reply Quote 0
    • A
      Alan Kilborn @Derek Brown
      last edited by Apr 30, 2020, 5:11 PM

      @Derek-Brown said in How to get Vertical Edge Settings programmatically?:

      Is there a way to programmatically get the vertical edge now?

      There doesn’t appear to be; here’s the extent of the Scintilla functions regarding the vertical edge:

      SCI_SETEDGEMODE(int edgeMode)
      SCI_GETEDGEMODE → int
      SCI_SETEDGECOLUMN(position column)
      SCI_GETEDGECOLUMN → position
      SCI_SETEDGECOLOUR(colour edgeColour)
      SCI_GETEDGECOLOUR → colour
      SCI_MULTIEDGEADDLINE(position column, colour edgeColour)
      SCI_MULTIEDGECLEARALL

      I got this from HERE .

      Note that you can “add” and “clear all” for multi-edge mode, but there is no corresponding “get”.

      1 Reply Last reply Reply Quote 0
      • D
        Derek Brown
        last edited by Apr 30, 2020, 5:20 PM

        Yeah there’s definitely no way in the Scintilla messages. I was wondering if there was another solution that was supported, it would have to be something implemented in NP++ specifically. As a possibility, are the NP++ settings exposed to plugins in a useful way?

        A 1 Reply Last reply Apr 30, 2020, 5:26 PM Reply Quote 0
        • A
          Alan Kilborn @Derek Brown
          last edited by Apr 30, 2020, 5:26 PM

          @Derek-Brown said in How to get Vertical Edge Settings programmatically?:

          are the NP++ settings exposed to plugins in a useful way?

          I’m not sure about that but someone else will know.
          Even if they are exposed, I would think that this new multiple vertical edge stuff is too new to be supported yet in that way.

          May I ask what you’re really wanting to do?
          I use the single vertical edge in my setup, but I have Notepad++'s management of it completely turned off. I’m doing what I do via Pythonscript.
          I would think you could do something similar, but without knowing anything further I can’t say for sure.

          1 Reply Last reply Reply Quote 0
          • D
            Derek Brown
            last edited by Apr 30, 2020, 5:33 PM

            My CommentWrap plugin reads the vertical edge setting by default to decide at what column to wrap comments. This column can also be manually set, so it’s not a huge problem that it’s broken right now, but I would like to restore the functionality.

            A 1 Reply Last reply Apr 30, 2020, 6:35 PM Reply Quote 1
            • A
              Alan Kilborn @Derek Brown
              last edited by Apr 30, 2020, 6:35 PM

              @Derek-Brown

              Ah, okay then.
              What I do won’t help that situation.

              It does seem like a Scintilla oversight to allow setting of multiple edges without having a readback mechanism. Perhaps you want to have a look at the Scintilla issues list, maybe open an issue if there isn’t one.

              But, sadly, I suppose I am the one that broke your plugin.
              I’m sorry.
              :-(

              E 1 Reply Last reply Apr 30, 2020, 7:08 PM Reply Quote 0
              • E
                Ekopalypse @Alan Kilborn
                last edited by Apr 30, 2020, 7:08 PM

                Yes, there doesn’t seem to be a call which is able to get every column
                position set but the call itself seems to report the position from the first column.

                bfe64559-5ff0-415f-8e6c-0c3d8c2b03b6-image.png

                Maybe @donho might consider implementing a new message
                NPPM_GETEDGECOLUMNS and returning an array of ints?

                1 Reply Last reply Reply Quote 0
                • D
                  Derek Brown
                  last edited by Derek Brown Apr 30, 2020, 7:21 PM Apr 30, 2020, 7:20 PM

                  How is that call implemented? When I call in C++:

                  SendMessage(scintillaHwnd, SCI_GETEDGECOLUMN, 0, 0)
                  

                  With edges set at 80 and 120 I get back 0.

                  E 1 Reply Last reply Apr 30, 2020, 7:32 PM Reply Quote 1
                  • E
                    Ekopalypse
                    last edited by Ekopalypse Apr 30, 2020, 7:27 PM Apr 30, 2020, 7:26 PM

                    hmm, strange - basically doing the same as you do

                    sci.call = <SciFnDirect>SendMessageW(hwnd, SCI_GETDIRECTFUNCTION, 0, 0)
                    
                        cpdef ssize_t getEdgeColumn(self):
                            ''' Retrieve the column number which text should be kept within. '''
                            return <ssize_t>self.call(<sptr_t>self.sci_pointer, SCI_GETEDGECOLUMN, 0, 0)
                    

                    EDIT: except that I’m using the direct function

                    1 Reply Last reply Reply Quote 0
                    • E
                      Ekopalypse @Derek Brown
                      last edited by Apr 30, 2020, 7:32 PM

                      @Derek-Brown

                      just tried it with SendMessage and I do get back 80

                      a97b4b49-972f-4867-bc79-a0c19ce5ab1b-image.png

                      1 Reply Last reply Reply Quote 0
                      • E
                        Ekopalypse
                        last edited by Ekopalypse Apr 30, 2020, 7:35 PM Apr 30, 2020, 7:35 PM

                        @Derek-Brown
                        WAIT - there seems to be something wrong with MY code.
                        Because I set a different value (87) and I still do get back 80.

                        1 Reply Last reply Reply Quote 0
                        • E
                          Ekopalypse
                          last edited by Apr 30, 2020, 7:43 PM

                          No, nothing wrong with my code but I guess there is another level of potential confusion.
                          It reports back what is configured in Number of columns

                          d318d867-d3de-4ed2-9371-a0da25f0e1d0-image.png

                          1 Reply Last reply Reply Quote 0
                          • E
                            Ekopalypse
                            last edited by Apr 30, 2020, 7:53 PM

                            @Derek-Brown @Alan-Kilborn

                            ok - sorry for the noise. I didn’t use the latest 7.8.6 iteration.
                            I was still running a RC version. In the final version it does what @Derek-Brown said.

                            cf91dd3a-0ff5-49df-a6a6-88df99e7d8e6-image.png

                            1 Reply Last reply Reply Quote 1
                            6 out of 13
                            • First post
                              6/13
                              Last post
                            The Community of users of the Notepad++ text editor.
                            Powered by NodeBB | Contributors