-
Notifications
You must be signed in to change notification settings - Fork 6
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
Repl #68
base: develop
Are you sure you want to change the base?
Conversation
let (width, _height) = termion::terminal_size().unwrap(); | ||
let padding = 5; | ||
let columns = width / (max_length + padding); | ||
let mut tw = TabWriter::new(writer).padding(padding as usize); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may want to ditch this albeit neat method of table generation and go for something that will produce better results in our case.
Issues at the moment:
- Sort order is inconsistent with expectation
- Every column is treated as if it was as wide as the widest
Don't forget to print a newline in the middle of a row still.
Proper error handling is always the topc of a good Rust engineer, right?
} | ||
println!(); | ||
print!("{}{}", | ||
termion::cursor::Left(1000), // XXX |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it worth fixing this now?
|
||
prompt::ps1(&mut context.stdout); | ||
} | ||
|
||
pub fn insert(context: &mut ActionContext, c: char) { | ||
if let Ok((x, y)) = context.stdout.cursor_pos() { | ||
// XXX: Why did this panic? | ||
let i = (x - context.prompt_length) as usize; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Worth looking into this again for a bit.
@@ -20,7 +20,7 @@ maintenance = { status = "experimental" } | |||
travis-ci = { repository = "https://github.com/nixpulvis/oursh" } | |||
|
|||
[features] | |||
default = ["raw", "shebang-block"] | |||
default = ["raw", "history", "completion", "shebang-block"] | |||
|
|||
# TODO: Justify and explain features. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As always, I think documentation will mark the end of the PR.
Generally in a collaborative environment (which this is currently not), I like this, writing a summary gives people time to review as well as giving future developers the needed information.
@@ -134,9 +136,10 @@ pub fn executable_completions(text: &str) -> Completion { | |||
0 => Completion::None, | |||
1 => Completion::Complete(matches.remove(0)), | |||
_ => { | |||
// TODO: Support POSIX style lexicographical order? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm torn on this, as am I torn on row major vs column major order.
let columns = width / (max_length + padding); | ||
let mut tw = TabWriter::new(writer).padding(padding as usize); | ||
// TODO: Determine table width/height and calculate iteration better | ||
let mut _row = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leave a note here about what we are planning on using row
for.
@@ -20,12 +20,12 @@ impl History { | |||
return; | |||
} | |||
|
|||
// HACK: There's got to be a cleaner way. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
First pass review done. Overall, I think the only big open question is how to decouple Also, as usual, error handling could be better. |
Specifically, this does not look to implement everything in #48, though I do hope to get completion working in a somewhat basic state before I move on to making things line up for the modern language. It's worth thinking about how this influences the design though.
The primary goal of this PR is to reintegrate the REPL module and start solidifying it. Unfortunately that means we are back to dealing with #20 which this reverts the partial fix for in a PR it should never have landed in to begin with: #51.
fixes #42
reopens #20