Skip to content
This repository has been archived by the owner on Sep 28, 2023. It is now read-only.

Replace char-by-char sends with a single call #15

Closed
wants to merge 1 commit into from
Closed

Replace char-by-char sends with a single call #15

wants to merge 1 commit into from

Conversation

pfernandez
Copy link
Contributor

Hey there. I'm currently working on a Clojure formatter and have been having trouble with the way Zepl inserts text.

There may be a good reason why text was being sent to the terminal one character at a time instead of all at once, but simplifying it into a single call to term_sendkeys fixes duplicate artifacts that I was seeing inside the leinigen repl with Clojure.

Before

Screen Shot 2022-04-29 at 8 05 20 PM

After

Screen Shot 2022-04-29 at 8 07 59 PM

The only other solution I could find was to call term_sendkeys directly inside the formatter function, then returning an empty string. It's definitely hacky though:

function zepl#contrib#clojure#formatter(lines)
   " ...process the lines
   let lines = join(lines, "\n") . "\n"

   " Note the need for a global bufnr, or using bufnr('zepl: ')
   term_sendkeys(g:zepl_bufnr, lines)
   return ''
endfunction

axvr added a commit that referenced this pull request Apr 30, 2022
The earlier "rlwrap artefact" fix/work-around would actually cause some
REPLs such as `lein repl` to artefact too (although not as badly).

This change makes the usage of the rlwrap fix optional with the `rlwrap`
key in `repl_config` and will be auto-enabled when the REPL command is
prefixed with "rlwrap".

Related: #9, #15
Co-authored-by: Paul Fernandez <paul4nandez@gmail.com>
@axvr
Copy link
Owner

axvr commented Apr 30, 2022

Thanks, I've pushed a commit (949332f) to fix this. The char-by-char sending was to fix artefacting issues caused by using rlwrap (see #9). The commit makes usage of the "rlwrap fix" optional.

(+ I added you as a co-author to the commit.)

@axvr axvr closed this Apr 30, 2022
@pfernandez
Copy link
Contributor Author

Thanks, I've pushed a commit (949332f) to fix this. The char-by-char sending was to fix artefacting issues caused by using rlwrap (see #9). The commit makes usage of the "rlwrap fix" optional.

(+ I added you as a co-author to the commit.)

Nice, I'll give this a try tomorrow when I'm back at work, but this definitely looks like it will work. 👍

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

Successfully merging this pull request may close these issues.

2 participants