Skip to content

Conversation

@tw4452852
Copy link
Contributor

@tw4452852 tw4452852 commented Dec 18, 2025

This is especially useful when line buffer could be prefilled by an external program and then be edited later.

BTW, this also paves the way for testing of getline, although we need to work around rawterm stuff first.

Signed-off-by: Tw <[email protected]>
Change-Id: I5257a592faabbc4c6e98d4ede61242366a6a6964
@tw4452852 tw4452852 marked this pull request as draft December 18, 2025 06:57
@tw4452852 tw4452852 marked this pull request as ready for review December 18, 2025 07:40
@sogaiu
Copy link
Contributor

sogaiu commented Dec 18, 2025

I'm not sure that changing this bit:

  (fn getline-fn
    [&opt prompt buff _]

to:

  (fn getline-fn
    [&opt prompt buff prefill]

is a good idea.

IIUC, (fn getline-fn ...) is what make-getline returns. Not sure, but I think the _ argument for (fn getline-fn ...) is space for an "environment".

An example of this can be seen here in the call to gl:

spork/spork/netrepl.janet

Lines 352 to 356 in 4224d56

(def gl (make-getline nil get-completions get-docs))
(forever
(def p (recv))
(if-not p (break))
(def line (gl p @"" root-env))

i.e.

(gl p @"" root-env)

...though may be I'm missing something 😅

@tw4452852
Copy link
Contributor Author

Hmm, You're right. I originally thought this parameter is just reserved for future use. Maybe we should add another parameter?

@sogaiu
Copy link
Contributor

sogaiu commented Dec 18, 2025

Not sure 😅

Random thought...use a dynamic variable? Don't know if that's a good idea.

May be @bakpakin would have better thoughts about this.

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