Community
    • 登入

    How to get Vertical Edge Settings programmatically?

    已排程 已置頂 已鎖定 已移動 Notepad++ & Plugin Development
    13 貼文 3 Posters 1.3k 瀏覽
    正在載入更多貼文
    • 從舊到新
    • 從新到舊
    • 最多點贊
    回覆
    • 在新貼文中回覆
    登入後回覆
    此主題已被刪除。只有擁有主題管理權限的使用者可以查看。
    • Derek BrownD
      Derek Brown
      最後由 編輯

      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?

      Alan KilbornA 1 條回覆 最後回覆 回覆 引用 0
      • Alan KilbornA
        Alan Kilborn @Derek Brown
        最後由 編輯

        @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 條回覆 最後回覆 回覆 引用 0
        • Derek BrownD
          Derek Brown
          最後由 編輯

          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?

          Alan KilbornA 1 條回覆 最後回覆 回覆 引用 0
          • Alan KilbornA
            Alan Kilborn @Derek Brown
            最後由 編輯

            @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 條回覆 最後回覆 回覆 引用 0
            • Derek BrownD
              Derek Brown
              最後由 編輯

              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.

              Alan KilbornA 1 條回覆 最後回覆 回覆 引用 1
              • Alan KilbornA
                Alan Kilborn @Derek Brown
                最後由 編輯

                @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.
                :-(

                EkopalypseE 1 條回覆 最後回覆 回覆 引用 0
                • EkopalypseE
                  Ekopalypse @Alan Kilborn
                  最後由 編輯

                  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 條回覆 最後回覆 回覆 引用 0
                  • Derek BrownD
                    Derek Brown
                    最後由 Derek Brown 編輯

                    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.

                    EkopalypseE 1 條回覆 最後回覆 回覆 引用 1
                    • EkopalypseE
                      Ekopalypse
                      最後由 Ekopalypse 編輯

                      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 條回覆 最後回覆 回覆 引用 0
                      • EkopalypseE
                        Ekopalypse @Derek Brown
                        最後由 編輯

                        @Derek-Brown

                        just tried it with SendMessage and I do get back 80

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

                        1 條回覆 最後回覆 回覆 引用 0
                        • EkopalypseE
                          Ekopalypse
                          最後由 Ekopalypse 編輯

                          @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 條回覆 最後回覆 回覆 引用 0
                          • EkopalypseE
                            Ekopalypse
                            最後由 編輯

                            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 條回覆 最後回覆 回覆 引用 0
                            • EkopalypseE
                              Ekopalypse
                              最後由 編輯

                              @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 條回覆 最後回覆 回覆 引用 1
                              • 第一個貼文
                                最後的貼文
                              The Community of users of the Notepad++ text editor.
                              Powered by NodeBB | Contributors