If there is a selection that doesn't span multiple paragraphs, then the
selection text initializes the find field in native wordpad, otherwise the
last search is used to initialize the field. I added an extra buffer,
since closing the find dialog before doing a search will preserve the last
search state.
Pressing replace should only replace a selected match, and afterwards it
should find the next match. Searches should always start from the start of
the selection, even if the selection is moved in between searches. Searches
wrap at the end of text, and should keep track of whether it has wrapped
from previous searches to determine if it reached the end position.
The rebar is the parent of the ruler, not the top level window, so
GetDlgItem was returning NULL when the window is resized. As a result the
screen was being invalidated and repainted instead of the ruler.
The preview is now drawn onto it's own window rather directly onto
the client area of the top level window. This is done to allow for
scrollbars, since the page won't usually fit in the window when zoomed in.
Refactoring was needed as a result of this, and in order to provide more
granularity for updates to avoid EM_FORMATRANGE messages being sent when
the page the same page is being displayed.
The cbSize field for the REBARBANDINFOW structure was previously set to
the sizeof(REBARBANDINFOW), however, new fields were added to this
structure for newer version of windows. Testing in Windows XP (or with
comctl32.dll from Windows XP) I found this larger size was rejected
causing the rebar to not be displayed in wordpad.
The bug could be seen by inserting tabs stops 1cm, 2cm, & 10cm. The
10cm tab stop would be inserted before 2cm since the comparison isn't
based on the numeric value.
This also reverts commit 2b52dd845097f16076c0185b02a003f63898dcab:
wordpad: Empty the richedit undo buffer on creation.
The reverted commit I created to fix an issue that only applied to Wine,
but it just masked the issue which was in richedit controls. The
default character format was set in two places while wordpad was
starting up, and caused wordpad to have two undo items at startup.
Previously the window size and position was obtained in such a way that
when the window is closed while minimized, it would be hidden when the
program is started again. Closing a maximized window would save the
size of the maximized window and use it as the normal/restored size when
the program is started again.
The combobox to select the alignment in the paragraph format dialog
did not have enough height to display the dropdown list. Also, code was
missing to set the alignment when OK button is pressed. This patch fixes
these issues.
The changes were previously being applied only when the combobox's edit
control lost focus notifying an end edit event. In addition, the
selection of an item from the dropdown list should also cause the
changes to be applied. New functions were created to handle the
duplication in expected behaviour for these two events.