Skip to content

Commit

Permalink
Build Terminal as a plain struct rather than @.
Browse files Browse the repository at this point in the history
  • Loading branch information
eevee committed Jul 21, 2013
1 parent 9c7d76f commit aae854b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
8 changes: 3 additions & 5 deletions amulet/ll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ struct Terminal {
//term_type: ~str,
}

pub fn Terminal() -> @Terminal {
pub fn Terminal() -> Terminal {
let error_code: c_int = 0;
// NULL first arg means read TERM from env (TODO).
// second arg is a fd to spew to on error, but it's not used when there's
Expand Down Expand Up @@ -110,7 +110,7 @@ pub fn Terminal() -> @Terminal {
}
}

let term = @Terminal{
return Terminal{
// TODO would be nice to parametrize these, but Reader and Writer do
// not yet expose a way to get the underlying fd, which makes the API
// sucky
Expand All @@ -124,8 +124,6 @@ pub fn Terminal() -> @Terminal {
c_terminfo: terminfo,
tidy_termstate: termios::TidyTerminalState(0),
};

return term;
}
#[unsafe_destructor]
impl Drop for Terminal {
Expand Down Expand Up @@ -365,7 +363,7 @@ impl Terminal {

// Full-screen

pub fn fullscreen_canvas(@self, cb: &fn(&mut Canvas)) {
pub fn fullscreen_canvas(&self, cb: &fn(&mut Canvas)) {
// Enter fullscreen
let _tidy_cup = self.write_tidy_cap("smcup", "rmcup");

Expand Down
3 changes: 2 additions & 1 deletion demos/howto-06-chgat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ extern mod amulet;
use amulet::ll::Style;

fn main() {
let mut canvas = amulet::ll::Terminal().enter_fullscreen();
let term = amulet::ll::Terminal();
let mut canvas = term.enter_fullscreen();

canvas.write("A big string which I didn't care to type fully");

Expand Down

0 comments on commit aae854b

Please sign in to comment.