mirror of
https://github.com/ocornut/imgui.git
synced 2026-11-14 19:04:44 +00:00
Home key doesn't work if cursor is at the end of the buffer in InputTextMultiline() #588
Labels
No labels
accidentally closed
android
backends
bug
building
clipper
coloredit
color spaces
cplusplus
data types
demo
disabled
doc
docking
dpi
drag drop
drawing/drawlist
dropped
dx12
enhancement
focus
font/text
gallery
help wanted
idle/power saving
ime
in progress
inputs
inputtext
internals
label/id and id stack
language bindings
layout
linux/bsd
menus
multi-contexts
multi-threading
multi-viewports
nav
news/info
opengl
optimization
osx/ios
overlap
plot/graph
popups
question
scrolling
selection
settings
sliders/drags
style
tables/columns
tabs
test wanted
tools
tooltips
tree
tricks & tips
useful widgets
vulkan
web
window pos/depth
window sizing
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ocornut/imgui#588
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Simple way to reproduce:
In the "Multi-line Text Input" widget of the demo window delete the last line so that the cursor is at the end of "eax", press the home key and see nothing happen.
After looking into this for a bit it seems that the case when the cursor is at the end of the buffer (and pointing at ’\0’) is not handled correctly in the multi line mode (stb_textedit.h lines: 506-516).
Not sure if it's a problem with stb_textedit or the way it's used.
I'd try to fix this myself, but it would probably take to much time to understand how stb_textedit works and how it's used in dear imgui, so sorry for that.
Confirmed. I'll look at it eventually. I don't know much about stb_textedit either, have to dig.
You can get around this by editing stb_textedit.h as a temporary fix.
Search for "case STB_TEXTEDIT_K_LINESTART:"
Change it from:
to:
It's not the prettiest solution, but it should get you by for now. (similar fixes needed for up-arrow as well)
It seems like the error in the logic is in
stb_textedit_find_charposhere:The home key handler (and some related ones, like up, which is analogously broken) all use this subroutine to locate the line they are in.
edit: The
if(single_line)...elsebranch in there is flawed. I'll make a PR for the fix.Should be fixed now.