-
Notifications
You must be signed in to change notification settings - Fork 11
Cursor movement and testing revamp #56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
71 commits
Select commit
Hold shift + click to select a range
7b1022a
A solid attempt
Real-Septicake 452d5ce
Fixed it
Real-Septicake ecc0983
Moved things
Real-Septicake 44db8f4
Print raw disk space
Real-Septicake c62fafd
Add backspace functionality
Real-Septicake 8be1f33
Removed disk files from keyboard branch
Real-Septicake 6d46a1c
Arrow key functionality
Real-Septicake 1efa029
Format and rename `delete` to `deletePrevChar`
Real-Septicake 271eb5d
remove disk.o from makefile
Real-Septicake b083109
Added safeguards to cursor movement functions
Real-Septicake 076ba3e
Add `delete` key functionality
Real-Septicake 582c5f8
Background now gotten directly from deleted character
Real-Septicake 4717d32
Start work on highlighting with cursor
Real-Septicake 005f805
Continue working on highlighting
Real-Septicake 861ebd0
Cursor movement after highlighting done, still need to work on deletion
Real-Septicake 43a9b3f
Format
Real-Septicake cbfa9e5
Fixed moving cursor backwards while continuing to highlight
Real-Septicake d1b08ac
Add Key_up and Key_down functionality for highlighting
Real-Septicake 0123424
Format
Real-Septicake 519681a
Add support for deletion while highlighting
Real-Septicake 8d0f74b
Delete highlighted characters when beginning to type with highlighted…
Real-Septicake a1c34bf
Initial code/changes for testing the keyboard/editing functionality.
Alex105178 7efa739
Added basic test framework for keyboard.
Alex105178 7962b2c
Organize functions a bit more
Real-Septicake a2bb9b9
Merge branch 'keyboard' of https://github.com/Real-Septicake/mOS_disk…
Real-Septicake ef7fb26
Add highlight deletion functions to header file
Real-Septicake 65353b7
Add further testing
Real-Septicake 71705df
Add information on what tests timed out, and added a space after the …
Real-Septicake 8b1c041
Add check command for cursor position relative to beginning of vga me…
Real-Septicake 220e308
Add more position checks to current test command sequence
Real-Septicake f145797
Documentation and formatting
Real-Septicake 57f9511
Add logging for the starting and ending of tests
Real-Septicake c4cfbd3
remove `init_pos` from the keyboard test
Real-Septicake 4ac7b90
Correct lack of mutex usage for getting number of active instances
Real-Septicake 8e3b16e
Fix lack of increment in %i and %s in stdio.c
Real-Septicake 3e2a07c
Add way to print values for debugging in ASSERT_M
Real-Septicake 26048c5
Fix edge case of input of %i being 0
Real-Septicake b6618ee
test_keyboard now uses new assert macro, chkPosCMD now takes line and…
Real-Septicake 65ffe5c
Use the already present `len` variable instead of creating `bufSize`
Real-Septicake eeee2af
Add utilities to prevent a change in the size of the VGA from complet…
Real-Septicake 4b28577
Documentation
Real-Septicake 7673409
Added macro that fails when reached, added logic to both assert and f…
Real-Septicake edabc13
Allow for execCMD to return a non-zero value to represent a fatal err…
Real-Septicake b27fc07
Formatting
Real-Septicake e7755fe
Add new lines to improve readability, removed unused file name parame…
Real-Septicake 86473f4
Prevent key presses that do not produce characters from clearing the …
Real-Septicake 5d11ede
Update how closing Qemu instances is handled
Real-Septicake fd31503
Formatting
Real-Septicake 1c1296c
Remove unnecessary `undef`s
Real-Septicake 873067d
add `test_helper.h` to include path
Real-Septicake 4e2ea0a
Add tests to make sure that keypresses that do not produce characters…
Real-Septicake 8a04762
Now using `sizeof(buff)` to get the size of the error text buffer
Real-Septicake da3fe97
Add termcolor for test output readability, color scheme is not finalized
Real-Septicake 0e2681e
Implement several of the suggested changes, more to do but committing…
Real-Septicake f8fede8
Rename `cursor_struct` to `VGA_Cursor`
Real-Septicake 238d957
Replace `extern` for usage of vga cursor with a getter
Real-Septicake c113f5a
Used a tab instead of spaces
Real-Septicake c9d465e
Correct empty line prevention in assertion macros
Real-Septicake d5e2414
Add expected number of characters written as a parameter, add 0 edge …
Real-Septicake 23d6a1a
Formatting... again
Real-Septicake 7b8de96
Consolidate both assert functions into one
Real-Septicake 9707d95
Make `fmt` of snprintf and vsnprintf `const`
Real-Septicake 745d6d9
Formatting once more
Real-Septicake 6356409
make `p` const to get the compiler to shut up
Real-Septicake 16ba516
Extracted a decent chunk of duplicate code, it is likely possible to …
Real-Septicake 1a57af6
Update dependencies listed in README
Real-Septicake caeef14
`venv` not `virtualenv`
Real-Septicake f3f8848
Create file for handling special key cases
Real-Septicake 4bc987e
Formatting once again
Real-Septicake 77dbb85
Attempt at a quick fix for termcolor not respecting Windows' terminal…
Real-Septicake 4f4125d
Use colorama instead of the inelegant selective disabling of color on…
Real-Septicake File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,116 @@ | ||
| #include "key_handlers.h" | ||
|
|
||
| #include "video/VGA_text.h" | ||
|
|
||
| void specialHandler(KeyPress out) { | ||
| if (!(out.modifiers & KEY_MOD_SHIFT)) { | ||
| switch (out.code) { | ||
| case Key_backspace: | ||
| if (getCursor()->highlight_offset) { | ||
| highlightDeletePrev(getCursor()->highlight_offset); | ||
| getCursor()->highlight_offset = 0; | ||
| } else | ||
| deletePrevChar(); | ||
| break; | ||
| case Key_delete: | ||
| if (getCursor()->highlight_offset) { | ||
| highlightDeleteCurrent(getCursor()->highlight_offset); | ||
| getCursor()->highlight_offset = 0; | ||
| } else | ||
| deleteCurrentChar(); | ||
| break; | ||
| case Key_left: | ||
| if (getCursor()->highlight_offset) { | ||
| cursorHighlightLeft(getCursor()->highlight_offset); | ||
| getCursor()->highlight_offset = 0; | ||
| } else | ||
| cursorLeft(); | ||
| break; | ||
| case Key_down: | ||
| if (getCursor()->highlight_offset) { | ||
| cursorHighlightDown(getCursor()->highlight_offset); | ||
| getCursor()->highlight_offset = 0; | ||
| } else | ||
| cursorDown(); | ||
| break; | ||
| case Key_up: | ||
| if (getCursor()->highlight_offset) { | ||
| cursorHighlightUp(getCursor()->highlight_offset); | ||
| getCursor()->highlight_offset = 0; | ||
| } else | ||
| cursorUp(); | ||
| break; | ||
| case Key_right: | ||
| if (getCursor()->highlight_offset) { | ||
| cursorHighlightRight(getCursor()->highlight_offset); | ||
| getCursor()->highlight_offset = 0; | ||
| } else | ||
| cursorRight(); | ||
| break; | ||
| default: | ||
| break; | ||
| } | ||
| } else { | ||
| if (((out.code == Key_up || out.code == Key_left) && | ||
| cursorIsAtStart()) || | ||
| ((out.code == Key_down || out.code == Key_right) && | ||
| cursorIsAtEnd())) | ||
| return; | ||
| if ((out.code == Key_up || out.code == Key_left || | ||
| out.code == Key_down || out.code == Key_right) && | ||
| !getCursor()->highlight_offset) | ||
| highlightCurrentChar(); | ||
| switch (out.code) { | ||
| case Key_up: | ||
| for (int i = 0; i < VGA_WIDTH && !cursorIsAtStart(); i++) { | ||
| if (getCursor()->highlight_offset > 0) { | ||
| highlightCurrentChar(); | ||
| cursorLeft(); | ||
| } else { | ||
| cursorLeft(); | ||
| highlightCurrentChar(); | ||
| } | ||
| getCursor()->highlight_offset--; | ||
| } | ||
| break; | ||
| case Key_down: | ||
| for (int i = 0; i < VGA_WIDTH && !cursorIsAtEnd(); i++) { | ||
| if (getCursor()->highlight_offset < 0) { | ||
| highlightCurrentChar(); | ||
| cursorRight(); | ||
| } else { | ||
| cursorRight(); | ||
| highlightCurrentChar(); | ||
| } | ||
| getCursor()->highlight_offset++; | ||
| } | ||
| break; | ||
| case Key_left: | ||
| if (getCursor()->highlight_offset > 0) { | ||
| highlightCurrentChar(); | ||
| cursorLeft(); | ||
| } else { | ||
| cursorLeft(); | ||
| highlightCurrentChar(); | ||
| } | ||
| getCursor()->highlight_offset--; | ||
| break; | ||
| case Key_right: | ||
| if (getCursor()->highlight_offset < 0) { | ||
| highlightCurrentChar(); | ||
| cursorRight(); | ||
| } else { | ||
| cursorRight(); | ||
| highlightCurrentChar(); | ||
| } | ||
| getCursor()->highlight_offset++; | ||
| break; | ||
| default: | ||
| break; | ||
| } | ||
| if ((out.code == Key_up || out.code == Key_left || | ||
| out.code == Key_down || out.code == Key_right) && | ||
| !getCursor()->highlight_offset) | ||
| highlightCurrentChar(); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| #ifndef KEY_HANDLERS_H | ||
| #define KEY_HANDLERS_H | ||
|
|
||
| #include "keyboard.h" | ||
|
|
||
| void specialHandler(KeyPress out); | ||
|
|
||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.