Skip to content
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

Recall previous inputs with up/down arrows #1

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

jwt27
Copy link

@jwt27 jwt27 commented Feb 2, 2020

This patch implements recalling previously typed commands with the up and down arrow keys, as is common in most shells and other debuggers.

Binary size is increased by 244 bytes and memory requirement by 516 bytes (adjustable with LINE_HISTORY_LEN).

@jwt27 jwt27 force-pushed the master branch 4 times, most recently from 865682b to 87e69cb Compare February 7, 2020 18:28
@ecm-pushbx
Copy link

After implementing my own history recall feature in lDebug I compared yours in this PR to mine. Differences:

  1. I use 2 bytes for an offset per entry, you are using 4 bytes for the next/previous pointers

  2. I don't store the terminating CR as you seem to

  3. I don't have to scan a history entry to find its size

  4. I don't bother skipping leading whitespace

  5. I default to allocate the buffer in its own segment instead of in the debugger's data segment

  6. I started with 1 KiB for the data segment buffer and increased the size to 8 KiB for the additional segment buffer, whereas you use about 500 bytes by default

  7. I only allow using Up or Down to navigate the history recall if no editing took place yet

  8. It appears your history recall is only for rawinput, that is if inDOS is set. This is similar to mine, but I document that and provide ways to enable using rawinput even if the input is from a DOS stdin terminal

  9. I allow more than one way to encode the Up/Down arrow keypresses which makes it work on dosemu in -dumb mode

Similarities also include rejecting empty lines and those duplicating the prior line.

@ecm-pushbx
Copy link

ecm-pushbx commented Apr 20, 2021

Correction: It appears your patch does away with the interrupt 21h service 0Ah call entirely and always uses interrupt 16h to read input. In my implementation DOS application terminal input is still done with the DOS service by default, which means the debugger's line history is not available. (I do enter received lines into the history buffer regardless.) And if rawinput is used (eg DCO flag 800h set) then it can still use interrupt 21h to read input, but using services which read single bytes from stdin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants