Closed doyougnu closed 3 years ago
Thank you for your contribution. Looks good to me for the most part. I'll be happy to merge it once you've looked over my comments.
There is also code to flash content in the function gnu-apl-interactive-send-current-function
. Perhaps it would make sense to merge this.
Thanks for you comments. I've made the requested changes.
For whatever reason there is an extra newline on input to the interpreter:
With this example
⎕ ← ⊂data ← (1 2 3 4) (2 5 8 6) (8 6 2 3) (8 7 6 1)
data
2 4⍴⍳8
calling gnu-apl-interactive-send-line
or gnu-apl-interactive-send-region
produces this:
╔═══════════════════════════════════════╗
║┏→━━━━━━┓ ┏→━━━━━━┓ ┏→━━━━━━┓ ┏→━━━━━━┓║
║┃1 2 3 4┃ ┃2 5 8 6┃ ┃8 6 2 3┃ ┃8 7 6 1┃║
║┗━━━━━━━┛ ┗━━━━━━━┛ ┗━━━━━━━┛ ┗━━━━━━━┛║
╚═══════════════════════════════════════╝
╔═══════╗
║1 2 3 4║
║5 6 7 8║
╚═══════╝
I believe the output should not have a tab character on the first line, like so:
╔═══════════════════════════════════════╗
║┏→━━━━━━┓ ┏→━━━━━━┓ ┏→━━━━━━┓ ┏→━━━━━━┓║
║┃1 2 3 4┃ ┃2 5 8 6┃ ┃8 6 2 3┃ ┃8 7 6 1┃║
║┗━━━━━━━┛ ┗━━━━━━━┛ ┗━━━━━━━┛ ┗━━━━━━━┛║
╚═══════════════════════════════════════╝
╔═══════╗
║1 2 3 4║
║5 6 7 8║
╚═══════╝
The issue with the indentation is caused by the fact that printing will start at the end of the buffer. GNU APL assumes that the cursor is at the beginning of the line, since after a command has been typed, the cursor has moved to the next line. When using gnu-apl-interactive-send-region
no command was actually input, which leaves the cursor after the prompt.
One solution to this would be to check if the buffer ends with a prompt (i.e. it's waiting for input) and then delete it before sending the command. This should be safe, as GNU APL only accepts commands from Emacs while it's waiting at the prompt.
This fix is independent of this PR though, so I'll merge this, and if you would like to implement that solution you're welcome to send another one.
The issue with the indentation is caused by the fact that printing will start at the end of the buffer. GNU APL assumes that the cursor is at the beginning of the line, since after a command has been typed, the cursor has moved to the next line. When using
gnu-apl-interactive-send-region
no command was actually input, which leaves the cursor after the prompt.One solution to this would be to check if the buffer ends with a prompt (i.e. it's waiting for input) and then delete it before sending the command. This should be safe, as GNU APL only accepts commands from Emacs while it's waiting at the prompt.
This fix is independent of this PR though, so I'll merge this, and if you would like to implement that solution you're welcome to send another one.
Thanks for the fast responses. I've opened an issue for this and intend to work on it. I have a long flight coming up so I'll give this a go then.
I'm writing a
spacemacs
layer forgnu-apl
and thought I would add some small niceties. All this PR does is add a function to flash regions when they are sent to the apl interpreter which can be disabled and a send line function. Any comments welcome.