diff options
author | Raymaekers Luca <luca@spacehb.net> | 2025-04-27 12:52:06 +0200 |
---|---|---|
committer | Raymaekers Luca <luca@spacehb.net> | 2025-04-27 13:05:34 +0200 |
commit | f87f7b4f0aaccc65d03ccee5bb11915ead6fb0e1 (patch) | |
tree | d54df0bfde3dbffa02b1f138af4f12456f261e54 /insert.md | |
parent | 0574f5a7c5159a2ae1d7d2182cec982509947db9 (diff) |
First pass at preparing for Github
Diffstat (limited to 'insert.md')
-rw-r--r-- | insert.md | 68 |
1 files changed, 0 insertions, 68 deletions
diff --git a/insert.md b/insert.md deleted file mode 100644 index cb00d1c..0000000 --- a/insert.md +++ /dev/null @@ -1,68 +0,0 @@ -# 1. InputBox - -InputBox(u32 BoxX, u32 BoxY, u32 BoxWidth, u32 BoxHeight, - wchar_t *Text, u32 TextLen, u32 TextIndex, - Bool Focused) - -TextIndex is where the edit cursor is in the text, so where the text should be displayed? - -It is most user friendly when the text moves as least as possible, so giving an offset will make it -scroll each time the user moves the cursor. No it should only move when the user moves the cursor -out of bounds. - - -There should be cursor logic and text logic - -# 2. Redraw text based on cursor - -```c -void -Redraw(u32 DrawnStart, u32 DrawnEnd) -{ - -} - -Box(BoxX, BoxY, Width, Height); -BoxedText(X+1, Y+1, Width-2, Height-2, - TextLen, Text); - -if (ev.key == TB_KEY_ARROW_LEFT) -{ - CursorX--; - TextIndex--; -} -else if (ev.key == TB_KEY_ARROW_RIGHT) -{ - CursorX++; - TextIndex++; -} -else if (ev.key == TB_KEY_ARROW_UP) -{ - // Scroll Up, Update TextIndex, Redraw -} -else if (ev.key == TB_KEY_ARROW_DOWN) -{ - // Scroll Down, Update TextIndex, Redraw -} -else if (ev.ch) -{ - Text[Textlen++] = ev.ch; - TextIndex++; - CursorX++; -} - -if (CursorX == BoxX + Width) -{ - // Scroll Down || Next Line (if empty) - // Update TextIndex, Redraw -} -else if (CursorX == BoxX) -{ - // Scroll up, Update TextIndex, Redraw -} -```` -It can be deterministic how we draw the text, and the cursor position is only needed to know where -to insert text. - -1. Do text insertion -2. Redrawing |