Refactor: BLF Offset from Cursor Position Early Exits #120673

Merged
Harley Acheson merged 1 commits from Harley/blender:BlfEarlyExits into main 2024-04-15 20:50:34 +02:00
Member

BLF function blf_str_offset_from_cursor_position returns the character
offset in a string given a horizontal cursor position. It currently has
no early exits, but can do so for no string or empty string. For negative
position values (so left of the string), do not exit out with zero but
instead act as if it were zero to ensure we test against the first glyph,
which might not be part of the character.

BLF function blf_str_offset_from_cursor_position returns the character offset in a string given a horizontal cursor position. It currently has no early exits, but can do so for no string or empty string. For negative position values (so left of the string), do not exit out with zero but instead act as if it were zero to ensure we test against the first glyph, which might not be part of the character.
Harley Acheson added 1 commit 2024-04-15 20:24:50 +02:00
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
668d010f70
Refactor: BLF Offset from Cursor Position Early Exits
BLF function blf_str_offset_from_cursor_position returns the character
offset in a string given a horizontal cursor position. It currently has
no early exits, but can do so for no string or empty string. For negative
position values (so left of the string), do not exit out with zero but
instead act as if it were zero to ensure we test against the first glyph,
which might not be part of the character.
Harley Acheson added this to the User Interface project 2024-04-15 20:25:01 +02:00
Author
Member

@blender-bot build

@blender-bot build
Harley Acheson merged commit b38f27ae10 into main 2024-04-15 20:50:34 +02:00
Harley Acheson deleted branch BlfEarlyExits 2024-04-15 20:50:36 +02:00
Campbell Barton reviewed 2024-04-17 01:33:51 +02:00
@ -1030,1 +1034,4 @@
/* For negative position, don't early exit with 0 but instead test as
* if it were zero. First glyph might not be from first character. */
location_x = std::max(location_x, 0);

This does nothing, as the value has been assigned to data.location_x and is no longer used.

This does nothing, as the value has been assigned to `data.location_x` and is no longer used.
Author
Member

@ideasman42

Yikes! Thanks for noticing this. I'll fix this ASAP, but have to get back into the weird (RTL) test case this was meant to fix as I don't want to lose track of it.

@ideasman42 Yikes! Thanks for noticing this. I'll fix this ASAP, but have to get back into the weird (RTL) test case this was meant to fix as I don't want to lose track of it.
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
2 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#120673
No description provided.