dbuenzli / down

An OCaml toplevel (REPL) upgrade
http://erratique.ch/software/down
ISC License
81 stars 3 forks source link

tab completion fix, fixes #21 #22

Closed hannesm closed 5 years ago

hannesm commented 5 years ago

this fixes #21:

# Uni<tab>
  Unix_cstruct : 
  Unit : (module Stdlib__unit)
  Unix : 
  UnixLabels : 
# Uni

the issue was mainly the String.trim cs in id_complete (which ate too much, namely all the whitespaces and the tab of the last completion), but then I needed a way to skip the last empty line (by enhancing Txt.lines with an optional named empty argument, similar to Astring.String.cuts).

dbuenzli commented 5 years ago

Mmmh actually I'd rather not have that ~empty, neither in the API nor in the post-process of ocp-indent's output (it sometimes outputs largish stuff, I'm not sure there might not be empty lines there). Can't we rather do without the trim ? I guess I put it there as a reflex.

hannesm commented 5 years ago

I force-pushed another solution that strips empty results in complete_word, and does not modify Txt.lines.

dbuenzli commented 5 years ago

I force-pushed another solution that strips empty results in complete_word,

As I said I rather not arbitrarily strip's ocp-indent pretty-printed output. I have something in 04b55d7ece3f8a6f9e90993 tell me if it doesn't work.

Thanks for the analysis.

hannesm commented 5 years ago

thanks daniel, your solution works fine for me as well.