Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Found text not always highlighted by Replace dialog on Windows #62790

Closed
SarahPythonista mannequin opened this issue Jul 29, 2013 · 11 comments
Closed

Found text not always highlighted by Replace dialog on Windows #62790

SarahPythonista mannequin opened this issue Jul 29, 2013 · 11 comments
Assignees
Labels
OS-windows topic-IDLE type-bug An unexpected behavior, bug, or error

Comments

@SarahPythonista
Copy link
Mannequin

SarahPythonista mannequin commented Jul 29, 2013

BPO 18590
Nosy @rhettinger, @terryjreedy, @bitdancer, @roseman, @SarahPythonista
Dependencies
  • bpo-17511: Idle find function closes after each find operation
  • Superseder
  • bpo-29382: IDLE search and replace should use 'hit' tag instead of 'hilite'
  • Files
  • SearchDialogPatch.patch: Patch for 'search' (aka 'find') dialog (will add patch for 'replace' dialog momentarily)
  • ReplaceDialogPatch.patch: ReplaceDialog patch
  • replace_find_hit.diff
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/terryjreedy'
    closed_at = <Date 2017-01-28.03:38:53.179>
    created_at = <Date 2013-07-29.20:09:25.683>
    labels = ['expert-IDLE', 'type-bug', 'OS-windows']
    title = 'Found text not always highlighted by Replace dialog on Windows'
    updated_at = <Date 2017-01-28.03:38:53.178>
    user = 'https://github.com/SarahPythonista'

    bugs.python.org fields:

    activity = <Date 2017-01-28.03:38:53.178>
    actor = 'terry.reedy'
    assignee = 'terry.reedy'
    closed = True
    closed_date = <Date 2017-01-28.03:38:53.179>
    closer = 'terry.reedy'
    components = ['IDLE', 'Windows']
    creation = <Date 2013-07-29.20:09:25.683>
    creator = 'Sarah'
    dependencies = ['17511']
    files = ['31077', '31078', '37503']
    hgrepos = []
    issue_num = 18590
    keywords = ['patch']
    message_count = 11.0
    messages = ['193895', '193897', '219546', '228259', '232909', '232926', '232929', '232990', '250236', '252840', '286396']
    nosy_count = 6.0
    nosy_names = ['rhettinger', 'terry.reedy', 'r.david.murray', 'markroseman', 'Sarah', 'Saimadhav.Heblikar']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = '29382'
    type = 'behavior'
    url = 'https://bugs.python.org/issue18590'
    versions = ['Python 2.7', 'Python 3.3', 'Python 3.4']

    @SarahPythonista
    Copy link
    Mannequin Author

    SarahPythonista mannequin commented Jul 29, 2013

    In Windows, the 'find' and 'replace' dialogs do not work properly on text that has been commented out using quotation marks.

    More specifically, the dialog *finds* the text in question, however, it does not *highlight* it. Without the highlighting, a user can't see which text has been found. Since the whole point of the find function is to show the user where the text is located, this is a bug.

    Credit for the fix goes to Roger Serwy, who suggested raising the hit tag.

    My patch uses the show_hit function from patch 17511*. I have included the show_hit function, but not the rest of patch 17511.

    Are there guidelines for submitting patches that utilize elements of other patches?

    *show_hit is originally from the ReplaceDialog. 17511 added it to SearchDialog

    @SarahPythonista SarahPythonista mannequin added topic-IDLE OS-windows type-bug An unexpected behavior, bug, or error labels Jul 29, 2013
    @bitdancer
    Copy link
    Member

    Yes, we make the issue have a dependency on the issue it is using. I have done that for this one.

    @terryjreedy
    Copy link
    Member

    I closed bpo-18590 as a duplicate of this.

    @terryjreedy
    Copy link
    Member

    The patch for bpo-17511 did not solve the issue; I proposed a revision in bpo-22179. A patch for that may fix this also.

    @terryjreedy
    Copy link
    Member

    I should note that in msg225543 of bpo-22179, I verified that there is a problem in Replace for highlighting found text within quotes, as well as in keywords, until the dialog is closed. On the other hand, the same text is hihglighted in identifiers, plain code, buildin names, and comments. This might be an issue of stacking order. Merely using replace.show_hit in search also will not solve this.

    @terryjreedy terryjreedy self-assigned this Dec 18, 2014
    @terryjreedy
    Copy link
    Member

    I am narrowing the scope of this issue to Replace dialogs and widening the scope to output as well as edit windows. The attached patch solves the issue as redefined. (It has a temporary hack to pass the unittests.)

    For edit windows, the problem is that the default tag stacking order seems to be alphabetical. No tag, 'builtin, 'comment', and 'definition, are followed and dominated by 'hit'; 'keyword' and 'string' come after and dominate 'hit'. The solution is to raise 'hit' to the top. The test (from msg225543), which should be added to htest), is that all 6 'i's in "def i(): this list is 'is' # is not" are both found and highlighted. They are with the patch.

    For output windows, the problem, mentioned in msg225382, is that the 'hit' tag is configured in ColorDelegator, which is not used in output windows. Ths solution, also mentioned there, is to move the configuration to SearchDialogBase. The path does this and Replace dialog Find work for Output Windows.

    I tested on Windows. I am 99.9% sure there should be no problem on other systems, but would like confirmation on other systems before or after committing an expanded patch with test changes added.

    @terryjreedy terryjreedy changed the title 'Search' and 'Replace' dialogs don't work on quoted text in Windows Found text not always highlighted by Replace dialog Dec 19, 2014
    @terryjreedy
    Copy link
    Member

    Additional notes: Sarah's Replace patch consists of the tag raise. I just verified the reason why it works and moved it to the dialog base to include output windows and soon, Search dialogs. Sarah, if you do not provide a 'family' name, I will list you in Misc/ACKS, in alphabetical position, as just 'Sarah'. Or are you already in that file?

    Currently, Replace dialog Find hits are tagged with both the 'hit' and the 'sel' tag, which does not show on Windows as long as the dialog is the active window, but apparently does on other systems. Raising the hit tag to the top (either patch) means that the visible highlight on other systems will change from 'selected' to 'found' (which are independently configurable in Idle preferences).

    If this not desired, the patch could be altered to use tag 'hit' on Windows and 'sel' elsewhere; change 'hit' (on Windows) to 'sel' when the dialog is closed; and configure 'hit' to look like 'sel' (so there is no visible change when closing, as on other systems).

    On Windows, only one slice can be selected and I presume this is true on other systems. If so, a non-'sel' tag is needed on all systems to tag multiple hits. I would like to auto-highlight all hits in grep output windows and add an explicit 'find in current file' option (though it is possible now by adding the file name to the search path).

    Raymond, I added you as nosy since this is an appearance change issue that you might possibly have an opinion on, and I would prefer getting it before a change is released in January If I am wrong, un-nosy yourself.

    @terryjreedy terryjreedy changed the title Found text not always highlighted by Replace dialog Found text not always highlighted by Replace dialog on Windows Dec 19, 2014
    @SaimadhavHeblikar
    Copy link
    Mannequin

    SaimadhavHeblikar mannequin commented Dec 21, 2014

    I tested for the behaviour described in msg193895 before and after your patch. Everything remains same except as what you mentioned.

    Currently, Replace dialog Find hits are tagged with both the 'hit' and the 'sel' tag, which does not show on Windows as long as the dialog is the active window, but apparently does on other systems. Raising the hit tag to the top (either patch) means that the visible highlight on other systems will change from 'selected' to 'found' (which are independently configurable in Idle preferences).

    If this not desired, the patch could be altered to use tag 'hit' on Windows and 'sel' elsewhere; change 'hit' (on Windows) to 'sel' when the dialog is closed; and configure 'hit' to look like 'sel' (so there is no visible change when closing, as on other systems).

    It would be better to ensure that there is no visible change when closing.

    @roseman
    Copy link
    Mannequin

    roseman mannequin commented Sep 8, 2015

    See bpo-24972 for fix

    @terryjreedy
    Copy link
    Member

    bpo-24972 fixes the immediate issue but the Find and Replace code are needlessly different in doing the same thing and redundant in double tagging found text, and there are some other glitches. I think a better fix will be to only use the found tag, but this needs discussion, perhaps on idle-dev. bpo-22179 also has some discussion.

    @terryjreedy
    Copy link
    Member

    Since the original bug for this issue has been fixed, I am closing it in favor of bpo-29392

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    OS-windows topic-IDLE type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants