Fix: Garbage string when searching in menu #112719

Closed
Pratik Borhade wants to merge 3 commits from PratikPB2123:search-type-query into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Member

In debug mode, garbage string is displayed when searching in menu.
This is because utf8_buf was copied to initial query property
string.

In debug mode, garbage string is displayed when searching in menu. This is because `utf8_buf` was copied to `initial query` property string.
Pratik Borhade added 1 commit 2023-09-22 14:13:13 +02:00
e48aa3b67e Fix: Garbage string when searching in panels
In debug mode, garbage string is displayed when searching in panels.
This is because `utf8_buf` was copied to `initial query` property
string.
Pratik Borhade requested review from Jacques Lucke 2023-09-22 14:13:21 +02:00
Author
Member

Not sure if this is replicable on other systems but I've been observing this for last 4-5 days

Not sure if this is replicable on other systems but I've been observing this for last 4-5 days
Member

This is not quite right. We need the initial_query, otherwise the search will start out empty which is not intended. The question is why there is some garbage in the buffer.

This is not quite right. We need the `initial_query`, otherwise the search will start out empty which is not intended. The question is why there is some garbage in the buffer.
Member

I've noticed this too, thanks for looking into it! But I think it's searching in menus rather than panels, just to be picky about the naming ;)

I've noticed this too, thanks for looking into it! But I think it's searching in menus rather than panels, just to be picky about the naming ;)
Author
Member

This is not quite right. We need the initial_query, otherwise the search will start out empty which is not intended

I might be misunderstanding something but when we press some key to invoke search operation, shouldn't the text field be empty by default?

But I think it's searching in menus rather than panels, just to be picky about the naming

Sorry for that 😅

> This is not quite right. We need the initial_query, otherwise the search will start out empty which is not intended I might be misunderstanding something but when we press some key to invoke search operation, shouldn't the text field be empty by default? > But I think it's searching in menus rather than panels, just to be picky about the naming Sorry for that 😅
Member

I might be misunderstanding something but when we press some key to invoke search operation, shouldn't the text field be empty by default?

No, it should contain the key that you pressed so that you don't have to press it again.

> I might be misunderstanding something but when we press some key to invoke search operation, shouldn't the text field be empty by default? No, it should contain the key that you pressed so that you don't have to press it again.
Author
Member

Ah, right. Didn't noticed this earlier.
I can take a look after some time today. But if you have quick fix, feel free to commit 🙂

Ah, right. Didn't noticed this earlier. I can take a look after some time today. But if you have quick fix, feel free to commit 🙂
Member

I don't have a quick fix right now, sry.

I don't have a quick fix right now, sry.
Pratik Borhade added 1 commit 2023-09-22 17:52:14 +02:00
b39fa4196e Pass only first char from utf8_buf
Rest chars are intentionally filled in debug mode with 0xff
So only pass first char from buffer
Author
Member

Rest chars are intentionally filled in debug mode with 0xff

see: wm_event_system.cc

> Rest chars are intentionally filled in debug mode with 0xff see: [wm_event_system.cc](https://projects.blender.org/blender/blender/src/branch/main/source/blender/windowmanager/intern/wm_event_system.cc#L5710)
Jacques Lucke reviewed 2023-09-22 18:00:37 +02:00
@ -1916,3 +1916,3 @@
"initial_query",
nullptr,
0,
2,
Member

Haven't tested it yet, but generally an utf8 buffer can have 1-4 bytes.

Haven't tested it yet, but generally an utf8 buffer can have 1-4 bytes.
Author
Member

but we only need first char from the buffer (i.e. pressed key), no? :)

(And the search menu is only invoked when A-to-Z letters are pressed so the pressed letter is always within 1 byte)

but we only need first char from the buffer (i.e. pressed key), no? :) (And the search menu is only invoked when A-to-Z letters are pressed so the `pressed letter` is always within 1 byte)
Member

Yeah, but the initial_query input could totally be used elsewhere in the future. Fixing the issue here at that level seems wrong.

Better only change where the operator is invoked, because the actual error is passing in the debug values. You should be able to get the correct size for the first utf8 char using BLI_str_utf8_as_unicode_step_safe. Otherwise just pass in the first byte since we are only dealing with a-z there for now anyway as I rightly pointed out.

Yeah, but the `initial_query` input could totally be used elsewhere in the future. Fixing the issue here at that level seems wrong. Better only change where the operator is invoked, because the actual error is passing in the debug values. You should be able to get the correct size for the first utf8 char using `BLI_str_utf8_as_unicode_step_safe`. Otherwise just pass in the first byte since we are only dealing with a-z there for now anyway as I rightly pointed out.
Pratik Borhade changed title from Fix: Garbage string when searching in panels to Fix: Garbage string when searching in menu 2023-09-23 13:07:46 +02:00
Pratik Borhade added 1 commit 2023-09-24 14:49:37 +02:00
Member

Sorry for wasting your time on this one with unclear instructions. By "better only change where the operator is invoked" I meant the ui_handle_menu_letter_press function which calls the operator.

I committed the fix I had in mind now: eef2a706b4.

Sorry for wasting your time on this one with unclear instructions. By "better only change where the operator is invoked" I meant the `ui_handle_menu_letter_press` function which calls the operator. I committed the fix I had in mind now: eef2a706b45227689ae2f1b55a7c28ff6dbee8ba.
Jacques Lucke closed this pull request 2023-09-24 22:39:52 +02:00
Author
Member

Thanks :)

Thanks :)
Pratik Borhade deleted branch search-type-query 2023-09-25 12:58:36 +02:00

Pull request closed

Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#112719
No description provided.