Commit Graph

1335 Commits

Author SHA1 Message Date
ocornut
1829b4cd7c ImStrv: Combo(), ListBox(): seems better to not introduce the ImStrv [] versions?
As 1) user is unlikely to store that on their end. 2) nowadays with lambdas isn't an easy user-side conversion.
Then we limit explosion of an already messy API.
2025-11-05 20:30:29 +01:00
ocornut
6ea4275124 ImStrv: convert Combo()/ListBox() to use ImStrv in their getters.
Didn't convert Combo() "const char* items_separated_by_zeros" as this doesn't translate well when used via a ImStrv constructor, may actually aim to obsolete.
Fixed for shadowing local variable warning on 2025/06/25.
2025-11-05 20:30:29 +01:00
ocornut
47e1445f7d ImStrv: backtracked for now on supporting ImStrv for format strings.
It's widely incomplete and slow, requires a printf function taking non-zero-terminated format string to work.
Might do it eventually but it's much less a problem than labels. Format string are more frequently inlined in code and tend to be small, so existing solutions at call site can work better for now.
2025-11-05 20:30:29 +01:00
ocornut
0dbf93ace0 ImStrv: standardized code doing format copy, optimized ImStrStr 2025-11-05 20:30:28 +01:00
ocornut
2eb4ef2f1b ImStrv: Fixed various compile errors/warnings. 2025-11-05 20:30:28 +01:00
ocornut
7126bb2484 ImStrv: moved double char* function signatures under #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS blocks. 2025-11-05 20:30:28 +01:00
ocornut
63fe2f18a9 ImStrv: changed ImStrv xxx=NULL args to an explicit xxx=ImStrv()
This is mostly for the benefit of cimgui parser, ideally we would do without.
2025-11-05 20:30:28 +01:00
ocornut
8469bc60a1 ImStrv: Step 2 - change ImStrv typedef to struct, perform all other logic conversion.
Squashed commits (initially a commit from rokups + many rework by ocornut. keeping them separate commits made rebasing unnecessarily tricking so merged from 2024/02)
ImStrv: many fixes (see details), added imconfig class extension example, added natvis description.
ImStrv: rework toward ensuring End is always set to constant can be compile time calculated
ImStrv: using length(), fix ambiguous empty() function, fix altered behaviors, removed unused operators.
ImStrv: various tweaks and fixes. removed ImGuiTextRange from ImGuiTextFilter, fix test engine hooks, removed constructor only used twice.
2025-11-05 20:30:28 +01:00
Rokas Kupstys
a4b6520423 ImStrv: Step 1 - change string type to ImStrv in API. (REBASED)
(last rebase amend 2024/12/11)
2025-11-05 20:26:33 +01:00
ocornut
3c578fa87e InputText: restore truncating, now between UTF-8 codepoint. (#9029)
Amend e612536, 2a194e2.
2025-10-29 18:40:40 +01:00
ocornut
8df962a6ed Debug Tools: fixed DebugTextEncoding() potentially reading out of bounds if provided a trailing truncated UTF-8 sequence. 2025-10-29 17:58:52 +01:00
ocornut
2a194e21a0 InputText: revert truncation behavior from e612536 as it can truncate mid-UTF8. (#9029) 2025-10-29 17:24:23 +01:00
ocornut
9753c741b9 Disabled, ButtonBehavior: fixed a bug when a previously enabled item that got nav focus and then turns disabled could still be activated using keyboard. (#9036)
ButtonBehavior() was relying on lack of nav focus for keyboard handling
2025-10-29 16:43:27 +01:00
ocornut
7c483a0eba Add indentation to ButtonBehavior() - no logic change. 2025-10-29 16:39:37 +01:00
ocornut
8019d39545 Shuffle a few internal context fields to reduce padding. 2025-10-28 19:06:36 +01:00
ocornut
a1632c6116 InputText, Demo: amend comments to direct more users to the std::string version.
https://www.youtube.com/watch?v=pLwvNdpTpjs wasted a solid hour before finding this.
Crazy that people are using AI instead of actually _reading_ comments, demo and headers. (The information appeared multiple times on their screen)
2025-10-24 17:10:57 +02:00
ocornut
e6125361f9 InputText: paste does a truncate when not fitting instead of ignoring it. (#9029) 2025-10-23 20:53:29 +02:00
ocornut
b7e45b3a48 InputText: rework STB_TEXTEDIT_INSERTCHARS() signature to allow partial insertion (unused). (#9029)
To be submitted as a PR to nothings/stb.
2025-10-23 20:19:16 +02:00
ocornut
750c5d2a61 InputText: do not require anymore that CursorPos be clamped by user code. (#9029)
Add clamping outside of callback code + simplify logic. The previous logic checking for difference was because old code e.g. 21d03edcb0 required a ImTextCountCharsFromUtf8() which is not required since #7925.
2025-10-23 18:54:32 +02:00
ocornut
e571ccf3f4 InputText: removed unnecessary variables. 2025-10-23 18:43:20 +02:00
ocornut
63bfad401f MultiSelect: added ImGuiMultiSelectFlags_NoSelectOnRightClick. (#8200, #9015) 2025-10-20 18:58:45 +02:00
ocornut
36de604a5b InputText: avoid continuously overwriting ownership of ImGuiKey_Enter / ImGuiKey_KeypadEnter in order to allow e.g. external Shortcut to override behavior. (#9004) 2025-10-16 16:12:40 +02:00
ocornut
2a5e9a15e4 InputTextMultiline: fixed a crash when using ImGuiInputTextFlags_WordWrap and resizing the parent window while keeping the multi-line field active. (#9007, #3237) 2025-10-15 19:12:40 +02:00
ocornut
7d8d587bc0 Version 1.92.5 WIP 2025-10-15 16:46:18 +02:00
ocornut
9a5d5c45f5 Version 1.92.4 2025-10-14 19:26:56 +02:00
ocornut
2b770a029b InputText: fixed an infinite loop error happening if a custom input text callback modifies/clear BufTextLen before calling InsertChars(). (#8994, #3237)
+ misc comments.
2025-10-08 19:06:12 +02:00
ocornut
2128e2f44b Style: added ImGuiCol_UnsavedMarker. (#8983) 2025-10-06 12:16:48 +02:00
ocornut
1c87024840 InputText: fixed single-line InputText() not applying fine character clipping properly (regression in 1.92.3). (#8967) 2025-09-29 13:38:27 +02:00
ocornut
0e7cd694eb Version 1.92.4 WIP 2025-09-18 15:38:46 +02:00
ocornut
1c544ee941 Version 1.92.3 2025-09-17 18:37:56 +02:00
ocornut
431f2c5abd InputText: fixed dubious code handling ImGuiInputTextFlags_EscapeClearsAll.
Specifically the missing = 0. Somehow only now got reported by Emscripten CI.
2025-09-15 19:32:24 +02:00
ocornut
36133d8ac4 InputText: Word-Wrap: hide vertical scrollbar but takes its width into account. (#3237, #952, #1062, #7363)
Also increase IMGUI_VERSION_NUM for good measure, forgot to increase it when moving to public api.
2025-09-12 16:03:18 +02:00
ocornut
b6a33f8ce1 InputText: Word-Wrap: amend 7f1e2bb to avoid triggering static analyzer. (#3237, #952, #1062, #7363)
And generally more logical this way anyhow.
2025-09-12 15:05:23 +02:00
ocornut
7f1e2bb8dd InputText: Word-Wrap: avoid word-wrap specific path InputTextLineIndexGetPosOffset() when word-wrap is disabled. (#3237, #952, #1062, #7363) 2025-09-12 15:03:33 +02:00
ocornut
8a94422246 InputText: optimize inactive path by avoiding an early ImStrlen(). 2025-09-11 21:26:10 +02:00
ocornut
ae832ce532 InputText: moved blocks so same text rendering code is now used for active and inactive states.
(ignore whitespace to visualize this change easily)
2025-09-11 21:26:04 +02:00
ocornut
1e52e7b90c InputText: Added a line index. Refactored cursor and selection rendering, now simpler, easier to reason about, and faster. (#3237, #952, #1062, #7363) 2025-09-11 21:26:01 +02:00
ocornut
e2f314d613 InputText: fixed misassignment to unused Scroll.y variable when using ImGuiInputTextFlags_NoHorizontalScroll.
Amend d474ed7f7 (#7913, #383)
2025-09-11 15:06:25 +02:00
ocornut
55f590c1d1 Selectable: ImGuiSelectableFlags_SelectOnNav doesn't select when holding Ctrl, to be consistent with multi-select.
Amend e66afbb + remove needless line in CloseCurrentPopup() block
2025-09-10 22:29:42 +02:00
Harry Mander
5e5658e68f Debug Tools: fixed assertion failure when opening a combo box while using io.ConfigDebugBeginReturnValueOnce/ConfigDebugBeginReturnValueLoop. (#8931) 2025-09-10 19:12:03 +02:00
ocornut
013c4ed476 InputText: fixed gross buffer underflow introduced by a82f66a. (#3237, #952, #1062, #7363)
Would typically not crash by detected by sanitinizers.
2025-09-10 19:00:05 +02:00
ocornut
2f1d1c8b2f Focus, InputText: fixed an issue where SetKeyboardFocusHere() did not work on InputTextMultiline() with ImGuiInputTextFlags_AllowTabInput. (#8928) 2025-09-10 18:31:34 +02:00
ocornut
1cd08b883c TabBar: fixed calling TabBarQueueFocus() before submitting tabs. (#8929, #6681) 2025-09-10 18:03:34 +02:00
ocornut
4e98fb20e2 TabBar: Internals: added TabBarFindByID(), TabBarRemove() helpers.
Currently only for the benefit of TestEngine.
2025-09-10 17:59:26 +02:00
ocornut
e66afbbbe0 Selectable: ImGuiSelectableFlags_SelectOnNav doesn't close popups. 2025-09-09 17:33:03 +02:00
ocornut
230418a75d InputText: Word-Wrap: attempt to track cursor while resizing frame/parent. (#3237, #952, #1062, #7363) 2025-09-08 11:56:22 +02:00
ocornut
16415aa39f InputText: Word-Wrap: added custom implementation for Home/End that is word-wrap friendly. (#3237, #952, #1062, #7363) 2025-09-08 11:56:22 +02:00
ocornut
a82f66a9b0 InputText: Word-Wrap: added ImGuiInputTextFlags_WordWrap support. (#3237, #952, #1062, #7363) 2025-09-08 11:56:20 +02:00
ocornut
e422a38e4c InputText: internals: expose LineCount, GetPreferredOffsetX(). 2025-09-08 11:54:34 +02:00
ocornut
3cc7d1c81a InputText: InputTextCalcTextSize() uses ImFontCalcTextSizeEx().
(for #3237, #952, #1062, #7363)
2025-09-08 11:54:33 +02:00