Menu

#1526 [Patch] SCI_AUTOCSETMINWIDTH and SCI_AUTOCGETMINWIDTH

Won't_Implement
open
nobody
scintilla (293)
5
2024-07-17
2024-07-03
No

Here's a patch which adds SCI_AUTOCSETMINWIDTH and SCI_AUTOCGETMINWIDTH enabling containers to optionally specify a minimum width of an autocompletion list expressed as the number of characters. This can be used to give the list a look more similar to the lists used by VS Code and Visual Studio which both use a generous minimum width. (In VS Code it's about 50 characters for both the minimum and maximum width.)

The patch includes updates of Scintilla.iface and ScintillaDoc.html + a new test.

https://github.com/jrsoftware/scintilla/pull/10.patch
https://github.com/jrsoftware/scintilla/pull/10.diff
https://github.com/jrsoftware/scintilla/pull/10/files

Discussion

  • Neil Hodgson

    Neil Hodgson - 2024-07-09

    Why is this worth doing?

     
    • Martijn Laan

      Martijn Laan - 2024-07-09

      To me without a minimum size the list looks quite outdated and oddly small compared to other editors, like the ones I listed.

       
  • Zufu Liu

    Zufu Liu - 2024-07-09

    The change seems has not effect, see ListBoxX::MinClientWidth() and ListBoxX::MaxTrackSize() in PlatWin.cxx.

    or here needs further patches (e.g. extend ListOptions).

     
    • Martijn Laan

      Martijn Laan - 2024-07-09

      ScintillaBase::AutoCompleteStart sets the actual minimum size.

       
      • Zufu Liu

        Zufu Liu - 2024-07-10

        I think WM_GETMINMAXINFO set the min/max size?

        case WM_GETMINMAXINFO: {
                MINMAXINFO *minMax = reinterpret_cast<MINMAXINFO*>(lParam);
                minMax->ptMaxTrackSize = MaxTrackSize();
                minMax->ptMinTrackSize = MinTrackSize();
            }
            break;
        
         

        Last edit: Zufu Liu 2024-07-10
    • Zufu Liu

      Zufu Liu - 2024-07-10

      extend ListOptions

      I thought ListBoxX::MinClientWidth() (used by WM_GETMINMAXINFO) needs updating to make SCI_AUTOCSETMINWIDTH(characterCount) work when characterCount < 12:

      int ListBoxX::MinClientWidth() const noexcept {
          return 12 * (aveCharWidth+aveCharWidth/3);
      }
      
       
  • Martijn Laan

    Martijn Laan - 2024-07-10

    Have you looked at ScintillaBase::AutoCompleteStart?

    It takes the minimum sizes (AutoComplete's own minimum of 100 pixels and the listbox's desired width as returned by GetDesiredRect (which is 15,6 times the average char width on Win32 as returned by ListBoxX::MinClientWidth)) and calculates the final minimum size but taking the maximum.

    In the same place it handles the maximum size set by SCI_AUTOCSETMAXWIDTH.

    So I'm pretty sure that this is the correct place to handle a third minimum size set by SCI_AUTOCSETMINWIDTH and saying the patch has no effect is a strange thing to say because it definitely does. In only does nothing if you set a width lower than the preexisting hardcoded (small) minimum widths which seems like a good thing.

     

    Last edit: Martijn Laan 2024-07-10
    • Zufu Liu

      Zufu Liu - 2024-07-10

      Looks ScintillaBase::AutoCompleteStart() set the initial displayed size, ListBoxX::MinTrackSize() and ListBoxX::MaxTrackSize() set actually min/max size that can be resized.

       
  • Neil Hodgson

    Neil Hodgson - 2024-07-17
    • Group: Initial --> Won't_Implement
     
  • Neil Hodgson

    Neil Hodgson - 2024-07-17

    The application may find the autocompletion list and change its size using the Win32 API.

    Without stronger motivation, I do not see this as being worth implementing. Every feature costs maintenance effort.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.