"Find in page" combo-box memorization Topic is solved

Talk about code development, features, specific bugs, enhancements, patches, and similar things.
Forum rules
Please keep everything here strictly on-topic.
This board is meant for Pale Moon source code development related subjects only like code snippets, patches, specific bugs, git, the repositories, etc.

This is not for tech support! Please do not post tech support questions in the "Development" board!
Please make sure not to use this board for support questions. Please post issues with specific websites, extensions, etc. in the relevant boards for those topics.

Please keep things on-topic as this forum will be used for reference for Pale Moon development. Expect topics that aren't relevant as such to be moved or deleted.
Robby

"Find in page" combo-box memorization

Unread post by Robby » 2020-11-06, 07:11

Find in page combo-box (Ctrl-F)

One thing I would find very useful would be to have a combo-box instead of an edit control for the "Find in page"
It could remember the last, let say 20 or 50 last search request.
In Windows, CBS_DROPDOWN style with no CBS_SORT could be used to permit a "last in" "top of list" arrangement.
Here is some very bad, untested, and quickly written code that show what I mean...

Regards,
Robby

MaxComboboxListCount = 50;

CharCount == SendMessage(hComboBox, WM_GETTEXTLENGTH, 0, 0); //Get the text length of the combo-box-edit control, excluding the zero terminator
if CharCount //If it is not empty
{
pBuffer == HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, CharCount + 2); //Allocate a buffer to store it
SendMessage(hComboBox, WM_GETTEXT, CharCount + 1, pBuffer); //Copy the text from the combo-box edit control to the buffer, including the zero terminator

while //Eliminate all duplicates, normally, no more than one should be found in the combo-box list.
{
Itemfound == SendMessage(hComboBox, CB_FINDSTRINGEXACT, -1, pBuffer); //Search whole list for duplicate
IF Itemfound == CB_ERR break; //Exit loop when no found...
SendMessage(hComboBox, CB_DELETESTRING, Itemfound, 0); //Delete duplicate
}

//Check if the maximum, item count is reached..
while SendMessage(hComboBox, CB_GETCOUNT, 0, 0) > MaxComboboxListCount
{
SendMessage(hComboBox, CB_DELETESTRING, MaxComboboxListCount, 0); //Keep items count reasonable
}

SendMessage(hComboBox, CB_INSERTSTRING, 0, pBuffer); //Insert the text from the combo-box-edit control first in the combo-box list
HeapFree(GetProcessHeap(), 0, pBuffer); //Free memory
}

User avatar
moonbat
Knows the dark side
Knows the dark side
Posts: 4980
Joined: 2015-12-09, 15:45
Contact:

Re: "Find in page" combo-box memorization

Unread post by moonbat » 2020-11-06, 09:13

This is why the browser is fully extensible unlike its shitty competition. You can write an extension that overlays the findbar to display a combo box instead of a textbox and override the existing logic all using XUL and Javascript; there is no need to delve into C++ like that.
Further bonus, this feature becomes available only to those who want it and those who are happy with the existing behavior don't have their browser bloated with unnecessary additional code for a feature that is of no use to them.

Take a look at this extension, examine the code and refer to the XUL Tutorial to get started.
"One hosts to look them up, one DNS to find them and in the darkness BIND them."

Image
Linux Mint 21 Xfce x64 on HP i5-5200 laptop, 12 GB RAM.
AutoPageColor|PermissionsPlus|PMPlayer|Pure URL|RecordRewind|TextFX

Robby

Re: "Find in page" combo-box memorization

Unread post by Robby » 2020-11-07, 00:37

This looks really, really interesting...
Thanks

User avatar
moonbat
Knows the dark side
Knows the dark side
Posts: 4980
Joined: 2015-12-09, 15:45
Contact:

Re: "Find in page" combo-box memorization

Unread post by moonbat » 2020-11-07, 04:04

Also see the XUL School Tutorial, it is a little more newbie friendly and takes you through setting up a dev environment as well.
"One hosts to look them up, one DNS to find them and in the darkness BIND them."

Image
Linux Mint 21 Xfce x64 on HP i5-5200 laptop, 12 GB RAM.
AutoPageColor|PermissionsPlus|PMPlayer|Pure URL|RecordRewind|TextFX

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35602
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: "Find in page" combo-box memorization

Unread post by Moonchild » 2020-11-07, 09:10

Closing this as a core browser suggestion entry -- extension's the way to go.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

Locked