You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I just started using ImGuiColorTextEdit and I'm seeing a weird behaviour when backspacing a Tab, however since it's such an obvious thing I'm not sure if the problem is on my side ;)
Basically, given a line like this:
--------Hello World.
...where the '--------' is a single Tab character (with tab width 8), when the cursor is positioned at the H, and Backspace is pressed (so that the Tab is deleted), the cursor will be positioned at column 7, and not be at the start of the line:
The problem seems to be here, where the cursor position is always decremented by one:
I fix this here like this, checking if the removed character is a Tab, and if yes, decrement by the tabsize. Note the isTab and the extra if block where the column is decremented:
...and of course my crude fix doesn't work when the Tab in question isn't of width mTabSize because there's text "leaking" into the tab :D
I'll come up with a better solution (is there an existing function to convert a character index in a line into a cursor column, taking tabs into account?).
Hi, I just started using ImGuiColorTextEdit and I'm seeing a weird behaviour when backspacing a Tab, however since it's such an obvious thing I'm not sure if the problem is on my side ;)
Basically, given a line like this:
...where the '--------' is a single Tab character (with tab width 8), when the cursor is positioned at the H, and Backspace is pressed (so that the Tab is deleted), the cursor will be positioned at column 7, and not be at the start of the line:
The problem seems to be here, where the cursor position is always decremented by one:
ImGuiColorTextEdit/TextEditor.cpp
Line 1875 in 0a88824
I fix this here like this, checking if the removed character is a Tab, and if yes, decrement by the tabsize. Note the
isTab
and the extra if block where the column is decremented:...it seems to work, but being new to the code base I'm not sure if I overlooked something.
Do you want me to provide a PR for this?
Cheers!
The text was updated successfully, but these errors were encountered: